https://github.com/danasilver/pythonsampleapp
Python + iOS. Why not? :wink:
https://github.com/danasilver/pythonsampleapp
Last synced: about 1 month ago
JSON representation
Python + iOS. Why not? :wink:
- Host: GitHub
- URL: https://github.com/danasilver/pythonsampleapp
- Owner: danasilver
- Created: 2017-09-26T06:42:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-27T05:26:54.000Z (over 8 years ago)
- Last Synced: 2025-02-24T02:30:48.982Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Python + iOS
Run Python in your Swift app!
### Install and Run
Clone the repo and run `./bootstrap`. You should be ready to build and run the
project in Xcode and see some results from Python in the console.
### But why?
Because you can!
It's fun to pick apart software and make two unexpected pieces work with each other.
Some serious reasons you might want to do this:
* A legacy Python codebase with your app's business logic
* A library that only exists in Python
* A Python developer new to iOS (see [PyObjC](https://pythonhosted.org/pyobjc/index.html))
### Okay, but how?
1. Patch Python for iOS
2. Compile for all your architectures and make Python.framework, OpenSSL.framework, etc.
3. Follow the Python/C API Reference Manual to put setup Python in your Swift app (mostly working in Obj-C/C)
4. Write Python!
### Helpful Scripts
**bootstrap**: Install Python.framework, its dependencies, and your Python packages.
Python.framework is too large to check into VCS.
**lock-packages**: Write out a requirements.txt with the exact package versions for your project's installed packages.
**Install a new Python dependency**: `pip install --target python/packages `