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

Modify pip handling to use platform tag for iOS. #2101

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

freakboy3742
Copy link
Member

With the release of pip 24.3, we're now in a position to use explicit --platform tags when installing wheels for iOS.

This removes the need for the platform-site shim to "fake" pip installation; we can instead rely on default pip/Python platform handling.

As part of this change, the use of wheels is now required, through use of the --only-binary=:all:. This is required as part of using --platform, as pip can't install from source when installing onto a foreign target platform, even if the wheel being installed is pure Python. There is a small minority of packages that are only packaged as source tarballs; but the broader Python ecosystem is firmly promoting the use of wheels, so this seems like a good opportunity to force the issue.

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

@freakboy3742 freakboy3742 requested a review from mhsmith January 6, 2025 06:08
@mhsmith mhsmith merged commit c83c495 into beeware:main Jan 6, 2025
49 checks passed
@freakboy3742 freakboy3742 deleted the new-pip branch January 6, 2025 23:34
@mhsmith
Copy link
Member

mhsmith commented Jan 11, 2025

What's the situation with environment markers, like this line in the toga meta-package's pyproject.toml file?

    "toga-iOS == {version}; sys_platform=='ios'",

As I understand it, these aren't affected by the --platform option, and in fact are an open question in pip itself:

I patched Chaquopy's copy of pip to deal with this, though at that time sys.platform and platform.system returned "linux" on Android:

@freakboy3742
Copy link
Member Author

freakboy3742 commented Jan 12, 2025

That's a good point - looks like we can't abandon the platform site package after all. --platform will guarantee a matching binary wheel - but we still need a cross-platform-enabled pip to do the install. We had a couple of failures in the dependabot updates because the testbed uses platform markers to prevent the installation of numpy etc.

Looking at the bigger picture - I wonder if it would be possible to use _PYTHON_HOST_PLATFORM and _PYTHON_SYSCONFIGDATA_PATH as a configuration point, store the host overrides in the platform-specific sysconfig, and have them incorporated into pip (or anything else that needs it) as required...

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.

2 participants