Skip to content

gh-162115: Add tooling to process site packages in an Apple Xcode project. - #162194

Open
freakboy3742 wants to merge 1 commit into
python:mainfrom
freakboy3742:ios-site-packages
Open

freakboy3742 wants to merge 1 commit into
python:mainfrom
freakboy3742:ios-site-packages

Conversation

@freakboy3742

@freakboy3742 freakboy3742 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Corrects the initial configuration of the Python environment in the iOS testbed:

  • Uses an explicit PyConfig.module_search_path rather than dynamically appending to site.path in the running interpreter
  • Pre-processes the third-party dependencies into the standard library site-packages folder, rather than manually appending the app_packages folder onto the site path in the running interpreter

This ensures that all the user-supplied code is on the Python path at the time the interpreter configuration completes. This matters because the start-time configuration is what persists into sub-interpreters; without these changes, code in app and app_packages can't be found in a sub-interpreter without reproducing the path modifications.

It's also a lot simpler, and a lot closer to the "standard desktop" experience in terms of interpreter configuration.

To facilitate the site-packages handling, a new install_site_packages method has been added to the framework utility script. This new script means we can now easily document how to handle a site-packages folder, rather than needing somewhat nebulous descriptions of how to configure a third-party packages folder.

This is all backwards compatible - the historical behaviour was to treat app_packages as a folder that needs post-processing; any code that uses the old setup will continue to work. Projects that opt into using the install_site_packages script will have better site-related behaviour.

This PR also takes the opportunity to factor out the shell script parts of the Xcode project into a standalone shell script file. Defining the script inline works, but it can be difficult to debug due to the need for double escaping.

Marked for backport to 3.14 and 3.15 because the testbed project is used by cibuildwheel (and others), and subinterpreter tests fail without these changes.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35973990 | 📁 Comparing dc73edc against main (9427640)

  🔍 Preview build  

2 files changed
± using/ios.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant