Skip to main content

typos

Source code spell checker

Finds and corrects spelling mistakes among source code:

  • Fast enough to run on monorepos
  • Low false positives so you can run on PRs

Screenshot

Downloads codecov Documentation License Crates Status

Dual-licensed under MIT or Apache 2.0

Documentation

Install

Download a pre-built binary (installable via gh-install).

Or use rust to install:

$ cargo install typos-cli --locked

Or use Homebrew to install:

$ brew install typos-cli

Or use Conda to install:

$ conda install typos

Or use Pacman to install:

$ sudo pacman -S typos

Getting Started

Most commonly, you'll either want to see what typos are available with

$ typos

Or have them fixed

$ typos --write-changes
$ typos -w

If there is any ambiguity (multiple possible corrections), typos will just report it to the user and move on.

False Positives

Sometimes, what looks like a typo is intentional, like with people's names, acronyms, or localized content.

To mark a word or an identifier (grouping of words) as valid, add it to your _typos.toml by declaring itself as the valid spelling:

[default]
extend-ignore-identifiers-re = [
    # *sigh* this just isn't worth the cost of fixing
    "AttributeID.*Supress.*",
]

[default.extend-identifiers]
# *sigh* this just isn't worth the cost of fixing
AttributeIDSupressMenu = "AttributeIDSupressMenu"

[default.extend-words]
# Don't correct the surname "Teh"
teh = "teh"

For more ways to ignore or extend the dictionary with examples, see the config reference.

For cases like localized content, you can disable spell checking of file contents while still checking the file name:

[type.po]
extend-glob = ["*.po"]
check-file = false

(run typos --type-list to see configured file types)

If you need some more flexibility, you can completely exclude some files from consideration:

[files]
extend-exclude = ["localized/*.po"]

Integrations

Custom

typos provides several building blocks for custom native integrations

  • - reads from stdin, --write-changes will be written to stdout
  • --diff to provide a diff
  • --format json to get jsonlines with exit code 0 on no errors, code 2 on typos, anything else is an error.

Examples:

$ # Read file from stdin, write corrected version to stdout
$ typos - --write-changes
$ # Creates a diff of what would change
$ typos dir/file --diff
$ # Fully programmatic control
$ typos dir/file --format json

Debugging

You can see what the effective config looks like by running

$ typos --dump-config -

You can then see how typos is processing your project with

$ typos --files
$ typos --identifiers
$ typos --words

If you need to dig in more, you can enable debug logging with -v

FAQ

Why was ... not corrected?

Does the file show up in typos --files? If not, check your config with typos --dump-config -. The [files] table controls how we walk files. If you are using files.extend-exclude, are you running into #593? If you are using files.ignore-vcs = true, is the file in your .gitignore but git tracks it anyways? Prefer allowing the file explicitly (see #909).

Does the identifier show up in typos --identifiers or the word show up in typos --words? If not, it might be subject to one of typos' heuristics for detecting non-words (like hashes) or unambiguous words (like words after a \ escape).

If it is showing up, likely typos doesn't know about it yet.

typos maintains a list of known typo corrections to keep the false positive count low so it can safely run unassisted.

This is in contrast to most spell checking UIs people use where there is a known list of valid words. In this case, the spell checker tries to guess your intent by finding the closest-looking word. It then has a gauge for when a word isn't close enough and assumes you know best. The user has the opportunity to verify these corrections and explicitly allow or reject them.

For more on the trade offs of these approaches, see Design.

Metadata

Release files for typos 1.53.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typos 1.53.0
File Size Uploaded Provenance Actions
typos-1.53.0.tar.gz 1.9 MB Without provenance Details for typos-1.53.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for typos 1.53.0
File Actions
typos-1.53.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for typos-1.53.0-py3-none-win_amd64.whl
typos-1.53.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for typos-1.53.0-py3-none-musllinux_1_2_x86_64.whl
typos-1.53.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for typos-1.53.0-py3-none-musllinux_1_2_aarch64.whl
typos-1.53.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for typos-1.53.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
typos-1.53.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for typos-1.53.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
typos-1.53.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for typos-1.53.0-py3-none-macosx_11_0_arm64.whl
typos-1.53.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for typos-1.53.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 44.1 MB

Release files / typos-1.53.0.tar.gz

Download URL typos-1.53.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
0c2a52305fd0720e7ba337a8c7e546de36c508805c948b9998906c4da5eda2b9
BLAKE2b-256 checksum
How to use checksums
707fd25756ef830c3b0df8dcebd58aba17cb8469b609a6091abd052d337acb81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-win_amd64.whl

Download URL typos-1.53.0-py3-none-win_amd64.whl
Size 3.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
83c395d4ffd12a025e79be2259f05cdc33e14a3ff72f01237ff051bb0ffa5e61
BLAKE2b-256 checksum
How to use checksums
b3fdfe9ccd10f96cf2411e8bb94210bf63813ff21b6657229062429b1d821e42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-musllinux_1_2_x86_64.whl

Download URL typos-1.53.0-py3-none-musllinux_1_2_x86_64.whl
Size 8.3 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d90fdb159bf42bc52b891d5a28e571815f5f42d105da4c553dbd663d4c06a2f0
BLAKE2b-256 checksum
How to use checksums
9dcc87c5c0c1b344c5d1ee052dbd6fa32bad92c146764509bb814d4e863ec849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-musllinux_1_2_aarch64.whl

Download URL typos-1.53.0-py3-none-musllinux_1_2_aarch64.whl
Size 7.3 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
68b78e50a22b6e76f78020396fcb0a5d2632fa5d22f9fd67074d9cb22e061773
BLAKE2b-256 checksum
How to use checksums
2a6b80e69b8ed4fad45b7dd8da37907c4d86446420a5df0b14306ad038bc541b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL typos-1.53.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 7.9 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c4bb011a3f73e7dcea6d5a8e753e5922219ac965df8a92973689c7c5644dcd74
BLAKE2b-256 checksum
How to use checksums
a209e7ce75dd072b8a7ac02d26752c0faea19451a8c881e6aa23c23ade950b8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL typos-1.53.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 8.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c6726263b78ff39dd8b6ea3e6d31889064a062c40f691c8aa989bcb257f69e07
BLAKE2b-256 checksum
How to use checksums
adc738464c3fe2557f0fd1dcb4c0e630f795b171f37b9d6d544598127285395e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-macosx_11_0_arm64.whl

Download URL typos-1.53.0-py3-none-macosx_11_0_arm64.whl
Size 3.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6dc385e75a7916d0f8f85cd3eb00301f300d0cab73b43a1660e7397361fb279a
BLAKE2b-256 checksum
How to use checksums
1c6dca2d3663753edb8b55c76a6e412803180136bb8d5d6615aa73542c74b7e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / typos-1.53.0-py3-none-macosx_10_12_x86_64.whl

Download URL typos-1.53.0-py3-none-macosx_10_12_x86_64.whl
Size 3.5 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a35fb5545509fdbbd121f6eee7bd9433154468c8dd31232e5c201ae41bb76627
BLAKE2b-256 checksum
How to use checksums
b8b7dd9f035e63ba564bf7f8e8fb3244bca18e7c400811a568872053bd0efe18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Security for typos 1.53.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.53.0 This release

8 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page