Why not Python?

Why not Python?

The iOS stack is growing as developers find ways to use their favorite languages to power their apps. Why not Python dives into one of the options: Python. We’ll explore about how to get Python running in your app, call Python code from Obj-C or Swift, and how to structure your project, as well as the practical tradeoffs of running Python in a real-world app.

Dana Silver

October 03, 2017

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

9 slides
  1. The iOS Stack • Swift, Objective-C • C, C++ •

    JavaScript • C# • Go • . . .
  2. Python and iOS • History of support on macOS •

    Python is designed to be embedded • Existing packages bridge the gap • Practical use-cases • A chance to explore the underside of Python and solve a few good puzzles
  3. So you want to embed Python CPython Python.patch - unsupported_sys_call

    + #if TARGET_OS_IPHONE $ clang -arch armv7s CC & LD Flags
  4. Call me Python! #import <Python/Python.h> /* Start the interpreter */

    const char *code = "print('I am Python!')"; PyRun_SimpleString(code);
  5. Patterns and “Best Practices” • Keep all your Python together

    • Use pip and requirements.txt ./python ├── app │ └── __init__.py └── packages └── requirements.txt

Other Decks in Technology