hello-c-extension
A minimal, working example of how to package a Python project that combines
pure-Python code with a C++ extension module — using modern
(PEP 517 / 621 / 639) pyproject.toml-based build configuration and the
uv +
task workflow.
The package cmod exposes:
| Name | Kind | Defined in |
|---|---|---|
cmod.CONSTANT |
package-level Python constant | src/cmod/__init__.py |
cmod.pymod |
pure-Python submodule | src/cmod/pymod.py |
cmod._cmod |
compiled C++ extension submodule | src/cmod/_cmodule.cc |
Install
python -m pip install hello-c-extension
Use
>>> from cmod import CONSTANT, pymod, _cmod
>>> CONSTANT
10
>>> pymod.hello()
Hello from Python!
>>> _cmod.foo()
5
Project layout
hello-c-extension/
├── pyproject.toml # PEP 621 metadata + ext-modules + tool config
├── uv.lock # reproducible dependency lock (committed)
├── Taskfile.yml # command shortcuts (task ...)
├── .pre-commit-config.yaml # hooks runnable via prek
├── CHANGELOG.md # Keep a Changelog
├── CLAUDE.md # guidance for AI-assisted development
├── .editorconfig
├── .github/
│ ├── dependabot.yml # weekly uv + github-actions updates
│ └── workflows/
│ ├── ci.yml # lint + matrix test + build
│ └── publish.yml # tag-triggered OIDC publish + Sigstore + release
├── src/cmod/
│ ├── __init__.py
│ ├── pymod.py # pure-Python submodule
│ ├── _cmodule.cc # C++ source for the compiled submodule
│ ├── _cmod.pyi # type stubs for the compiled submodule
│ └── py.typed # PEP 561 marker (shipped in wheel)
└── tests/
└── test_cext.py # pytest (unittest-style)
Development
Requires Python 3.10 - 3.14, uv,
task, and a C++-capable compiler.
task sync # create .venv and install project + dev deps
task test # pytest + coverage (>=75% enforced)
task lint # ruff check + ruff format --check + ty check
task format # auto-format and apply safe fixes
task build # uv build -> sdist + wheel into dist/
task hooks # run all pre-commit hooks via `uvx prek run --all-files`
task check # full verification: lint + tests + build
Pre-commit hooks
Run via prek (drop-in
pre-commit replacement; shares .pre-commit-config.yaml):
uvx prek install # install git hook
uvx prek run --all-files
Configured hooks: ruff, ruff-format, ty, markdownlint-cli2, and basic
hygiene (end-of-file fixer, trailing whitespace, check-ast, check-merge-conflict,
debug-statements, mixed-line-ending).
Build backend
This project uses setuptools as the PEP 517 build backend. Astral's
uv_build backend is pure-Python only and cannot compile C/C++ extensions,
so setuptools with declarative [[tool.setuptools.ext-modules]] is used
instead. uv still drives the developer workflow (env, deps, build, run).
Releasing
Releases are tag-driven. Pushing a v* tag triggers publish.yml:
- Build sdist + wheel with
uv build. - Export an SBOM (locked requirements) via
uv export. - Publish to PyPI using Trusted Publishing (OIDC) — no API token stored in the repo.
- Sign the distributions with Sigstore.
- Create a GitHub Release containing the signed distributions and SBOM.
All GitHub Actions are pinned to full commit SHAs. Jobs run with
least-privilege permissions: scopes. The pypi GitHub environment can be
configured with protection rules (required reviewers, wait timers) for an
extra manual gate on releases.
License
MIT - see LICENSE.
Metadata
Release files for hello-c-extension 0.6.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 | |
|---|---|---|---|---|
| hello_c_extension-0.6.0.tar.gz | 7.3 kB | With provenance | Details |
Built distributions (wheels)
Total release size: 198.5 kB
Release files / hello_c_extension-0.6.0.tar.gz
| Download URL | hello_c_extension-0.6.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
050bd9959cad440b7cc6359f7a6356c26d5ac378c8651c1aa337b1f52873b2ec
|
|
BLAKE2b-256 checksum How to use checksums |
a6af92d293ac3a031863ed60d42844df0a2bf03e992cd673cc11b633d10d64cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp314-cp314-win_amd64.whl
| Download URL | hello_c_extension-0.6.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 10.6 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
79620e79d975dbb89ebc371270978c5209f3ae9cafb159ed6c7d905ba6698257
|
|
BLAKE2b-256 checksum How to use checksums |
6ce2845a61130bd2a17a9afd7bb8ac415660e9781310ac323475df3c5a96757e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | hello_c_extension-0.6.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 21.1 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9d3328876b56e20fada6a7b250d226022e2da8e698aa0bd7f7c62b9022c4f51a
|
|
BLAKE2b-256 checksum How to use checksums |
1a3fd7664aa28e3275452f014d58eca30b85373c486f86038eae126674b39104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | hello_c_extension-0.6.0-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 8.5 kB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
2724d47525b7b4176927b51c8032b253a77a2e602d73f23162960c2a5f35f724
|
|
BLAKE2b-256 checksum How to use checksums |
7220c82e282adb468b7ead642db47f8c7f38684a9f6ec7a5d0c36b1e7f9a13a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp313-cp313-win_amd64.whl
| Download URL | hello_c_extension-0.6.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 10.4 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
062988151f39d518bbd1fb850cf290f8609c0369ea3f5ee08800077cc84139b1
|
|
BLAKE2b-256 checksum How to use checksums |
ecd7a1b04ec1930f63f50f634948265f7ba16daf53d9aef98c58821054a68d86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | hello_c_extension-0.6.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 21.0 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
319af797a3b1ae758cf635df7629f85a674326dcc93379eb378f141f28bf9fb1
|
|
BLAKE2b-256 checksum How to use checksums |
6de450dd158854e4d0ba79df4c8a3c34ac4cf8c6c0b592b60ff33757c93d6a32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | hello_c_extension-0.6.0-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 8.4 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
d4b920441ef7202df212bd1854083422263817f7854c57ff9bbcf70879f3a4ec
|
|
BLAKE2b-256 checksum How to use checksums |
1d5162b1173f33af78c455ad47d1c9ab3f9b4044cde5d62c3ff7b2d16c3e239c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp312-cp312-win_amd64.whl
| Download URL | hello_c_extension-0.6.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 10.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fed19934baad4d3ea9790d04d799e4789fa0c211a4dfe31e7647a49e008cfa6a
|
|
BLAKE2b-256 checksum How to use checksums |
db18e17b4169b927f96b4f2282afa6df1d214dd4fe09a60cdf748fad412b1b0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | hello_c_extension-0.6.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 18.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f95f9aa3c463583adcb0208fee2f0d389e4909c42353556fe019352cd066e9db
|
|
BLAKE2b-256 checksum How to use checksums |
016ff2198dce4516fe690285d1a8e3fbd0d28f583fe30ee24c3955883d2f4b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | hello_c_extension-0.6.0-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 8.4 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ff23887a5f8ba433275d6f08639dd0c25bf84c6d2756f1b7601c9b88fb5f9ec1
|
|
BLAKE2b-256 checksum How to use checksums |
d4dc483c41b47c3ec3ab264fcd30660f6fadaf72954a74a0177de480177bf23d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp311-cp311-win_amd64.whl
| Download URL | hello_c_extension-0.6.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 10.4 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
505fec573446e671f3077c1afec2cf8f08aced851565ca200de3ee1acfe1245b
|
|
BLAKE2b-256 checksum How to use checksums |
58bbee9aede9aee4d735492a7a306e5e42c3539f4c1c695fab38f16e33f9febd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | hello_c_extension-0.6.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 18.1 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
042ec61a74faa9fb2981f3caedc6b73b812321cffe827f10a7db83c574c12d06
|
|
BLAKE2b-256 checksum How to use checksums |
71b021663588532bc6aa6f581d5f4a0910a2fbd31c48b0e05c5f00fea53045f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | hello_c_extension-0.6.0-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 8.4 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
f661e585e8c02779184edfd584cde654d5edc8372d8cb824df7140447fe79042
|
|
BLAKE2b-256 checksum How to use checksums |
62980c8f08bb4bab27aafc9235e9319d333b580f1d10f86af3335d770ff5c7f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp310-cp310-win_amd64.whl
| Download URL | hello_c_extension-0.6.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 10.4 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e4c603234f04cf61cca110f355300912d32981c45e2138be346b8299bd397179
|
|
BLAKE2b-256 checksum How to use checksums |
d578b44e3a6789ab876f8016788a02fff5f2337d62ae72da1da7a034f7f81e74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | hello_c_extension-0.6.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 18.2 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
59bfbcbbfaf87f0a3e05fbedfe587085f6b473c8b1220b575b86831edfb69d32
|
|
BLAKE2b-256 checksum How to use checksums |
ecf6c4db18c34d1f58981f1bf721f18c4d6660f7dadafddeee32525a5b01926f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logRelease files / hello_c_extension-0.6.0-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | hello_c_extension-0.6.0-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 8.4 kB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ede78158854a75848eab725bcb7f2ab5ab4ec5a253a9d8f6e31678cb17e5e9d5
|
|
BLAKE2b-256 checksum How to use checksums |
00a464ac2201c7180896c4799106f5989849221756d2b5e386cca4151dc4ef5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Apr 19, 2026.
Transparency logSecurity for hello-c-extension 0.6.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 16 files in this release have been uploaded with provenance metadata.
Attestation for hello_c_extension-0.6.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 Apr 19, 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.