Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build-support/bin/generate_builtin_lockfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from pants.backend.scala.subsystems.scalatest import Scalatest
from pants.backend.sql.lint.sqlfluff.subsystem import Sqlfluff
from pants.backend.terraform.dependency_inference import TerraformHcl2Parser
from pants.backend.tools.codespell.subsystem import Codespell
from pants.backend.tools.semgrep.subsystem import SemgrepSubsystem
from pants.backend.tools.yamllint.subsystem import Yamllint
from pants.base.build_environment import get_buildroot
Expand Down Expand Up @@ -110,6 +111,7 @@ class JvmTool(Tool[JvmToolBase]): ...
PythonTool(Bandit, "pants.backend.python.lint.bandit"),
PythonTool(Black, "pants.backend.python.lint.black"),
PythonTool(ClangFormat, "pants.backend.experimental.cc.lint.clangformat"),
PythonTool(Codespell, "pants.backend.experimental.tools.codespell"),
PythonTool(CoverageSubsystem, "pants.backend.python"),
PythonTool(DebugPy, "pants.backend.python"),
PythonTool(Docformatter, "pants.backend.python.lint.docformatter"),
Expand Down
6 changes: 6 additions & 0 deletions docs/notes/2.32.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Thank you to [Klaviyo](https://www.klaviyo.com/) for their Platinum tier support

### Backends

#### New: Codespell

Pants now supports running [codespell](https://github.com/codespell-project/codespell) as a linter. `codespell` isn't a regular spell checker with a full dictionary, rather it is intended to be used on source code with a much smaller list of common misspelling.

Enable the `pants.backend.experimental.tools.codespell` backend to try it out.

#### Helm

#### JVM
Expand Down
3 changes: 3 additions & 0 deletions src/python/pants/backend/experimental/tools/codespell/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2026 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
python_sources()
Empty file.
25 changes: 25 additions & 0 deletions src/python/pants/backend/experimental/tools/codespell/register.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2026 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

"""A tool to find common misspellings in text files.

See https://github.com/codespell-project/codespell for details.
"""

from __future__ import annotations

from typing import Iterable

from pants.backend.python.goals import lockfile as python_lockfile
from pants.backend.tools.codespell import rules as codespell_rules
from pants.backend.tools.codespell import subsystem as subsystem
from pants.engine.rules import Rule
from pants.engine.unions import UnionRule


def rules() -> Iterable[Rule | UnionRule]:
return (
*codespell_rules.rules(),
*subsystem.rules(),
*python_lockfile.rules(),
)
15 changes: 15 additions & 0 deletions src/python/pants/backend/tools/codespell/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

resource(name="lockfile", source="codespell.lock")

python_sources(dependencies=[":lockfile"])

python_tests(
name="tests",
overrides={
"rules_integration_test.py": {
"timeout": 180,
}
},
)
Empty file.
244 changes: 244 additions & 0 deletions src/python/pants/backend/tools/codespell/codespell.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"allow_builds": true,
"allow_prereleases": false,
"allow_wheels": true,
"build_isolation": true,
"constraints": [],
"elide_unused_requires_dist": false,
"excluded": [],
"locked_resolves": [
{
"locked_requirements": [
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "3dadafa67df7e4a3dbf51e0d7315061b80d265f9552ebd699b3dd6834b47e425",
"url": "https://files.pythonhosted.org/packages/20/01/b394922252051e97aab231d416c86da3d8a6d781eeadcdca1082867de64e/codespell-2.4.1-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "299fcdcb09d23e81e35a671bbe746d5ad7e8385972e65dbb833a2eaac33c01e5",
"url": "https://files.pythonhosted.org/packages/15/e0/709453393c0ea77d007d907dd436b3ee262e28b30995ea1aa36c6ffbccaf/codespell-2.4.1.tar.gz"
}
],
"project_name": "codespell",
"requires_dists": [
"Pygments; extra == \"dev\"",
"build; extra == \"dev\"",
"chardet; extra == \"dev\"",
"chardet; extra == \"hard-encoding-detection\"",
"chardet>=5.1.0; extra == \"types\"",
"mypy; extra == \"types\"",
"pre-commit; extra == \"dev\"",
"pytest-cov; extra == \"dev\"",
"pytest-cov; extra == \"types\"",
"pytest-dependency; extra == \"dev\"",
"pytest-dependency; extra == \"types\"",
"pytest; extra == \"dev\"",
"pytest; extra == \"types\"",
"ruff; extra == \"dev\"",
"tomli; extra == \"dev\"",
"tomli; python_version < \"3.11\" and extra == \"toml\"",
"twine; extra == \"dev\""
],
"requires_python": ">=3.8",
"version": "2.4.1"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b",
"url": "https://files.pythonhosted.org/packages/77/b8/0135fadc89e73be292b473cb820b4f5a08197779206b33191e801feeae40/tomli-2.3.0-py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879",
"url": "https://files.pythonhosted.org/packages/15/1b/8c26874ed1f6e4f1fcfeb868db8a794cbe9f227299402db58cfcc858766c/tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e",
"url": "https://files.pythonhosted.org/packages/19/94/aeafa14a52e16163008060506fcb6aa1949d13548d13752171a755c65611/tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530",
"url": "https://files.pythonhosted.org/packages/26/5a/4b546a0405b9cc0659b399f12b6adb750757baf04250b148d3c5059fc4eb/tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc",
"url": "https://files.pythonhosted.org/packages/26/b6/d1eccb62f665e44359226811064596dd6a366ea1f985839c566cd61525ae/tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f",
"url": "https://files.pythonhosted.org/packages/30/77/fed85e114bde5e81ecf9bc5da0cc69f2914b38f4708c80ae67d0c10180c5/tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf",
"url": "https://files.pythonhosted.org/packages/39/67/f85d9bd23182f45eca8939cd2bc7050e1f90c41f4a2ecbbd5963a1d1c486/tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b",
"url": "https://files.pythonhosted.org/packages/42/17/5e2c956f0144b812e7e107f94f1cc54af734eb17b5191c0bbfb72de5e93e/tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b",
"url": "https://files.pythonhosted.org/packages/42/4f/2c12a72ae22cf7b59a7fe75b3465b7aba40ea9145d026ba41cb382075b0e/tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8",
"url": "https://files.pythonhosted.org/packages/45/12/ad5126d3a278f27e6701abde51d342aa78d06e27ce2bb596a01f7709a5a2/tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52",
"url": "https://files.pythonhosted.org/packages/45/e5/7c5119ff39de8693d6baab6c0b6dcb556d192c165596e9fc231ea1052041/tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf",
"url": "https://files.pythonhosted.org/packages/47/5c/24935fb6a2ee63e86d80e4d3b58b222dafaf438c416752c8b58537c8b89a/tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549",
"url": "https://files.pythonhosted.org/packages/52/ed/3f73f72945444548f33eba9a87fc7a6e969915e7b1acc8260b30e1f76a2f/tomli-2.3.0.tar.gz"
},
{
"algorithm": "sha256",
"hash": "940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77",
"url": "https://files.pythonhosted.org/packages/54/78/5c46fff6432a712af9f792944f4fcd7067d8823157949f4e40c56b8b3c83/tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05",
"url": "https://files.pythonhosted.org/packages/55/92/afed3d497f7c186dc71e6ee6d4fcb0acfa5f7d0a1a2878f8beae379ae0cc/tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f",
"url": "https://files.pythonhosted.org/packages/60/83/59bff4996c2cf9f9387a0f5a3394629c7efa5ef16142076a23a90f1955fa/tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845",
"url": "https://files.pythonhosted.org/packages/70/8c/f48ac899f7b3ca7eb13af73bacbc93aec37f9c954df3c08ad96991c8c373/tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0",
"url": "https://files.pythonhosted.org/packages/70/91/7cdab9a03e6d3d2bb11beae108da5bdc1c34bdeb06e21163482544ddcc90/tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba",
"url": "https://files.pythonhosted.org/packages/86/7f/d8fffe6a7aefdb61bced88fcb5e280cfd71e08939da5894161bd71bea022/tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b",
"url": "https://files.pythonhosted.org/packages/89/48/06ee6eabe4fdd9ecd48bf488f4ac783844fd777f547b8d1b61c11939974e/tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441",
"url": "https://files.pythonhosted.org/packages/89/da/75dfd804fc11e6612846758a23f13271b76d577e299592b4371a4ca4cd09/tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67",
"url": "https://files.pythonhosted.org/packages/92/04/a038d65dbe160c3aa5a624e93ad98111090f6804027d474ba9c37c8ae186/tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl"
},
{
"algorithm": "sha256",
"hash": "88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45",
"url": "https://files.pythonhosted.org/packages/b3/2e/299f62b401438d5fe1624119c723f5d877acc86a4c2492da405626665f12/tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c",
"url": "https://files.pythonhosted.org/packages/ba/28/72f8afd73f1d0e7829bfc093f4cb98ce0a40ffc0cc997009ee1ed94ba705/tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f",
"url": "https://files.pythonhosted.org/packages/be/2f/8b7c60a9d1612a7cbc39ffcca4f21a73bf368a80fc25bccf8253e2563267/tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf",
"url": "https://files.pythonhosted.org/packages/d5/f4/0fbd014909748706c01d16824eadb0307115f9562a15cbb012cd9b3512c5/tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3",
"url": "https://files.pythonhosted.org/packages/db/e4/1e58409aa78eefa47ccd19779fc6f36787edbe7d4cd330eeeedb33a4515b/tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae",
"url": "https://files.pythonhosted.org/packages/f1/01/88793757d54d8937015c75dcdfb673c65471945f6be98e6a0410fba167ed/tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22",
"url": "https://files.pythonhosted.org/packages/f9/3f/d9dd692199e3b3aab2e4e4dd948abd0f790d9ded8cd10cbaae276a898434/tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl"
},
{
"algorithm": "sha256",
"hash": "7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6",
"url": "https://files.pythonhosted.org/packages/fb/a1/4d6865da6a71c603cfe6ad0e6556c73c76548557a8d658f9e3b142df245f/tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005",
"url": "https://files.pythonhosted.org/packages/fd/42/8e3c6a9a4b1a1360c1a2a39f0b972cef2cc9ebd56025168c4137192a9321/tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl"
},
{
"algorithm": "sha256",
"hash": "d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac",
"url": "https://files.pythonhosted.org/packages/ff/b7/40f36368fcabc518bb11c8f06379a0fd631985046c038aca08c6d6a43c6e/tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl"
}
],
"project_name": "tomli",
"requires_dists": [],
"requires_python": ">=3.8",
"version": "2.3.0"
}
],
"marker": null,
"platform_tag": null
}
],
"only_builds": [],
"only_wheels": [],
"overridden": [],
"path_mappings": {},
"pex_version": "2.73.1",
"pip_version": "20.3.4-patched",
"prefer_older_binary": false,
"requirements": [
"codespell<3,>=2.2.6",
"tomli>=1.1.0; python_version < \"3.11\""
],
"requires_python": [
"CPython<4,>=3.8"
],
"resolver_version": "pip-2020-resolver",
"style": "universal",
"target_systems": [
"linux",
"mac"
],
"transitive": true,
"use_pep517": null,
"use_system_time": false
}
20 changes: 20 additions & 0 deletions src/python/pants/backend/tools/codespell/codespell.lock.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 6,
"valid_for_interpreter_constraints": [
"CPython<4,>=3.8"
],
"generated_with_requirements": [
"codespell<3,>=2.2.6",
"tomli>=1.1.0; python_version < \"3.11\""
],
"manylinux": "manylinux2014",
"requirement_constraints": [],
"only_binary": [],
"no_binary": [],
"excludes": [],
"overrides": [],
"sources": [],
"lock_style": "universal",
"complete_platforms": [],
"description": "This lockfile was generated by Pants. To regenerate, run: ./pants run build-support/bin/generate_builtin_lockfiles.py"
}
Loading
Loading