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.5b1.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.5b1-py314-none-any.whl (6.3 kB view details)

Uploaded Python 3.14

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

Uploaded Python 3.13

File details

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

File metadata

  • Download URL: picobuild-0.0.5b1.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.5b1.tar.gz
Algorithm Hash digest
SHA256 a02bf5c3541d0ca09091d10026fc30a7484d0f18c708e16a9ee6ad82f7d38f30
MD5 6cbc193c54edc833644ec20c32d348d5
BLAKE2b-256 7af3fed377ce5057e4ce35119cfe126ca8a83999944418951fb8fc1f96a20a7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b1.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.5b1-py314-none-any.whl.

File metadata

  • Download URL: picobuild-0.0.5b1-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.5b1-py314-none-any.whl
Algorithm Hash digest
SHA256 e44159236041899e03fc54854b32001e002be1c59a4d0c9edc1461213ac9dc3e
MD5 837c9cbbeb76c18aa5e38d707e4b17b7
BLAKE2b-256 23d6eb6c0cd2f26e6ec4eb7b96926470d15d838f6dbf8d0ee3c8780a245581a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b1-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.5b1-py313-none-any.whl.

File metadata

  • Download URL: picobuild-0.0.5b1-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.5b1-py313-none-any.whl
Algorithm Hash digest
SHA256 92dd74e257264acbea95154f5a68b9aa87e08a25fff223b9bb22a50298da7cf7
MD5 80d7c0ebe7a42ac761d06cd4aba03898
BLAKE2b-256 1670b762ba638d8aa96a25da9e8ba00c97ac86849c36e4c504efc8ba2abdb70c

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.0.5b1-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