Skip to content

feat: add CPython 3.15 support for iOS#2857

Merged
henryiii merged 10 commits into
pypa:mainfrom
henryiii:henryiii/feat/cp315-ios-android
May 23, 2026
Merged

feat: add CPython 3.15 support for iOS#2857
henryiii merged 10 commits into
pypa:mainfrom
henryiii:henryiii/feat/cp315-ios-android

Conversation

@henryiii
Copy link
Copy Markdown
Contributor

@henryiii henryiii commented May 15, 2026

Missing support files; either should be vendored or added to xbuild.

Assisted-by: OpenCode:Kimi-K2.6
Assisted-by: Copilot:claude-sonnet-4.6

@henryiii henryiii force-pushed the henryiii/feat/cp315-ios-android branch 2 times, most recently from 4a08995 to f2000da Compare May 15, 2026 09:00
Copy link
Copy Markdown
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

Thanks @henryiii! LGTM on the other code, but some small corrections needed on the README.

Comment thread README.md Outdated
@henryiii henryiii requested a review from freakboy3742 as a code owner May 15, 2026 20:57
@freakboy3742
Copy link
Copy Markdown
Contributor

@henryiii Thanks for picking this up. We've already spoken about the target_python assertion; looking at the current CI failures, I forgot about the make_cross_venv script as well.

That script isn't part of the offical package either (and shouldn't be); my intention was to break that out into xbuild. xbuild needs a little bit of work before that's possible, plus the changes in cibuildwheel to hook it in.

Alternatively, (and/or as a stop-gap measure) we could include the make_cross_venv script (et al) as a resource in cibuildwheel.

@henryiii henryiii force-pushed the henryiii/feat/cp315-ios-android branch from 7d29259 to d9fe4ab Compare May 16, 2026 05:56
@henryiii henryiii changed the title feat: add CPython 3.15 support for iOS and Android feat: add CPython 3.15 support for iOS May 16, 2026
Assisted-by: OpenCode:Kimi-K2.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/feat/cp315-ios-android branch from d9fe4ab to 2f8be4d Compare May 17, 2026 07:23
Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/feat/cp315-ios-android branch from 8fecae8 to 16fb156 Compare May 17, 2026 07:36
Copy link
Copy Markdown
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

This all makes sense to me, and works great in my manual testing. A couple of notes inline. Not sure what's going on with the macOS test failures in CI, though.

I've taken an initial look at doing this with xbuild; it doesn't look too difficult, but there's a couple of fixes needed to xbuild to finalise that. I'm unlikely to get a chance to look at this until post-PyCon; what is in this PR seems like a very workable stop-gap.

Comment thread cibuildwheel/platforms/ios.py Outdated
Comment thread cibuildwheel/platforms/ios.py Outdated
Comment thread cibuildwheel/platforms/ios.py Outdated
henryiii added 4 commits May 17, 2026 09:52
When copying multiarch-specific support files (e.g. _cross_arm64_iphoneos.py),
the code was trying to copy all items in the directory including __pycache__
directories. The shutil.copy() function only works with files, not directories,
which caused an IsADirectoryError.

This fix adds a check to only copy files, skipping any directories like
__pycache__ that may have been created by Python imports.

Assisted-by: Copilot:claude-haiku-4.5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/feat/cp315-ios-android branch from 7324931 to 0984901 Compare May 17, 2026 16:53
@henryiii henryiii requested a review from freakboy3742 May 17, 2026 18:26
Add assertion to check if target Python directory exists.
@henryiii henryiii requested a review from Copilot May 18, 2026 15:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds CPython 3.15 iOS support by wiring official python.org iOS XCFramework downloads into cibuildwheel and vendoring support files needed to create iOS cross-compilation virtual environments.

Changes:

  • Adds CPython 3.15 iOS configurations and updates expected wheel/readme support metadata.
  • Adds cibuildwheel-managed iOS cross-venv support scripts and resource path constants.
  • Updates iOS setup logic to inject missing platform config files for python.org 3.15+ XCFrameworks.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/utils.py Extends expected iOS wheels to include CPython 3.15 when prerelease builds are enabled.
