Skip to main content

pasteglint

Find the character that makes copied text behave differently from what you see. Zero runtime dependencies. Python 3.10+. MIT licensed.

Install

python -m pip install pasteglint

For a local source checkout, run python -m pip install . in this directory.

Command line

pasteglint check snippet.py
pasteglint check snippet.py --json
pasteglint diff expected.txt actual.txt
pasteglint check -

An unexpected space might produce:

4:8 U+00A0 NO-BREAK SPACE [space]; possible replacement: ' '

Input files and standard input are UTF-8. A byte-order mark is kept and reported. Newline differences are preserved. A dash means standard input; only one input can use it at a time. All commands also work as python -m pasteglint.

Python

from pasteglint import inspect_text, compare_text

(finding,) = inspect_text("x\u00a0= 1")
assert finding.codepoint == "U+00A0"
assert (finding.line, finding.column) == (1, 2)

changes = compare_text("API_KEY", "\uff21PI_KEY")
assert changes[0].left == "A"
assert changes[0].right == "\uff21"

inspect_text(text) returns immutable Finding objects with index, line, column, codepoint, name, kind and an optional replacement. It reports selected unusual spaces, smart quotes, dashes, fullwidth ASCII, Unicode format characters, unusual controls, and Unicode line/paragraph separators.

compare_text(left, right) returns differing spans and their exact text. Spans are zero-based and end-exclusive. Lines and columns are one-based Unicode code-point positions, not byte offsets or rendered character widths.

Findings are observations: joiners, direction markers and curly punctuation can be legitimate. Nothing is changed automatically. This is a debugging utility, not a complete Unicode security scanner or programming-language parser. Exact diff can be slow on very large or repetitive files; use it for text snippets.

Exit codes

  • 0: no configured findings, or identical texts.
  • 1: findings or differences.
  • 2: invalid input, unreadable files, or invalid UTF-8.

Development

python -m pip install -e .
python -m unittest discover -s tests -v

Metadata

Release files for pasteglint 0.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 pasteglint 0.1.0
File Size Uploaded
pasteglint-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

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

Total release size: 11.4 kB

Release files / pasteglint-0.1.0.tar.gz

Download URL pasteglint-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0847d24f80353cfca14716d528ddba6d94e6ebd9b3f8da8845649ed8453a05e5
BLAKE2b-256 checksum
How to use checksums
860cc342f8a43b9c499a473971fccbe3c14b6c9c03fe9afae355387761fa05af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pasteglint-0.1.0-py3-none-any.whl

Download URL pasteglint-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aee011e9911e2a01078d271cf6efe97772daee7573f8462d62931e48e2b05ad1
BLAKE2b-256 checksum
How to use checksums
626f5436fa444c80c37caaf7c39973da1f3a1148bcea38be14e042caff795566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

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