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.1.0.tar.gz (6.8 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.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (6.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

picobuild-0.1.0-cp313t-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (6.3 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

picobuild-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (6.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file picobuild-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for picobuild-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae8671485f0b0128a0b8bcbb6ba3b13763cc10c31ab3e537429e0556a04fe1bd
MD5 22ea9fe8b6c829ab76760bfe623ff5df
BLAKE2b-256 3c92a4e922873cae6ae9798b02af3edcf3829072ed12fa1eb9a2b193f57c22c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.1.0.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.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for picobuild-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d96a5e96308d69bdb93ffe57aaac4d7c9dfce9a68dc856648dcb76fbce57a0b
MD5 d8354deedf47f0d7757284b1eea9df8d
BLAKE2b-256 10783eda4e4b7c6b170d7c8af85cbc95c9d6ff393849c34855cdfe6e8a88179e

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.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.1.0-cp313t-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for picobuild-0.1.0-cp313t-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 51c203a0b0c112161221b1f5a62f5a543ef912b11cf77dd819e40b5207e9a1e3
MD5 6f296e2729380fdb1cf13835339c3767
BLAKE2b-256 cf1976e5e3e61ad1a84af228ec7410d71a4260434f4805c882293461a4a8222b

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.1.0-cp313t-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.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.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for picobuild-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ebe2bffc71b8d99636b96b7eead9d7cdee78e6157b97a0de20ae7c8eb189c1cf
MD5 78cb7523876c1c0fb9566fb3931444fb
BLAKE2b-256 94de008779a36e2bc5877f4c0f6959ff9029add674d15189c77afe8bf9d54b6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for picobuild-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.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