README.md Marks CPython 3.15 as supported for iOS.
pyproject.toml Adjusts wheel-content checks for new iOS support resources.
cibuildwheel/util/resources.py Adds a resource path for vendored iOS support files.
cibuildwheel/resources/ios-support/x86_64-iphonesimulator/sitecustomize.py Adds x86_64 simulator startup customization.
cibuildwheel/resources/ios-support/x86_64-iphonesimulator/_cross_x86_64_iphonesimulator.py Adds x86_64 simulator platform/sysconfig patching.
cibuildwheel/resources/ios-support/make_cross_venv.py Adds cross-venv conversion helper for iOS support files.
cibuildwheel/resources/ios-support/arm64-iphonesimulator/sitecustomize.py Adds arm64 simulator startup customization.
cibuildwheel/resources/ios-support/arm64-iphonesimulator/_cross_arm64_iphonesimulator.py Adds arm64 simulator platform/sysconfig patching.
cibuildwheel/resources/ios-support/arm64-iphoneos/sitecustomize.py Adds arm64 device startup customization.
cibuildwheel/resources/ios-support/arm64-iphoneos/_cross_arm64_iphoneos.py Adds arm64 device platform/sysconfig patching.
cibuildwheel/resources/ios-support/_cross_venv.py Adds build-environment import hook to preserve cross-venv files.
cibuildwheel/resources/build-platforms.toml Adds CPython 3.15 iOS target configurations.
cibuildwheel/platforms/ios.py Injects platform config data for 3.15+ and uses vendored cross-venv resources.
bin/update_pythons.py Updates iOS version refresh logic for python.org 3.15+ releases.
.pre-commit-config.yaml Excludes vendored iOS support files from pre-commit checks except the helper script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cibuildwheel/resources/ios-support/arm64-iphoneos/sitecustomize.py
@joerick
Copy link
Copy Markdown
Contributor

joerick commented May 18, 2026

This looks okay to me! I guess we expect these support files to be included in the next CPython XCframework release? So we'll only be vendoring this stuff for a little while?

@freakboy3742
Copy link
Copy Markdown
Contributor

This looks okay to me! I guess we expect these support files to be included in the next CPython XCframework release? So we'll only be vendoring this stuff for a little while?

I don't expect they'll ever be in the XCframework - but they will (and are already) in xbuild. That set of tools should be able to remove the duplication of "cross platform venv" stuff in Android, iOS and Emscripten - but it needs a little more work before it's ready for serious consideration.

However, once it is ready for consideration, we'll be able to remove the vendoring in cibuildwheel.

Copy link
Copy Markdown
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

This doesn't seem quite right yet - the _inject_support_files call shouldn't be needed at all.

I think the problem is that the platform_config_path that is being passed in for the 3.15 case doesn't actually exist - and the path to the stdlib (which is where sysconfigdata comes from) isn't being provided.

Remove the _inject_support_files workaround for python.org 3.15+
distributions. Instead of copying sysconfig files from the stdlib into
a synthetic platform-config/ directory, pass the stdlib directory
directly to make_cross_venv.py.

make_cross_venv.py is updated to derive the multiarch tag from the
_sysconfigdata_ filename rather than assuming it comes from the
directory name.

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Assisted-by: OpenCode:Kimi-K2.6
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii
Copy link
Copy Markdown
Contributor Author

@freakboy3742 have you had a chance to look at the latest changes? (also waiting on PyPy)

@freakboy3742
Copy link
Copy Markdown
Contributor

@freakboy3742 have you had a chance to look at the latest changes? (also waiting on PyPy)

My apologies - I wasn't as productive on my flight home as I was hoping. I'm taking a look now.

Copy link
Copy Markdown
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

I've pushed a couple of minor tweaks - mostly clarifying the naming of the paths being referenced in the make_cross_venv script. It doesn't change the actual work being done, but the variable/argument names correspond a little closer to the actual purpose of the script. It also tweaks the message printed describing the conversion taking place - previously, it was printing the location of the sysconfig data, not the target platform type.

Otherwise, this looks good to me. I'll be able to revisit this once I've got xbuild to a more stable state. That will remove the need to vendor these scripts; but in the meantime, this should work. Thanks @henryiii for pushing this forward.

@henryiii henryiii merged commit 45cfffd into pypa:main May 23, 2026
46 checks passed
@henryiii henryiii deleted the henryiii/feat/cp315-ios-android branch May 23, 2026 14:47
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.

5 participants