Skip to main content
https://badge.fury.io/py/topy.svg Travis CI

Topy (anagram of “typo”) is a Python script to fix typos in text, using rulesets developed by the RegExTypoFix project from Wikipedia. The English ruleset is included with Topy and is used by default. Other rulesets can be manually downloaded.

Topy works with Python 3.6-3.9.

The easiest way to install it is using pip:

pip install topy

Usage:

Usage: topy [options] FILES/DIRS...

Options:
  -h, --help            show this help message and exit
  -q, --quiet           silence information messages
  -a, --apply           overwrite files in place
  -r FILE, --rules=FILE
                        specify custom ruleset file to use
  -d RULE, --disable=RULE
                        disable rules by name
  --color=WHEN, --colour=WHEN
                        colorize the output; WHEN can be 'never', 'always', or
                        'auto'

For example, if you want to integrate topy in your CI pipeline, you can do something like:

sh -c "git ls-files | xargs topy --quiet --apply --; git --no-pager diff --exit-code"

The line above will check all files tracked by git, apply fixes to them and fail if any changes are applied. If no changes are to be applied, the command returns success.

Resources

Changelog

1.1.0 (2021-02-03)

  • Added colors to output. Thanks to Brian de Buiteach (@debuiteb) (#25)

  • Python 3.5 support is removed to allow newer syntax (#25)

1.0.1 (2021-01-30)

  • Updated bundled ruleset from Wikipedia (#29)

  • Python 3.9 is now officially supported and tested in CI (#27)

  • Migrated tests from travis-ci.org to travis-ci.com (#28)

1.0.0 (2020-09-08)

  • Updated bundled ruleset from Wikipedia (#23)

  • Removed Python 2.x and <3.5 compatibility code (#22)

  • Fixed Travis CI configuration (#21)

0.3.0 (2020-06-02)

Note: This was the last release to support Python 2.7.

  • Updated bundled ruleset (thanks to Oscar Caballero)

  • Added –disable option to disable individual rules (thanks to Oscar Caballero)

  • Fixed behavior when replacement string contains $ symbol (thanks to Oscar Caballero)

  • Prefer the faster lxml parser when it is installed. lxml is now an optional dependency (thanks to Oscar Caballero)

  • Added Python 3.7 support, deprecated Python 3.3 and 3.4.

0.2.2 (2016-12-16)

  • Update bundled ruleset

  • Officially add Python 3.6 support

0.2.1 (2016-07-15)

  • Update bundled ruleset

  • Update regex dependency version to avoid regex issue #216

  • Officially add Python 3.5 support

0.2.0 (2015-09-09)

  • Several fixes with Unicode on Python 2

  • Can safely deal with filenames that are invalid Unicode

  • Update bundled ruleset

  • Fix a few warnings from used libraries

0.1.0 (2014-08-24)

  • Initial public release

Contributing

Code style:

  • In general follow the Python PEP-8 coding style, except line length can go up to 120 chars.

  • Strings that have meaning for humans use double quotes ("), otherwise single quotes ('). When in doubt, don’t worry about it.

  • Code should be compatible with both Python 2 and 3, preferably without version-specific conditionals.

Run the test suite using python setup.py test.

Submit your changes as pull requests on GitHub.

License

The Topy software is licensed under the MIT license (see LICENSE.txt)

The bundled retf.txt file, copied from Wikipedia AutoWikiBrowser/Typos by Wikipedia contributors is licensed under CC-BY-SA. See the page on Wikipedia for authorship information.

Release files for topy 1.1.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 topy 1.1.0
File Size Uploaded
topy-1.1.0.tar.gz 140.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for topy 1.1.0
File Interpreter ABI Platform
topy-1.1.0-py3.9.egg Legacy Egg format - - Details

Total release size: 284.3 kB

Release files / topy-1.1.0.tar.gz

Download URL topy-1.1.0.tar.gz
Size 140.9 kB
Tags Source
SHA-256 checksum
How to use checksums
aa8e40f82dd212d7c739c267cc9c308285759ab556bdb1b6bfb12573d337433d
BLAKE2b-256 checksum
How to use checksums
6045c3a61d32a6fd2d0873351a40e52743e634e4d327f2a8e7b662c9d6b4ddf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / topy-1.1.0-py3.9.egg

Download URL topy-1.1.0-py3.9.egg
Size 143.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
64541452338a397f678df998d4ae097d35781b96ba2506901851f2b18761a86a
BLAKE2b-256 checksum
How to use checksums
2e6214938dcc378fa6240a20ee3cc26f7de3a9066478d0f7dfe85f6f97a6333d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.1

1 release file

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