Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add details on native packaging requirements exposed by mobile platforms #27
base: main
Are you sure you want to change the base?
Add details on native packaging requirements exposed by mobile platforms #27
Changes from 1 commit
eb2419a
8fef63e
d16035f
84dbd5f
2a40f47
2563270
b9b904c
45f748f
373bb09
d8a2ca6
f533395
8475360
2886f2c
7556850
cb85652
49806e2
ea1fb60
d249af6
50d8c26
a9776e0
8d46e06
5d06a56
3e1fc05
74705d8
f46d2b0
e1c278f
1a926eb
7967383
1fb0ffb
b44a322
dd93f1f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a nice solution. After reading this, I'm wondering what the actual problem here is from Beeware's perspective?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Android case, it's not really a problem per se; its more of a "consideration to keep in mind".
Let's say I have an Android project that uses a Python package A that has a binary module; that package has a dependency on B (which also has a binary module). When I do the compilation pass for ARM64, I
pip install A
, which does a dependency resolution pass to determine a compatible version of B. I then do a compilation pass for ARMv7, which does a separate dependency resolution pass to determine a compatible version of B. The use of a separate dependency resolution pass introduces the possibility that my ARMv7 and ARM64 binaries have entirely different versions of package B (and, I guess, potentially package A as well).That's not a problem; it could even be argued as "working as designed". It's how BeeWare (strictly, the Chaquopy subsystem that Briefcase uses) is working at present; it just might be a little surprising if you don't have a systematic way of at least flagging that there are different versions installed for each platform. I'll modify the wording to clarify this.
However, for the same project on iOS, this isn't an option. iOS apps perform one compilation pass per ABI (i.e. one for the simulator, and one for the physical device), so the final installed artefact needs to contain a single fat binary with all the architectures. This could be treated as an install-time problem rather than distribution problem, though; I'll add a note about that possible approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a good and concrete example. It sounds like it's only a problem with
pip
/PyPI - any other package relevant package manager gets all the metadata first and then does a single solve for all dependencies, so you'd get a single version of package B.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow why it's only a pip/PyPI problem. The issue isn't the solution path; it's how many times you need to run the installer (and thus the solver). If I solve and install for arm64, then solve and install for x86-64, that's 2 independent solutions, and any inconsistency in availability of packages for arm64 and x86-64 will result in different solutions. AFAICT, this will still be an issue for conda, as the issue isn't the availability of metadata for a single platform; it's the availability of the solution arrived at by a completely independent solver pass.
You can only avoid this problem if you do a single resolver pass looking to satisfy both architectures at the same time, and only install once a single solution that works for both architectures is found (or, I guess, you have some ways to pass a specific solution found by pass 1 into subsequent passes in a way that doesn't include package hashes, as you'll be installing a different package with the same name and version, but different ABI/architecture).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, thank makes sense, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conda metadata is available offline, unlike pip where every resolver run is a series of API calls followed by downloading artifacts followed by extracting artifacts followed by yet more API calls. So you actually can guarantee multiple runs of the resolver will produce the same results.
If the metadata is guaranteed to be consistent across architectures at any given moment (e.g. packages of any given version will always exist for all architectures) then you can also get the same resolver result across architectures too. That's a social problem -- it depends on whether the ecosystem allows "partial releases".
pip freeze?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle, yes. But I don't think either
conda
ormamba
have this capability, so in practice it'd be pretty hard today.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chaquopy actually doesn't run multiple dependency resolution passes; it works like this:
--no-deps
.So if a package isn't available in the same version for all of the app's architectures, the build will fail. Since we build all our Android wheels ourselves, this hasn't yet been an issue.
The end result is one directory tree for pure-Python packages, and one directory tree per architecture for native packages, all of which are guaranteed to have the same versions. Those directory trees are then packaged into the APK in a way that allows them to be efficiently accessed at runtime.