Small Python
Small Python is a small and embeddable Python runtime. This package,
small-python, runs it from CPython: create isolated interpreters, run code in
them, and give that code exactly the functions, modules, and files you choose.
Features
- Small, just a few C files, no external dependencies.
- No Python Libs. Attach your own modules.
- Almost complete Python 3.15 support.
- Run code generated by AI against only the functions you expose.
- Each runtime runs in its own worker process: an engine crash raises an exception instead of taking down your program.
- Limits on steps, memory, time, and message size.
- Can compile Python code to executables with no external dependency.
- GC uses reference counting with cycle removal.
Install
pip install small-python
Requires CPython 3.10 or newer on Linux, macOS, or Windows (x86_64).
Example
import small_python
with small_python.Runtime(step_limit=1_000_000, memory_limit=64 << 20, timeout=5) as rt:
@rt.function
def fetch(key, *, default=None):
return {"answer": 42}.get(key, default)
rt.register_module("host", {"fetch": fetch}, source="def twice(n): return n * 2")
rt.exec("from host import twice")
print(rt.eval("twice(fetch('answer'))")) # 84
Documentation
- Getting started
- Embedding guide: host functions, modules, output, files, errors
- Limits and safety
- API reference
- Development: building, testing, and releasing
Build
Requires a C11 compiler. Manage the project with uv:
uv sync --locked
uv run python -c "import small_python"
uv build
See Development for tests and the release process.
Metadata
Release files for small-python 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| small_python-0.4.0.tar.gz | 2.0 MB | With provenance | Details for small_python-0.4.0.tar.gz |
Built distributions (wheels)
Total release size: 11.8 MB
Release files / small_python-0.4.0.tar.gz
| Download URL | small_python-0.4.0.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d3a8dd0d700d026c7180dd7574263037b68da031e8bcb13c59b1212977afe54
|
|
BLAKE2b-256 checksum How to use checksums |
64d33000f64384fcab59ea3c7e6eb96ccd2c4d7829565ad9c449d5c48712b6a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-win_amd64.whl
| Download URL | small_python-0.4.0-py3-none-win_amd64.whl |
|---|---|
| Size | 731.6 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e2bce227452b36f7a70649d0683dcb27cf23afcccbc41768fa5ad365e8fbc35c
|
|
BLAKE2b-256 checksum How to use checksums |
812b2bb7f0e6cdbfdc4128de65d0d8270c997d183c5bdab0f7fb5efa8e6670b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | small_python-0.4.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
2a6e54e3e719cc5332e46718e6232188d4cdf4f618e705e872d666c47388ea4d
|
|
BLAKE2b-256 checksum How to use checksums |
a0ea463eba32e0d37223972ffb956abbd71b1768384e596b951c4ac2cbc1941a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-musllinux_1_2_aarch64.whl
| Download URL | small_python-0.4.0-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
25a36b2492a73db9969e8ae2648366375e2bfe6b4629886e8c8155db4c307a1c
|
|
BLAKE2b-256 checksum How to use checksums |
cab13b0d7cb3cd81e01c0f1ee448a17411ac0d23ddf4a390162e1b81f6bfa007
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | small_python-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
3f62bba7d7520aae289d0075d8265ef3735e2c0186ca45eb01c214eb6b1c5f47
|
|
BLAKE2b-256 checksum How to use checksums |
4eb18e8f455de91c076961544dd02248b768fe3a90af01d7273a05c05b3f1d49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | small_python-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1a8725395906c89c3595d3734df0d4002458a0b79358ce48d13f20288d47e445
|
|
BLAKE2b-256 checksum How to use checksums |
3414c1062a10ce42871162bb3bd78142c8c50de18f438d368a0e6f210c094d13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-macosx_11_0_arm64.whl
| Download URL | small_python-0.4.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 722.4 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2160c6543845777fe70a0a3625a90ae309dffdacd380dcd2456700dd7897dd9d
|
|
BLAKE2b-256 checksum How to use checksums |
682cce22ff5abbf5c9b5d050de7de13ea26398e7640fdffe08f2cbd989de53d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / small_python-0.4.0-py3-none-macosx_10_13_x86_64.whl
| Download URL | small_python-0.4.0-py3-none-macosx_10_13_x86_64.whl |
|---|---|
| Size | 769.7 kB |
| Tags | Python 3 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
d8f702829c63939c33f5d8e03aa8616b9efd79adee3b51bc182bb5ab6b71ed05
|
|
BLAKE2b-256 checksum How to use checksums |
3769f19b15057992f92e4a7adab00396ea32bf4e790b7c33db421088ebe89362
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logSecurity for small-python 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for small_python-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.