hatch-cython
Cython build hooks for hatch
What it is and what it does
hatch-cython is a Hatch build backend plugin that automates Cython compilation during wheel builds. It acts as a bridge between Hatch's modern build system and Cython's C extension compilation, handling the configuration and invocation of the Cython compiler as part of the standard Python package build process.
The plugin supports integration with scientific libraries (NumPy, PyArrow, Pythran) by resolving their include paths and libraries at build time. It exposes Cython compiler directives, custom compilation arguments, and macro definitions through pyproject.toml or hatch.toml configuration, eliminating the need for custom setup.py scripts. The package requires Cython, hatchling, setuptools, and typing-extensions as runtime dependencies.
Use it for:
- Building Python packages with Cython-compiled modules using Hatch as the build backend.
- Integrating NumPy or PyArrow headers and libraries into Cython extensions without manual path configuration.
- Configuring Cython compiler directives (boundscheck, nonecheck, language_level) declaratively in pyproject.toml.
- Compiling performance-critical code sections to C while maintaining a pure-Python package structure.
- Creating wheels with C extensions for multiple Python versions (3.8–3.13) via a single build configuration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Hatch build hook that integrates Cython compilation into the wheel build process, handling C extension compilation with support for NumPy, PyArrow, and other library includes.
Yes, if you are building Cython extensions with Hatch. The plugin is actively maintained, has low install friction, and eliminates boilerplate setup.py code. It is not needed if you are not using Cython or are using a different build backend. Be aware that build-time dependencies (Cython, setuptools, and any library includes) must be explicitly listed in build-system.requires.
Install
hatch-cython on PyPI
pip
pip install hatch-cythonuv
uv add hatch-cythonpoetry
poetry add hatch-cythonInstalling hatch-cython
Before you install
Low install friction; pure Python wheel with four runtime dependencies (cython, hatchling, setuptools, typing-extensions). Actively maintained with recent commits and passing CI/CD.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
# Add to pyproject.toml [build-system]
requires = ["hatchling", "hatch-cython", "Cython", "setuptools"]
build-backend = "hatchling.build"
# Configure in [tool.hatch.build.targets.wheel.hooks.cython.options]
[tool.hatch.build.targets.wheel.hooks.cython.options]
directives = { language_level = 3 }
Cython and setuptools must be in build-system.requires at load time, not just as hook dependencies; additional packages (numpy, pyarrow, etc.) required in build-system.requires if their include paths are used.
Verify before relying
- Whether the hook automatically discovers .pyx/.pxd files or requires explicit file configuration.
- Performance overhead or build-time impact compared to setuptools-only Cython builds.
- Compatibility with editable installs and development workflows.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — cython, hatchling, setuptools, typing-extensions |
| Maintenance | actively maintained — 239 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 198,359/month — #9,734 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hatch_cython-0.6.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
hatch-polylith-bricksA Hatch build hook that integrates Polylith…
permissive · top 15,000 on PyPI
hatchHatch is a modern Python project manager that…
permissive · top 1,000 on PyPI
hatchling-autoextras-hookA Hatchling metadata hook that automatically…
permissive · top 5,000 on PyPI
hatch_build_scriptsA Hatch build plugin that runs arbitrary shell…
permissive · top 15,000 on PyPI
hatch-vcsA Hatch plugin that automatically determines…
permissive · top 1,000 on PyPI
hatch-regex-commitA Hatch plugin that automatically creates Git…
permissive · top 15,000 on PyPI
extension-helpersProvides build helpers and utilities for Python…
permissive · top 5,000 on PyPI
scikit-build-coreA build backend that uses CMake to compile…
permissive · top 5,000 on PyPI