-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Update Usage.md #234
Comments
Support for PythonKit is provided on a "best effort" basis; we're happy to incorporate changes to documentation, but we're not actively monitoring for changes. FWIW, the Briefcase iOS template gives the paths that are used by the new project layout:
I think that is all the detail you need to adapt the current usage guide; if you want to convert that into a PR updating |
I'm following a guide on how to embed a Python interpreter into a Swift app for macOS, and it tells to copy the I downloaded a few releases from this repo, for example https://github.com/beeware/Python-Apple-support/releases/tag/3.11-b5, but there isn't such a directory. Do you maybe have a suggestion how to proceed? Update: I have added the
@olilarkin Can you maybe elaborate on which steps exactly you took to make it work? |
3.11-b4 (and other version releases at the same time) changed the structure of the support package to use the binary format and loading mechanism that was approved as part of PEP 730. This required some changes to the layout of the package. Any errors associated with "No such module Python", or any difficulties loading the standard library can almost certainly be traced back to the initialisation of the module (and in particular paths) being correct. As noted above, the usage guide for PythonKit is provided on a best-effort basis; if you want to see what is required to make the support package work, the project generated by Briefcase is the canonical reference implementation. |
Thanks for the reply!
Maybe I'm misunderstanding something here, because from what I've read, I assumed that the initialization of the module happens after the
Yes I understand that. I appreciate this very much.
Thanks for the pointer, I have tried setting up a briefcase project using the macOS Xcode template as described in the README file ( |
I know almost nothing about PythonKit, so I can't say for certain - but as far as I know there's nothing needed in code before you invoke However, your Xcode project needs to include Python correctly, and ensure that it is copied into the project as a target. A failure to load a module likely indicates that the framework isn't being copied into the project correctly, or there's some other (swift-specific) module configuration that needs to be performed (such as configuring a loading/linking path). |
It works basically out of the box using the old release layout (e.g., 3.11-b3) following the steps described here. Following basically the same steps for releases with the new layout (e.g., 3.11-b4) however does not work and yields the |
I've made a template repo for a macOS based on the info here https://github.com/olilarkin/SwiftPythonTemplate I hope that helps |
What is the problem or limitation you are having?
It seems that maybe a recent switch to a different package layout with the xcframework has made the Usage.md instructions obsolete? I was able to use PythonKit without the module map but it is unclear to me now how i install dependencies since the xcframework contains the site packages folder.
Describe the solution you'd like
update about how it's meant to work
Describe alternatives you've considered
ditto
Additional context
thanks for this cool project!
The text was updated successfully, but these errors were encountered: