sprezzature-accessibility
🇫🇷 LISEZMOI.md · 🇬🇧 README.md
A web page is accessible when someone using a screen reader, a keyboard alone (no
mouse), or a browser's reduced-motion setting can still use it. This tool checks HTML
source code for the mistakes that most often break that: an <img> with no alt text
is as invisible to a screen reader as if the image were simply missing from the page.
It is a static linter: twenty rules from WCAG (Web Content Accessibility
Guidelines, the W3C standard that defines what "accessible" means for the web) and
WAI-ARIA (the attribute vocabulary, role, aria-label and the like, that lets custom
widgets describe themselves to assistive software), each one decidable by reading the
HTML text alone. No browser opens, no page renders, no JavaScript runs, so there is no
DOM (the tree of elements a browser builds while rendering a page) to inspect and
nothing to install beyond Python itself. That is what makes it fast enough for a
pre-commit hook or a CI step: a deterministic gate before any change lands in
production.
The violations it covers account for the bulk of real-world accessibility failures:
missing alt text, unlabelled inputs, empty buttons, clickable <div>s a keyboard
cannot reach, dialogs with no way to close them by keyboard, missing lang attributes
(which break screen-reader pronunciation), heading levels that jump around instead of
nesting in order, status shown by color alone (a red/green pair that a colorblind
reader cannot tell apart), and animations with no way to turn them down for someone
sensitive to motion, and negative letter-spacing on running text (which slows
reading for dyslexic readers). Six of those twenty rules also ship a mechanical
auto-fix (--fix), so the gate can repair what it safely can instead of only
reporting it.
This tool only ever reads source code, so it cannot catch what only shows up once a page actually renders in a browser: keyboard focus order, screen-reader announcement timing, color contrast against a real background. Pair it with axe-core, Pa11y, or Lighthouse, which drive a real browser, for that layer. The two are complementary, not interchangeable: this one is the fast, no-browser first gate; those are the slower, browser-accurate second pass.
Features
- 20 rules covering img, a, button, div/span, input, dialog, html, tabindex, aria, heading order, color-only state, motion-reduce guards, body-text letter-spacing, and time-based media: video captions, audio transcripts, unmuted autoplay, keyboard controls, and caption-track language
- Auto-fix for 6 rules: lang detection + insertion, redundant aria removal, tabindex demotion, aria-hidden strip, motion-reduce guard append, tight-tracking strip
text_spacing_preset.py: the make-side counterpart to the letter-spacing rule — emits an opt-in "comfortable reading" CSS block at the WCAG 1.4.12 Text Spacing minimums, for pages that want to ship the fix as a reader-facing toggle- Text and JSON output formats, composable with jq or any CI parser
- Exit code 1 on any finding (exit 0 on clean), suitable as a pre-commit gate
- Stdlib only at runtime: Python 3.10+, no pip install required for the core
- Optional
langdetectfor thehtml-missing-langauto-fixer (language detection)
Quick start
# Lint a single page
sprezzature-accessibility-lint public/index.html
# Lint a directory recursively, exit 1 on any finding
sprezzature-accessibility-lint public/
# JSON output for CI pipeline consumption
sprezzature-accessibility-lint --format json public/index.html
# Suppress two rules
sprezzature-accessibility-lint --ignore heading-skip,motion-no-reduce-guard public/
# Auto-fix what can be fixed mechanically
sprezzature-accessibility-lint --fix public/
# Preview what --fix would change, without writing
sprezzature-accessibility-lint --fix --dry-run public/
Install
pip install sprezzature-accessibility
# With language detection for the html-missing-lang fixer:
pip install "sprezzature-accessibility[lang]"
Or run directly without install:
sprezzature-accessibility-lint public/
Rules
| Rule | Severity | Description |
|---|---|---|
img-missing-alt |
error | <img> without alt attribute |
img-redundant-aria |
warning | alt="" with redundant role/aria-hidden |
a-missing-href |
error | <a> without href (use <button>) |
a-empty |
error | <a> with no accessible name |
button-empty |
error | <button> with no accessible name |
div-onclick |
error | onclick div/span without role+tabindex |
input-missing-label |
error | <input> without associated label |
dialog-missing-close |
error | <dialog> without close affordance |
html-missing-lang |
error | <html> without lang attribute |
tabindex-positive |
error | tabindex >= 1 breaks DOM order |
aria-hidden-interactive |
error | aria-hidden on interactive element |
heading-skip |
error | headings skip levels downward |
color-only-state |
warning | red/green token with no icon or text |
motion-no-reduce-guard |
warning | animation without motion-reduce peer |
video-missing-captions |
error | <video> with audio and no <track kind="captions"> (WCAG 1.2.2) |
audio-missing-transcript |
error | <audio> with no text alternative (WCAG 1.2.1) |
track-missing-srclang |
warning | <track> without srclang: caption language unknown |
media-missing-controls |
error | <video>/<audio> with nothing to operate from the keyboard (WCAG 2.1.1) |
media-autoplay-sound |
error | unmuted autoplay masks a screen reader (WCAG 1.4.2) |
License
BSD-3-Clause. Copyright 2026 Warith HARCHAOUI.
Metadata
Release files for sprezzature-accessibility 1.0.3
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 |
|---|---|---|---|---|
| sprezzature_accessibility-1.0.3.tar.gz | 45.7 kB | Without provenance | Details for sprezzature_accessibility-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sprezzature_accessibility-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for sprezzature_accessibility-1.0.3-py3-none-any.whl |
Total release size: 81.2 kB
Release files / sprezzature_accessibility-1.0.3.tar.gz
| Download URL | sprezzature_accessibility-1.0.3.tar.gz |
|---|---|
| Size | 45.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8c2daebe427c2df6c754ec437b01d4bcc51cbb10cdc2dd679a08a61bba8862d
|
|
BLAKE2b-256 checksum How to use checksums |
4485bc6a95af9f945ea5a28957183e9a67143622cf67e69e1ecfd1843ee372dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / sprezzature_accessibility-1.0.3-py3-none-any.whl
| Download URL | sprezzature_accessibility-1.0.3-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
938ead57a2be3f0067bfa719c7a45b8d22275c5c3ae187349396d78dc68f5cec
|
|
BLAKE2b-256 checksum How to use checksums |
b9ec0c73fb651f24a2126694dcf299f95e97166ff98a84c89af6a14f431fc276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for sprezzature-accessibility 1.0.3
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.