skillfed

cython-lint

Lint Cython files

cython-lint v0.21.0 859.6K downloads/30d#4,878 on PyPI105
Permissive license Active released

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-lint

uv

uv add cython-lint

poetry

poetry add cython-lint

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

cython linterlint cython filescython code qualitycython pre-commit hookcython style checkercython error detectioncython pyx linter
cythonlintingpre-commit

More Quality Assurance packages