pytest-cython
A plugin for testing Cython extension modules.
Decision gist · record as of 2026-08-14
Yes, if you maintain Cython extensions and want to validate embedded documentation. The plugin is low-friction (one dependency, pure Python), actively maintained, and has no security issues. The main caveat: license terms are undocumented in the package metadata—verify the actual license in the repository before use in proprietary or restricted contexts. Not applicable if you don't use Cython or don't write doctests.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.8.
- The --import-mode=importlib option is not supported; --import-mode=prepend with non-editable packages requires PY_IGNORE_IMPORTMISMATCH=1 environment variable.
- Low friction: pure Python wheel with only pytest as a runtime dependency.
License · maintenance · safety
(unclear) — License status is unclear—no SPDX identifier or raw license text is recorded. Verify the actual license terms in the repository before adopting in a commercial or restricted context.
last release 2026-03-11 (156 days) · last repo commit 2026-03-11 · 22 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 281,417 downloads/mo, #8,097 on PyPI
Alternatives
Verify before relying
pip install pytest-cython
# In your project, run:
pytest --doctest-cython
# Or for a specific .pyx file:
pytest --doctest-cython path/to/module.pyx- Whether the package is actually licensed under an open-source or proprietary license (license metadata is missing).
- Real-world compatibility with Cython 3.x versions beyond the documented 0.4.x / Cython 3 pairing.
- Whether doctests in compiled .pyx modules execute with the same semantics as Python doctests.
What it is and what it does
pytest-cython is a pytest plugin that extends pytest's doctest discovery and execution to Cython `.pyx` source files. It allows you to write and run doctests directly in docstrings of Cython extension modules, treating them as executable documentation that pytest can validate. This bridges the gap between Cython's compiled C/C++ extensions and Python's standard doctest workflow, letting developers verify that code examples in their Cython module documentation actually work.
The plugin integrates seamlessly with pytest's command-line interface via the `--doctest-cython` flag. It has a single runtime dependency on pytest itself, making installation straightforward. Compatibility is versioned: the current 0.4.x release targets pytest 9 and Cython 3. The package has been maintained since 2016 and remains actively developed, with no known security vulnerabilities.
Use it for
- Verify that code examples in Cython module docstrings execute correctly as part of your test suite.
- Document C/C++ extension behavior through executable examples without maintaining separate test files.
- Catch documentation drift in Cython projects by running doctests alongside unit tests in CI/CD.
- Test the public API of compiled Cython modules by embedding doctests in `.pyx` files.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you maintain Cython extensions and want to validate embedded documentation.
The plugin is low-friction (one dependency, pure Python), actively maintained, and has no security issues. The main caveat: license terms are undocumented in the package metadata—verify the actual license in the repository before use in proprietary or restricted contexts. Not applicable if you don't use Cython or don't write doctests.
Install
pytest-cython on PyPI
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Active maintenance with a recent release (156 days ago) and no known vulnerabilities.
Requires Python >=3.8. The --import-mode=importlib option is not supported; --import-mode=prepend with non-editable packages requires PY_IGNORE_IMPORTMISMATCH=1 environment variable.
License in practice
License status is unclear—no SPDX identifier or raw license text is recorded. Verify the actual license terms in the repository before adopting in a commercial or restricted context.
Quickstart
pip install pytest-cython
# In your project, run:
pytest --doctest-cython
# Or for a specific .pyx file:
pytest --doctest-cython path/to/module.pyx
Verify before relying
- Whether the package is actually licensed under an open-source or proprietary license (license metadata is missing).
- Real-world compatibility with Cython 3.x versions beyond the documented 0.4.x / Cython 3 pairing.
- Whether doctests in compiled .pyx modules execute with the same semantics as Python doctests.
Package facts
| License | Not declared unclear |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 156 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 281,417 / month, #8,097 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_cython-0.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest cython doctest”
- pytest-cythonA pytest plugin that runs doctests embedded in Cython `.pyx`…
- pytest-doctestplusA pytest plugin that runs doctests in Python docstrings and…
- xdoctestXdoctest finds and executes test code embedded in Python docstrings,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also pytest-logging · xdoctest · pytest-doctestplus · pytest-helpers-namespace · pytest-xml · pytest-xvfb · pytest-json · pytest-snapshot · pytest-custom-exit-code · pytest-rich