Skip to content

Add codespell support with configuration and fixes - #15399

Open
yarikoptic wants to merge 7 commits into
ipython:mainfrom
yarikoptic:enh-codespell
Open

yarikoptic wants to merge 7 commits into
ipython:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

Add codespell configuration and fix existing typos.

More about codespell: https://github.com/codespell-project/codespell

I personally introduced it to over a hundred projects already, mostly with positive feedback
(see the "improveit-dashboard").

CI workflow has permissions set only to read so it is safe.

Changes

Configuration & Infrastructure

  • Added [tool.codespell] section to pyproject.toml with:
    • Skip list: .git, .git-meta, *.svg, *.css, ./docs/source/whatsnew/*
      (whatsnew is auto-generated from PR titles and GitHub stats — not spell-correctable)
    • URL protection via ignore-regex (upstream URLs with typos should not be "fixed")
    • ignore-words-list for false positives (see below)
  • GitHub Actions workflow (.github/workflows/codespell.yml) to check on push/PRs to main
    • Uses pinned SHA for actions/checkout (consistent with other workflows in this repo)
  • Pre-commit hook configured in .pre-commit-config.yaml with tomli dependency for Python < 3.11

Domain-Specific Whitelist

Added legitimate terms codespell flags as typos:

  • ans, strng, dne — variable abbreviations (answer, string, does-not-exist)
  • whos — IPython %whos magic command (not "whose")
  • crasher, defaulty, matchin, promptin — function/parameter/attribute names
  • abd, fo, te, whe — test fixture strings used for completion testing
  • notin — ast.NotIn (Python AST node name)
  • buss, tham — contributor names (Gerrit Buss, Ivan Tham)
  • oktober — German "Oktober" in a quoted email header in interactiveshell.py
  • mis — (mis)type parenthetical in docs
  • reenable — valid non-hyphenated form in historical commit titles

Typo Fixes

Ambiguous typos fixed manually (5 fixes with context review):

  • debugger.py: Toke → Token in TODO comments (ambiguous: Token vs Took)
  • filters.py: re-used → reused (comment style fix)
  • release_helper.sh: fo → for ("necessary for building the docs")
  • wrapperkernels.rst: re-use → reuse
  • test.yml: mirros → mirrors (CI mirror list comment)

Non-ambiguous typos fixed automatically (10 fixes in 7 files via codespell -w):

  • gloabl→global, EXPLICT→EXPLICIT (pyproject.toml comments)
  • canot→cannot (IPython/core/doctb.py)
  • especialy→especially (IPython/core/guarded_eval.py)
  • manger→manager (IPython/core/history.py docstring)
  • specied→specified (IPython/external/pickleshare.py)
  • themeing→theming (IPython/terminal/interactiveshell.py deprecation warning)
  • implict→implicit (tests/test_completer.py comment)
  • re-declaring→redeclaring (tests/test_magic.py comment)
  • itsel→itself (.github/ISSUE_TEMPLATE.md)

Historical Context

This project has had 704 prior commits fixing typos manually (commits with "typo",
"spell", or "spelling" in the message), demonstrating the value of automated spell-checking.

Testing

✅ Codespell passes with zero errors after all fixes


🤖 Generated with Claude Code and love to typos free code

yarikoptic and others added 7 commits September 16, 2026 21:48
Config updates:
- Add .git-meta to skip list (PR/commit message drafts often quote typos)
- Add ignore-regex for URLs (upstream URLs with typos should not be changed)
- Add ignore-words-list for variable names, magic commands and domain terms:
  ans/strng/dne (variable abbreviations), whos (%whos magic command),
  crasher/defaulty/matchin/promptin (function/parameter/attribute names),
  abd/fo/te/whe (test fixture strings), notin (ast.NotIn node name),
  buss/tham (contributor names), oktober (German in quoted email),
  mis ((mis)type parenthetical), reenable (valid non-hyphenated form)

Manual typo fixes (ambiguous or context-dependent):
- debugger.py: Toke -> Token in TODO comments (ambiguous: Token vs Took)
- github-stats-0.12.rst: trailling -> trailing (context = "trailing spaces")
- github-stats-0.13.rst: lastest -> latest (context = tornado version)
- filters.py: re-used -> reused (style fix in comment)
- release_helper.sh: fo -> for (context = "necessary for building")
- wrapperkernels.rst: re-use -> reuse (style fix)
- test.yml: mirros -> mirrors (context = CI mirror list)

Co-Authored-By: Claude Code 2.1.274 / Claude Sonnet 4.6 <[email protected]>
Fixed typos (all single-suggestion, no ambiguity):
- gloabl -> global (pyproject.toml)
- EXPLICT -> EXPLICIT (pyproject.toml)
- canot -> cannot (IPython/core/doctb.py)
- especialy -> especially (IPython/core/guarded_eval.py)
- manger -> manager (IPython/core/history.py)
- specied -> specified (IPython/external/pickleshare.py)
- themeing -> theming (IPython/terminal/interactiveshell.py)
- implict -> implicit (tests/test_completer.py)
- re-declaring -> redeclaring (tests/test_magic.py)
- itsel -> itself (.github/ISSUE_TEMPLATE.md)
- quikly -> quickly, inputed -> inputted, ususal -> usual (docs/version7.rst, version9.rst)
- evaulation -> evaluation, multline -> multiline, non-existant -> non-existent (docs/github-stats-0.11.rst)
- doen't -> doesn't (docs/github-stats-0.12.rst)
- pyhton -> python, unhandeled -> unhandled, inoperant -> inoperative,
  imput -> input (docs/github-stats-0.13.rst)
- annoted -> annotated, thansk -> thanks, restuctured -> restructured,
  non-existant -> non-existent, undefinied -> undefined,
  transfomers -> transformers, ouside -> outside, unexpectly -> unexpectedly,
  execption -> exception, incompatibilty -> incompatibility, easyer -> easier,
  Sliently -> Silently, dashboad -> dashboard, disconect -> disconnect (docs/github-stats-1.0.rst)
- atleast -> at least, aligment -> alignment, shorcuts -> shortcuts,
  defauts -> defaults, comparission -> comparison, Case-insesitive -> Case-insensitive,
  verion -> version, annoted -> annotated, Buitlin -> Builtin (docs/github-stats-2.0.rst)
- Loder -> Loader (docs/github-stats-4.rst)

Co-Authored-By: Claude Code 2.1.274 / Claude Sonnet 4.6 <[email protected]>

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "uvx codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
- codespell.yml: update actions/checkout@v6 to pinned SHA v7 (consistent
  with other workflows in this repo)
- .pre-commit-config.yaml: fix comment to say config is in pyproject.toml
  (not .pre-commit-config.yaml); add tomli dependency for Python < 3.11
  so the hook can read [tool.codespell] from pyproject.toml

Co-Authored-By: Claude Code 2.1.274 / Claude Sonnet 4.6 <[email protected]>
The whatsnew/ directory contains auto-generated github-stats-*.rst files
whose content (PR titles, commit messages) should not be spell-corrected —
those are historical records of upstream text. The hand-written version*.rst
release notes are also skipped to be consistent: their typos, if any, belong
to the historical record as well.

Revert the typo fixes previously applied to files in that directory
(they were already committed in the prior datalad run; this reverts them).

Also fix the fnmatch skip pattern: codespell prefixes scanned paths with
"./" when running from the repo root, so the pattern must use
"./docs/source/whatsnew/*" to match correctly.

Co-Authored-By: Claude Code 2.1.274 / Claude Sonnet 4.6 <[email protected]>
Comment on lines +20 to +21
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants