--- id: hatch-cython version: "0.6.0" license: MIT license_treatment: permissive maintenance: active --- # hatch-cython — Cython build hooks for hatch License: permissive · Maintenance: active · Downloads: 198.4K/mo ## 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 above — 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 pip install hatch-cython uv add hatch-cython poetry add hatch-cython ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 198.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags cython build hook hatch, compile cython extensions hatch, c extension build tool, hatch cython integration, python c extension builder, cython, build-backend, c-extensions [View on SkillFed](https://skillfed.io/packages/hatch-cython) · [View on PyPI](https://pypi.org/project/hatch-cython/)