Text Analyse
Analyse prose for readability, and source code for rough size and
complexity metrics. The library returns one result object. The
text-analyse command prints that result as a table.
The PyPI name is lupaxa-text-analyse. The import path is
lupaxa.text_analyse. The console script is text-analyse. lupaxa is
a namespace package — there is no lupaxa/__init__.py.
Public names: analyse, analyse_text, analyse_code, looks_like_code,
fetch_text, describe_flesch_score, reading_age_band,
TextAnalyseError, FetchError, __version__, get_version().
Install
pip install lupaxa-text-analyse
Requires Python 3.10 or newer, plus httpx, beautifulsoup4, and rich.
Library
from lupaxa.text_analyse import analyse, analyse_code, analyse_text, fetch_text
analyse("The cat sat on the mat.")
analyse(open("README.md", encoding="utf-8").read(), source="README.md")
analyse_code(open("script.py", encoding="utf-8").read())
fetch_text("https://example.com")
analyse uses mode="auto" unless you pass text or code. Pass
source as the file name when you have one. A documentation suffix
selects text mode, and a Markdown file is scored after fenced code,
HTML tags, and link URLs are removed. Text results include the
reading-age band, the Flesch description, and a language judgement.
Pass wpm to change the reading-time estimate.
fetch_text follows redirects, sends a text-analyse user-agent, and
refuses bodies over 2 MB. HTML pages drop navigation, headers, footers,
and sidebars. The article's headings, paragraphs, and list items become
the text, with a blank line between them.
Note: Readability scores are for continuous English prose. The syllable counter, sentence splitter, and code metrics are heuristics. Auto mode treats a sample as code when code symbols exceed 3% of the characters. Words such as "for" and "from" do not, on their own. An HTML page, or a Markdown, reStructuredText, or AsciiDoc file, is analysed as text. Markdown scores ignore fenced code, HTML, and link URLs. Pass
--mode codeto force code metrics.
CLI
The default format is a table. --format text prints the same figures
as aligned lines. --format json prints the result object.
text-analyse article.txt
text-analyse --url https://example.com
text-analyse --min-flesch 60 README.md
text-analyse docs/ --check --min-flesch 60
text-analyse --mode code script.py
cat notes.txt | text-analyse --wpm 180 --reading-age-scheme us
text-analyse --version
| Flag | Meaning |
|---|---|
path |
Files or documentation directories. Stdin when omitted. |
--file, -f |
File path. Do not combine with path or --url. |
--url, -u |
Fetch a URL. HTML is read as the article. |
--format, -F |
table (default), text, or json. |
--mode, -m |
auto (default), text, or code. |
--wpm |
Reading speed for the time estimate (default 200). |
--min-flesch |
Fail when the Flesch Reading Ease score is lower. |
--max-grade |
Fail when the Flesch–Kincaid grade is higher. |
--check |
Print only files that fail a readability threshold. |
--reading-age-scheme |
uk (default) or us. |
--version |
Print text-analyse x.y.z and exit 0. |
| Result | Exit |
|---|---|
| Report printed | 0 |
| Readability check failed | 1 |
| Empty input, bad path, or fetch | 1 |
| More than one input source | 1 |
| Readability check on code only | 2 |
--check without a threshold |
2 |
A single file is one metrics table. It includes the mode, the language
judgement, and the reading time at the chosen speed. Several files, or a
directory, print one row per file. A directory is walked for Markdown,
reStructuredText, AsciiDoc, and plain-text files. --check prints only
the rows that miss a threshold. Code reports for one file are a single
table with the mode, the line counts, and the file-level complexity heuristic.
Development
make init
make python-install-dev
make python-check
Metadata
Release files for lupaxa-text-analyse 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| lupaxa_text_analyse-0.1.0.tar.gz | 16.9 kB | With provenance | Details for lupaxa_text_analyse-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lupaxa_text_analyse-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lupaxa_text_analyse-0.1.0-py3-none-any.whl |
Total release size: 39.2 kB
Release files / lupaxa_text_analyse-0.1.0.tar.gz
| Download URL | lupaxa_text_analyse-0.1.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2f1245cd08ae0215caa93252ca3eb6e2e62169fe00c60329d0861ecd8c4c5a2
|
|
BLAKE2b-256 checksum How to use checksums |
0b88caf59d1ccbee3ba92a2b556c4801c5dcfe23c433484ffc86dabe87718ce2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logRelease files / lupaxa_text_analyse-0.1.0-py3-none-any.whl
| Download URL | lupaxa_text_analyse-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57ce30a86a1bbe1ca8d5d055db5088a24ed7def20401d2baba9ba06972d7012e
|
|
BLAKE2b-256 checksum How to use checksums |
fb9b2a3892c6acc3de5bcee2921fbc182eaa601f78291cc10fe92aea31f025ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logSecurity for lupaxa-text-analyse 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lupaxa_text_analyse-0.1.0.tar.gz
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 Nov 6, 2026.
Transparency logA 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.