Skip to content

Releases: Ambriel/EmbeddedPython

EmbeddedPython 1.0.0

14 Jun 18:54

Choose a tag to compare

Embed a full CPython 3.13 interpreter inside a macOS or iOS app and run Python from Swift.

EmbeddedPython wraps BeeWare's Python-Apple-support builds in a Swift package with a small, friendly API.

Features

  • 🐍 CPython 3.13 embedded — no system Python required
  • 🖥️ macOS (arm64 / x86_64) and 📱 iOS (device + simulator) universal Python.xcframework
  • ⚡ Tiny Swift API: PythonEngine.start() / run(_:) / stop(), with captured stdout/stderr
  • 🧩 C PythonBridge shim over the CPython C API, PyConfig-based isolated init
  • 🍎 App Store-friendly: iOS stdlib staging + binary-module signing via BeeWare's install_python build phase

Requirements

  • Swift 5.9+ / Xcode 15+
  • macOS 11+ or iOS 13+

Install

.package(url: "https://github.com/Ambriel/EmbeddedPython.git", from: "1.0.0")

The Python runtime is a large binary and is not committed — run ./setup.sh once to download and assemble Frameworks/Python.xcframework.

Usage

import EmbeddedPython

try PythonEngine.start()
let output = try PythonEngine.run(#"print("Hello from Python!"); print(sum(range(10)))"#)
print(output)   // "Hello from Python!\n45\n"
PythonEngine.stop()

iOS needs one build phase in your app (staging + signing the stdlib). See the README for the full steps and the App Store notes.