tingle
Spider-sense for refactoring: you know that tingle — the itch that says the codebase isn't right yet. This tool puts a number on it, so you can watch it drop.
Code metrics for the era of constant refactoring.
tingle measures things you want to shrink (or watch) while refactoring a
codebase: ignored lint rules, inline # noqa / # type: ignore comments,
uses of a legacy class during a strangler-fig migration, lines of code in a
package that should disappear.
It runs once, prints the numbers, and stores nothing. To watch a number over months, the metrics-history action records a point per commit that lands and publishes a chart of them.
📖 Documentation: https://tingle.fancysnake.dev/
Install
pip install tingle
Quick start
tingle init # starter tingle.toml
tingle library # ready-made metrics for known tools
tingle add --base tingle.builtins.ruff.noqa_comment
tingle add regex_count '#\s*noqa' # or state one yourself
tingle add toml_list_length tool.ruff.lint.ignore --name ruff-ignores
tingle # interactive mode (on a terminal)
tingle stat # summary table
tingle stat --json # machine-readable output
tingle stat --diff # impact of the current branch
tingle report # every occurrence, file:line
tingle report --diff # what the branch added/removed
tingle report --group linting # one group, or --metric NAME
Metrics are declared in tingle.toml (or a [tool.tingle] section in
pyproject.toml):
[ranges.python]
include = ["src/**/*.py", "tests/**/*.py"]
default = true
[[metrics]]
name = "noqa-comments"
type = "regex_count"
pattern = '#\s*noqa'
You can count regex matches, uses of a Python symbol, entries in a TOML or INI list (this is how you count ignored lint rules), files, and lines. See the metric types.
For the tools everyone already runs there are ready-made definitions, so a metric can name one and override only what differs:
[[metrics]]
base = "tingle.builtins.ruff.noqa_comment"
extra_ignore_lines = ['# @generated']
They live in an ordinary Python package, so your team can publish its own. See the template library.
What it does
Three things, in rising order of opinion:
- Measure.
tingle statcounts what you told it to count and prints the numbers. Metric values never affect the exit code — tingle measures, it does not judge. - Attribute.
tingle stat --diffmeasures only what the current branch changed, against the merge-base with a base branch, so commits that landed on the base after you branched don't pollute your numbers. - Judge.
tingle checkis the CI gate: the same branch measurement, but it exits 1 if the branch made things worse, so a pull request that takes on debt fails the build.
$ tingle check
noqa-comment (regex_count): +2
+ src/api/views.py:23
+ src/api/views.py:41
$ echo $?
1
Documentation
- Configuration —
tingle.toml, ranges, groups. - Metric types — what you can count, and the limits of each counter.
- Template library — ready-made metrics for known tools, and publishing your own.
- Branch impact — how
--diffattributes changes to your branch. - CI gate — failing the build on new debt.
- History — recording a point per commit and publishing a chart per group, like tingle's own.
- CLI reference — every command and flag.
Development
Python 3.11–3.14 are supported (CI runs the full matrix). The project uses mise + Poetry.
mise install
poetry install
mise run test:py # tests
mise run lint:py # ruff, mypy, pylint, import-linter
mise run docs:serve # preview the docs site
See contributing for the GLIMPSE source layout and the layer contracts.
License
MIT.
Release files for tingle 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tingle-0.7.0.tar.gz | 91.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tingle-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 208.3 kB
Release files / tingle-0.7.0.tar.gz
| Download URL | tingle-0.7.0.tar.gz |
|---|---|
| Size | 91.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
355d6c46e7b76ad0d8b9ffe196585521749adc366dbd252d9cbb4f0dd93a9ee8
|
|
BLAKE2b-256 checksum How to use checksums |
807d313b3f4a7128aca721e16b1e05065c8e81a45b9e0246e68d507714fa502b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logRelease files / tingle-0.7.0-py3-none-any.whl
| Download URL | tingle-0.7.0-py3-none-any.whl |
|---|---|
| Size | 117.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c29e3ceb6e993ad42443d32f0061ab99a51c824a6d7a52cca3517953b98359a2
|
|
BLAKE2b-256 checksum How to use checksums |
06644ffaa90380920aaa00ae63aebb0af35693c113cd8cc3182045de63f1294c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency log