Skip to content

Py-Swift/PySwiftKit

Repository files navigation

PySwiftKit — Python ↔ Swift Interoperation Framework

PySwiftKit is an open-source library designed to bridge Python and Swift, enabling developers to interoperate across the two languages—calling Swift from Python, embedding Python logic in Swift, or exchanging data seamlessly between them.

Key Features & Capabilities • Bidirectional language binding  You can call Swift code from Python, and conversely integrate Python modules within Swift workflows. • Type conversions & marshalling  Automatic or semi-automatic conversion of common data types (strings, numerics, collections, etc.) between Python and Swift, minimizing boilerplate. • Modular & extensible architecture  Components are organized under a Sources directory (Swift and Python parts) and a Tests folder, making it easier to extend, adapt, or plug in extra bindings. • Package integration & build tooling  The repo contains Package.swift, enabling Swift Package Manager integration. It also includes support artifacts (e.g. repack.py) to reorganize or bundle the interop layers. • Open-source & community-ready  Licensed under GPL-3.0. The project has over 100 commits and multiple release versions (latest tag: 313.0.0 as of September 2025)   Most of the code base is Python (~94%) with a small Swift component (~5.5%)   Although relatively new/popular (2 stars, 0 forks currently) , it is positioned to grow in utility for cross-language toolchains.

Use Cases & Motivations • Hybrid applications / tooling  When parts of a system are better expressed in Swift (e.g. performance-critical modules, Apple ecosystem integration) and others in Python (e.g. data science, scripting, prototyping), this library helps glue them together. • Embedding scripting  Allowing Swift applications to embed Python logic (plugins, user scripts, automation) without discrete process boundaries. • Cross-platform shared logic  Enable shared algorithmic code in Python, with Swift wrappers for mobile / desktop front ends. • Rapid prototyping + optimization path  Start with Python prototypes, and gradually shift performance-critical parts into Swift while preserving interoperability.

Architecture & Structure (as seen in the repo) • Sources/  Houses the core implementation of both the Python and Swift sides, managing the interop bridges, marshalling, wrappers, and glue code.  • Tests/  Contains unit tests and integration tests to ensure correct behavior of cross-language calls. • Package.swift  Swift Package manifest, allowing Swift projects to include PySwiftKit as a dependency.  • repack.py  A utility for repackaging or restructuring the interop layers (e.g. adjusting Python modules or embedding binaries).  • LICENSE (GPL-3.0)  Open source license, granting freedom to use, modify, and distribute, with copyleft conditions. 

Strengths & Challenges

Strengths: • Bridges two major language ecosystems in one framework. • Reduces friction for projects needing both Python and Swift. • Structured project with package support and tests.

Challenges / Considerations: • Performance overhead of bridging (serialization, context switching). • Complexities of memory / object lifetime management across runtimes. • Limitations in the kinds of data types and patterns that can be reliably shared. • Maturity and community adoption are still developing (few stars/forks).

If you like, I can generate a polished “README-style” description you could drop into the repo, or even suggest enhancements. Would you prefer I write that?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •