Skip to main content

Building tools for CPython extensions

Project description

picobuild

Building tools for CPython extensions (Cython, setuptools) and standalone executables.

Install

pip install picobuild

Or with uv:

uv add picobuild

Quick start

setuptools + Cython

Re-export of setuptools’ Extension, find_packages, and setup, plus a Cython build dir that stays out of the way of the main build:

from Cython.Build import cythonize  # or use picobuild.cythonize
from picobuild import Extension, get_cython_build_dir, setup

extensions = cythonize(
    [Extension("mypkg.foo", ["src/mypkg/foo.pyx"])],
    build_dir=get_cython_build_dir(),
)
setup(ext_modules=extensions, ...)

Or use picobuild’s cythonize, which sets the build dir for you:

from picobuild import Extension, cythonize, setup

extensions = cythonize([Extension("mypkg.foo", ["src/mypkg/foo.pyx"])])
setup(ext_modules=extensions, ...)

Standalone executable from Python

Build a single-file executable from a Python script (Cython --embed + gcc):

from picobuild import build_cython_executable

build_cython_executable("hello.py", "bin/hello")

Or with parameters:

from picobuild import ExecutableParameters, build_cython_executable

params = ExecutableParameters("script.py", build_dir="bin", executable_name="myapp")
build_cython_executable(params._source_file, params._executable_file)

API

Name Description
Extension setuptools Extension (for Cython/C extensions).
find_packages setuptools find_packages.
setup setuptools setup.
get_cython_build_dir(build_dir="build") Path like build/cython.linux-x86_64-cpython-313 for Cython output.
cythonize(*args, **kwargs) Cython’s cythonize with build_dir set via get_cython_build_dir.
build_cython_executable(source_file, dest_file=None) Build a standalone executable from a .py file.
ExecutableParameters(source_file, build_dir, executable_name=None) Parameters for the executable build.

Docs

Full API and usage: Sphinx documentation (or build locally with make docs).

Development

make sync        # uv sync --extra dev
make install-uv  # sync + editable install
make test        # unittest
make check       # isort, black, flake8, mypy
make docs       # Sphinx HTML in docs/_build/html

License

BSD-3-Clause.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picobuild-0.0.5b0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

picobuild-0.0.5b0-py314-none-any.whl (6.3 kB view details)

Uploaded Python 3.14

picobuild-0.0.5b0-py313-none-any.whl (6.3 kB view details)

Uploaded Python 3.13

File details

Details for the file picobuild-0.0.5b0.tar.gz.

File metadata

  • Download URL: picobuild-0.0.5b0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for picobuild-0.0.5b0.tar.gz
Algorithm Hash digest
SHA256 a46074171db6cf89851741c5f90523afe57d7da50820924f53c686b4fcb1f360
MD5 13eeb1ef4fa0a2cdd7aff2d6bd934aef
BLAKE2b-256 7ebc72c74badd899a545d1fd7cba7382ca9e790f5c2611fa81e60ef36701a8ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b0.tar.gz:

Publisher: python-publish.yml on picops/picobuild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file picobuild-0.0.5b0-py314-none-any.whl.

File metadata

  • Download URL: picobuild-0.0.5b0-py314-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3.14
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for picobuild-0.0.5b0-py314-none-any.whl
Algorithm Hash digest
SHA256 cb0000e8f7b343f40da4fbb45c24148192885079da62a7eb1f8c1d8cd4b6205c
MD5 cc31c282f3170d7d3af10e9492d25fed
BLAKE2b-256 9b9b8c75edf2c3f7d9291d55cfc6aaac1a86a6323e6db8f9d2398298ee63c262

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b0-py314-none-any.whl:

Publisher: python-publish.yml on picops/picobuild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file picobuild-0.0.5b0-py313-none-any.whl.

File metadata

  • Download URL: picobuild-0.0.5b0-py313-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3.13
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for picobuild-0.0.5b0-py313-none-any.whl
Algorithm Hash digest
SHA256 e322eee684f184f16ead701d46e01d9cdd17bd6b0f669ac64af071d149ac0fea
MD5 0c36f577718707576afdf11b8347d3ff
BLAKE2b-256 e368d9524df74ed256a4b07e68537c7b24820724e0d860ec573e988de1511dfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b0-py313-none-any.whl:

Publisher: python-publish.yml on picops/picobuild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page