Skip to main content

asciilint

PyPI version Python versions CI tests Mypy check Ruff check Documentation License

Minimal, configurable, CI-friendly character policy checks for text files.

By default, asciilint recursively scans a project and fails when UTF-8 text files contain non-ASCII characters. It can also enforce arbitrary Unicode allowlists and denylists, so it is useful for broader character policy checks.

Installation

Install asciilint from PyPI:

pip install asciilint

For an isolated, global CLI installation, use pipx:

pipx install asciilint

To run it once without adding it to your environment, use uvx:

uvx asciilint --help

Usage

asciilint .

Example failing output:

> Checking characters in /path/to/project
Files to scan: 2, 1 ignored
Checking text:
✓x
Files checked: 2 text, 0 binary skipped, 0 read error(s)

Issues :-(
> Disallowed characters
  1. docs/page.md
     1. [L012:C018] U+2014 "\u2014" not allowed by policy
Summary: 1 disallowed character(s), 0 read error(s)

Exit code 0 means no issues. Exit code 1 means disallowed characters or read errors were found.

Configuration

Create asciilint.toml:

[asciilint]
paths = ["."]
respect_gitignore = true
ignore_files = [".asciilintignore"]
allowed_ranges = ["U+0000-U+007F"]
allowed_chars = []
disallowed_ranges = []
disallowed_chars = []
max_issues_per_file = 5

Ignore files use gitignore syntax and are matched with pathspec. .gitignore is respected by default. You can add other ignore files, for example:

asciilint . --ignore-file .asciilintignore --ignore-file config/lint.ignore

Character ranges can be written as U+0000-U+007F, 0x20..0x7e, 32-126, or single code points such as U+00A9. Deny rules take precedence over allow rules.

To allow any Unicode character except a small denylist:

asciilint . --allow-any --disallowed-char "→" --disallowed-range U+2000-U+206F

UTF-8 and binary files

asciilint assumes text files are UTF-8. Files that are classified as text but cannot be decoded as UTF-8 are reported explicitly and skipped. Binary files are skipped automatically using the zlib txtvsbin heuristic, plus a short list of known binary format signatures for formats that the byte-level heuristic alone cannot catch.

Both steps use bounded memory regardless of file size. The classification step samples up to 8 KB from the head and 8 KB from the tail of each file (files <= 16 KB are read fully). Text files are then scanned in fixed size chunks rather than being read into the memory at once.

Metadata

Release files for asciilint 0.4.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 asciilint 0.4.0
File Size Uploaded
asciilint-0.4.0.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asciilint 0.4.0
File Interpreter ABI Platform
asciilint-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.2 kB

Release files / asciilint-0.4.0.tar.gz

Download URL asciilint-0.4.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c6c21f8f0422ad8dc3e602f9b6a493cfa3fa1e52d0f269f0cbf9da30eb88873f
BLAKE2b-256 checksum
How to use checksums
0e0bdac9fa02c546cdd88a259eb8e9753a29963d50340c3955ed38c0f55725a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / asciilint-0.4.0-py3-none-any.whl

Download URL asciilint-0.4.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04eb7f3b4f847180da0691fe5ccbdc96720634f2808230130d6df2089813ab14
BLAKE2b-256 checksum
How to use checksums
f0e8196e259a9a923afcd9cc93bac88f471346ec2cbaea008722778230c820a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.4.1

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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