A CLI tool that runs Python linters and formatters such as ruff, isort, black, mypy and flake8 directly on Jupyter Notebooks.
codespell-project/codespell
A command-line tool that finds and fixes common misspellings in source code and text files using a curated misspelling dictionary.
- Stars
- 2,432
- Forks
- 536
- Open issues
- 265
- Last commit
- 4 hours ago
What is it?
codespell checks files for a curated list of common misspellings rather than validating words against a full dictionary. This keeps false positives low when code uses niche terms, while still catching typos such as "adn" for "and". It is designed mainly for source code and skips backslash escapes, but it works on any text file.
By default it runs as a dry run that reports misspellings. With the -w flag it writes the suggested fixes, and interactive mode lets you review each change. Words can be ignored through an ignore file, command-line lists, or inline comments, and settings can be stored in setup.cfg, .codespellrc, or pyproject.toml.
The project ships several dictionaries derived from a Wikipedia list of common misspellings, and users can supply their own. It installs with pip, requires Python 3.9 or newer, and includes a pre-commit hook.
Key features
- 01Checks files against a curated list of common misspellings rather than a full dictionary.
- 02Can apply suggested fixes automatically or interactively with -w and -i.
- 03Ignores false positives via word lists, command-line flags, or inline comments.
- 04Reads configuration from setup.cfg, .codespellrc, or pyproject.toml.
- 05Works as a pre-commit hook and can fail CI runs when fixes are written.
Use cases
- Catching typos in source code comments, identifiers, and docs during development.
- Running spell checks in a CI pipeline or pre-commit hook.
- Cleaning up typos across a large existing codebase with interactive fixes.
Quick start
- 1
Install codespell from PyPI with pip
pip install codespell - 2
Run codespell in the current directory
codespell
Things to know
- Licensed under GPL-2.0, a copyleft license that may restrict how you distribute derived code.
- It only catches common misspellings from its dictionary, so unusual typos will not be found.
Topics
FAQ
- What is codespell?
- A command-line tool that finds and fixes common misspellings in source code and text files using a curated misspelling dictionary. codespell checks files for a curated list of common misspellings rather than validating words against a full dictionary. This keeps false positives low when code uses niche terms, while still catching typos such as "adn" for "and". It is designed mainly for source code and skips backslash escapes, but it works on any text file.
- Is codespell free to use? What license does it have?
- codespell is open source under the GPL-2.0 license. Check the license terms before using it in commercial products.
- Is codespell still maintained?
- Actively maintained. The last commit to codespell was on Nov 6, 2026.
- What can I use codespell for?
- Catching typos in source code comments, identifiers, and docs during development. Running spell checks in a CI pipeline or pre-commit hook. Cleaning up typos across a large existing codebase with interactive fixes.
- How do I install codespell?
- Install codespell from PyPI with pip: pip install codespell Run codespell in the current directory: codespell
- Where can I get codespell?
- The source code and installation instructions are on GitHub: https://github.com/codespell-project/codespell
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A framework for managing and running multi-language pre-commit hooks that check code before each Git commit.
A fast Git hooks manager written in Go that runs pre-commit and other hook commands in parallel across Node.js, Ruby, Python and other projects.
Static analysis tool that finds unused functions, classes, variables, imports and unreachable code in Python projects.
A Python CLI that measures how many functions, classes, methods and modules in a codebase have docstrings, with CI-friendly pass/fail thresholds.
A Pylint plugin that teaches Pylint about Django models, forms, views and migrations to cut false positives in Django code.