Skip to main content

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.

logo

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 or macOS.

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

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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for small-python 0.1.0
File Size Uploaded Provenance Actions
small_python-0.1.0.tar.gz 2.1 MB With provenance Details for small_python-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for small-python 0.1.0
File Actions
small_python-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for small_python-0.1.0-py3-none-win_amd64.whl
small_python-0.1.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for small_python-0.1.0-py3-none-musllinux_1_2_x86_64.whl
small_python-0.1.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for small_python-0.1.0-py3-none-musllinux_1_2_aarch64.whl
small_python-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for small_python-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
small_python-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details for small_python-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
small_python-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for small_python-0.1.0-py3-none-macosx_11_0_arm64.whl
small_python-0.1.0-py3-none-macosx_10_13_x86_64.whl Python 3 none macOS 10.13+ x86-64 Details for small_python-0.1.0-py3-none-macosx_10_13_x86_64.whl

Total release size: 11.7 MB

Release files / small_python-0.1.0.tar.gz

Download URL small_python-0.1.0.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a120cdbd0299c3ec5bd937fcec68aced44886912e74140442d500cededdeac3e
BLAKE2b-256 checksum
How to use checksums
e36365865053c95a899db37f66541cf9f259a9e2aba3004373322206873ab520
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-win_amd64.whl

Download URL small_python-0.1.0-py3-none-win_amd64.whl
Size 782.0 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
cd6361d4983b11172a568622cc83ec69a7164e714756314e187397880ce8cdaa
BLAKE2b-256 checksum
How to use checksums
982952dd37ae7f72c6a9f5dcdc89e238e56ca49689144082965c9aaf5c1ea010
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-musllinux_1_2_x86_64.whl

Download URL small_python-0.1.0-py3-none-musllinux_1_2_x86_64.whl
Size 1.8 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b10d9ca24f2b63e0ae1626c8379e53426f6959d0c63870414c2300cdd240ce16
BLAKE2b-256 checksum
How to use checksums
9a453adb0a0204b5d5bbb351157c9ac17ec5c23ef8f2b656764a7176825f8756
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-musllinux_1_2_aarch64.whl

Download URL small_python-0.1.0-py3-none-musllinux_1_2_aarch64.whl
Size 1.8 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
cb9d8e7ff66d175fd077676704422969d5f93a848f9ef4e323e2c1a302c3fa56
BLAKE2b-256 checksum
How to use checksums
17feb192c84cb41b4d14b7465d4d29f0a209584c847462b839d50dd361279a5c
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL small_python-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
17b56a638931e5a3588d0c892ad1369ffbcbbb689e0d327b6b477ccd1678999f
BLAKE2b-256 checksum
How to use checksums
5e4286119e46828f5642a176b6d0649a1f7d94ffbbaa3c6225f5c8080e0310f5
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL small_python-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5c8b4a9223e1082571bfd8eb655eda3a2a408e13a1742fe8106d6a0cac61b8fd
BLAKE2b-256 checksum
How to use checksums
878c5452b02c2c467e5246bf472b7f91f4fb00c7ecad0dccbf81cce21881be98
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-macosx_11_0_arm64.whl

Download URL small_python-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 778.1 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
121fe125040169bbb848f6d8ad8e44aaa6d8d55a7a4db08909a5fa2aa009f1b0
BLAKE2b-256 checksum
How to use checksums
5dd843ce65f4c273096696568aa72da004c131706af9aed6201117ac3ab3752a
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 28, 2026.

Transparency log

Release files / small_python-0.1.0-py3-none-macosx_10_13_x86_64.whl

Download URL small_python-0.1.0-py3-none-macosx_10_13_x86_64.whl
Size 806.9 kB
Tags Python 3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
bcd6e008cf2c447adda33ebf39ffbe2c82ce23143682a8bf23b51fcf424faa33
BLAKE2b-256 checksum
How to use checksums
9636eb4724f19ed1332d8e179ba5da9600c545b4138230e82e8219d6563fcd68
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 28, 2026.

Transparency log

Security for small-python 0.1.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.

Select from 8 files

Attestation for small_python-0.1.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 28, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page