cython-lint
Lint Cython files
What it is and what it does
cython-lint is a static analysis tool that checks Cython (.pyx) files for code quality issues, unused imports, undefined variables, style violations, and Cython-specific problems. It combines pycodestyle checks with custom rules for patterns that are particularly error-prone in Cython code—such as dangerous default values, late-binding closures, and repeated dict keys—and can be run from the command line or integrated into pre-commit workflows.
The tool is designed to catch issues that flake8 historically missed in Cython files. It supports configuration via command-line arguments or a `.cython-lint.toml` / `pyproject.toml` file, allows selective rule ignoring, and includes an automated fixer for quote normalization. Its runtime dependencies are minimal and well-established (cython, pycodestyle, tokenize-rt, tomli), making it straightforward to integrate into existing Python development environments.
Use it for:
- Enforce code quality standards in Cython-heavy projects like NumPy, pandas, or scikit-learn before commits.
- Catch unused imports and variables in Cython modules during CI/CD pipelines via pre-commit hooks.
- Identify Cython-specific anti-patterns (late-binding closures, dangerous defaults) that pure Python linters miss.
- Normalize quote style in Cython files across a project using the double-quote-cython-strings fixer.
- Configure project-wide linting rules in pyproject.toml to maintain consistent Cython code style.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A linter for Cython files that checks for common errors, style issues, and code quality problems using pycodestyle rules and Cython-specific checks, with support for pre-commit hooks and automated fixes.
Yes. cython-lint is actively maintained, has low install friction, carries no security vulnerabilities, and is widely adopted by major scientific Python projects. If you work with Cython code, it fills a real gap that general Python linters leave open. The permissive MIT license removes any legal concern. Install it if you want to catch Cython-specific bugs and style issues early.
Install
cython-lint on PyPI
pip
pip install cython-lintuv
uv add cython-lintpoetry
poetry add cython-lintInstalling cython-lint
Before you install
Low friction install with four straightforward runtime dependencies (cython, pycodestyle, tokenize-rt, tomli). Actively maintained with recent releases; last commit was 2026-08-10 and the project is not archived.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute this package freely in both open-source and commercial projects without significant legal restrictions.
Quickstart
pip install cython-lint
# Command-line usage
cython-lint my_file.pyx
# Or configure in .pre-commit-config.yaml:
# - repo: https://github.com/MarcoGorelli/cython-lint
# rev: v0.21.0
# hooks:
# - id: cython-lint
Requires Python 3.10 or later.
Verify before relying
- Whether the tool's Cython-specific checks cover all common pitfalls in production codebases, or if gaps remain.
- Performance characteristics when linting large Cython projects with many files.
- How well the automated fixer (double-quote-cython-strings) integrates with other formatters like black.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — cython, pycodestyle, tokenize-rt, tomli |
| Maintenance | actively maintained — 54 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 859,563/month — #4,878 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cython_lint-0.21.0-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
pylamaPylama is a code audit tool that wraps multiple…
permissive · top 15,000 on PyPI
sphinx-lintSphinx Lint checks reStructuredText and Python…
permissive · top 15,000 on PyPI
flake8-mutableA flake8 plugin that detects mutable default…
permissive · top 15,000 on PyPI
flake8-tidy-importsA flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
flake8-quotesA flake8 plugin that enforces consistent quote…
permissive · top 5,000 on PyPI
cymemcymem provides memory-management helpers for…
permissive · top 5,000 on PyPI
flake8-blackA flake8 plugin that runs black's code style…
permissive · top 15,000 on PyPI