Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python 3.8 support and bump macOS/iOS template epoch #1934

Merged
merged 9 commits into from
Aug 15, 2024

Conversation

freakboy3742
Copy link
Member

Python 3.8 is EOL in October, so the PEP 730 patches for iOS support won't be back ported to that release. There's also a need for a template epoch change because of the change in binary format on both iOS and macOS.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

"""Return classes that subclass Tool in a module in ``briefcase.integrations``, e.g.
{"android_sdk": AndroidSDK}."""
return dict(
inspect.getmembers(
sys.modules[f"briefcase.integrations.{tool_module_name}"],
lambda klass: (
inspect.isclass(klass)
and not inspect.isabstract(klass)
and issubclass(klass, (Tool, ManagedTool))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only substantive logic change required by the version upgrade.

With the move of Sequence from typing.Sequence to collections.abc.Sequence, SubprocessArgsT now returns True from inspect.isclass(), but raises an error if you try to use it in issubclass. Adding an additional check for inspect.isabstract() avoids the error, and also allows removing the explicit reference to Tool and ManagedTool classes.

tox.ini Outdated Show resolved Hide resolved
@freakboy3742
Copy link
Member Author

freakboy3742 commented Aug 7, 2024

Regarding review/merge strategy, the sequence is:

Also - unlike normal practice, we need to be careful to not delete branches after merging until the TODOs at the end are fully completed.

@rmartin16
Copy link
Member

rmartin16 commented Aug 9, 2024

Extracted from #1943 (comment):

As a broader topic; it's worth keeping in mind how this sort of change interacts with this sort of landing sequence. In the case of that PR, we're bumping the support revision on macOS templates, and bumping the template epoch, which has complicated the landing sequence. I don't think the changes you've suggested here would change anything - but if we're able to make changes that would simplify things, that's definitely something we should consider.

Yeah; I've definitely encountered this - even as recently as #1929. The solution I've been thinking about is basically the same approach we resolved this in other similar situations.

That is, when an app template repo needs to test against a specific version of Briefcase, you can specify BRIEFCASE_REPO and BRIEFCASE_REF in the text of the PR Body to change what CI uses for testing. Further, we added support for any CI running app-build-verify to use BRIEFCASE_TEMPLATE_REPO and BRIEFCASE_TEMPLATE_REF.

So, we could just extend this pattern to the build format templates for any use of app-build-verify.

Maybe something like:

  • BRIEFCASE[_-]<platform>[_-]<format>[_-]TEMPLATE[_-]REPO
  • BRIEFCASE[_-]<platform>[_-]<format>[_-]TEMPLATE[_-]REF

So, for example:

  • Briefcase-macOS-app-Template-Repo/Briefcase-macOS-app-Template-Ref
  • Briefcase-macOS-Xcode-Template-Repo/Briefcase-macOS-Xcode-Template-Ref

This would also probably be a good time to refactor all the regex logic on PR Body in to its own GitHub Action instead of continuing to duplicate it. (see beeware/.github#159)

@freakboy3742
Copy link
Member Author

As a broader topic; it's worth keeping in mind how this sort of change interacts with this sort of landing sequence.
...
Yeah; I've definitely encountered this - even as recently as #1929. The solution I've been thinking about is basically the same approach we resolved this in other similar situations.

The change you're suggesting would address the issue of running CI for a PR on Briefcase prior to landing the PRs for the template - but I'm not sure that's actually a problem that is causing us the problem here. We've got a reasonably well established pattern for landing template changes - rely on CI in the template (pointing at a branch of Briefcase) to validate the template works; merge the template PR; then re-run CI on the Briefcase PR; then merge the Briefcase PR. I'm not sure we gain a lot by further complicating our CI tooling just so that we can have a clean CI run on the Briefcase side prior to merging the template.

The problem in the case of this specific PR is that the branch redirection only applies on the PR - and so when merged to main, the template's merge CI run will fail. That's usually short lived because you can (almost) immediately merge the Briefcase PR, but in this case we can't because we need to retag the stub binary on the Xcode template before we can land the app template, which means the Xcode template's mainline needs to use a branch of Briefcase.

I guess one approach in this case would be to tag the new binary on the PR branch. That breaks the usual convention of tagging stub binaries on the main branch... but I guess the tagged commit will become part of the mainline as soon as the template is merged to main, so maybe that doesn't matter.

Even then, that wouldn't address the issue with the TODOs on the beeware/Python-Apple-support#191 - again, because the changes need to exist on the main branch (or, the 3.X branches in that case).

So - while this change would fix a problem, I'm not sure it's a problem we actually have in practice, and the complication to the CI workflows is such that I'm not sure it's worth it.

@rmartin16
Copy link
Member

I see. Out of curiosity, is there another example of this happening? At least where the CI for main needs configuration to pull from other repos for other than their main branch? Been racking my brain but this level of dependency seems rare.

Another thought is GitHub supports variables that can be configured outside of the CI workflows themselves. So, for these temporary periods where CI on main must behave differently, such configuration could control this.

@freakboy3742
Copy link
Member Author

I see. Out of curiosity, is there another example of this happening? At least where the CI for main needs configuration to pull from other repos for other than their main branch? Been racking my brain but this level of dependency seems rare.

Yes, it's rare - hence why we've been willing to live with some janky landing sequences on the rare occasion it happens.

Other than template and epoch changes, the only example I can think of where it has come up recently is where a template adds a dependency on a new template filter. This currently requires adding (and landing) the filter in one PR, then updating the template to use that filter, then updating briefcase to do whatever change needed the new template. Again, we have a workaround; it might be nice to be able to temporarily tell the template to use a branch of Briefcase when running on main.

Another thought is GitHub supports variables that can be configured outside of the CI workflows themselves. So, for these temporary periods where CI on main must behave differently, such configuration could control this.

I hadn't thought of using GitHub environment variables for this. The UX for setting this up is a bit messy, but I guess it would work, and it wouldn't be that much more complicated than the current "regex over PR body" approach. We'd probably also want a safety catch to make sure that we accidentally release Briefcase with the environment variable set on a template.

@freakboy3742
Copy link
Member Author

@mhsmith FYI - I had to revert the merge of the macOS Xcode template because having that template merged was breaking all the dependabot runs. When we do merge that template, we'll need to follow the remaining steps in rapid succession because until this PR is merged, any other PRs on Briefcase or a template will fail.

@mhsmith
Copy link
Member

mhsmith commented Aug 12, 2024

OK, then I'll approve the new PRs but leave them unmerged.

@freakboy3742 freakboy3742 marked this pull request as ready for review August 14, 2024 07:40
@freakboy3742
Copy link
Member Author

@mhsmith I've tagged and published the updated stub binaries on the framework-lib branch, so I've been able to (1) run CI on the macOS-app template branch, and (2) revert the change in the binary publication script that temporarily used this Briefcase branch.

That means the macOS-app template and this PR are ready for review.

Assuming you're OK with both, this template PRs can be merged, the CI re-run on this PR, and then merge this PR. If you want to hold off on the merging, I'm happy to do that in the morning.

@freakboy3742 freakboy3742 merged commit 9280740 into beeware:main Aug 15, 2024
52 checks passed
@freakboy3742 freakboy3742 deleted the version-bumps branch September 5, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants