Skip to main content

sprezzature-ui

Français

The deterministic half of a frontend skill: find the strings that should be in a translation catalogue, and scaffold the catalogue they belong in, compiled to JSON (JavaScript Object Notation, a text format in which programs store data as named fields, like {"year": 2026}).

The other half is writing the interface: semantic HTML, Tailwind utilities and plain ES (ECMAScript, the official name of JavaScript; its modules are the import lines a browser runs as is) modules, no framework runtime, with dark-mode peers, focus rings and reduced-motion guards. That half is the model's work, guided by the SKILL.md that ships inside this package and by the prose in its references/. No route over HTTP (HyperText Transfer Protocol, the language a browser speaks to fetch a page) can carry "make this dashboard legible", and this package does not pretend otherwise.


How it works

Flow diagram. At the top, your source tree feeds two lanes. The left lane audits: it walks the tree, finds translation tables embedded in JavaScript and HTML and prompt constants inlined in Python, and returns findings with exit code 1. The right lane makes: it scaffolds a single locales file, compiles it to JSON and emits the two loaders that read it, one for the browser and one for Python. Both meet in one outcome, an interface that can take a second language the day it is asked for.

What's here

Command What it does
sprezzature-ui-i18n-audit audit. Finds translation tables embedded in JavaScript or HTML (rule I18N001) and LLM (large language model, an AI that reads and writes text, like the one behind ChatGPT) prompts inlined in Python (rule I18N002). Both belong in locales/i18n.yaml. With --fix, moves what it can read into that catalogue. The audit itself imports only the standard library.
sprezzature-ui-i18n-make make. Scaffolds locales/i18n.yaml, compiles it to locales/i18n.json, and emits two loaders: locales/i18n.js for the browser and locales/i18n_prompts.py for Python.
sprezzature-ui-skill skill. Says whether the copy of this package's skill that an agent reads is in step with the one pip installed; --install copies it into ~/.claude/skills/sprezzature-ui (--agent opencode for ~/.opencode/skills), --path prints where it sits.

One front door over both, written in click, under two names: make-ui <tool> and sprezzature-ui <tool> are the same callable, so they cannot drift. sprezzature-ui tools lists the tools and says whether each can run on this machine. The argparse front door was removed on 2026-10-25, and since 2026-11-04 no command parses with argparse: the per-tool commands and sprezzature-ui-mcp are click too, and -V (or --version) prints the package version, on the front door as on both tools and on sprezzature-ui-mcp. sprezzature-ui skill is the same command as sprezzature-ui-skill, one sub-command away; sprezzature-ui tools does not list it, because it is not one of the two i18n tools. Each tool keeps its own command, which is what a script or a pre-commit hook should call.

Five surfaces

Surface Entry point What it exposes
Library from sprezzature_ui import … audit_js, audit_py, audit_path, gather, scaffold, compile_json, emit_loader, emit_python, and skill_path(), the folder of the shipped skill
CLI (command-line interface, a program you run by typing a command in a terminal), in click sprezzature-ui, make-ui, sprezzature-ui-i18n-audit, sprezzature-ui-i18n-make, sprezzature-ui-skill both tools, and the skill check
HTTP API (application programming interface, the routes a program calls), in FastAPI uvicorn sprezzature_ui.api:app, or the Dockerfile and docker-compose.yml (which also serve /mcp) GET /health, POST /v1/i18n-audit
MCP (Model Context Protocol, the protocol through which AI agents call tools in English), through fastapi-mcp sprezzature-ui-mcp tools health and audit_i18n, at /mcp
Skill sprezzature_ui/skill/, inside the package; sprezzature-ui-skill --install puts it where the agent reads SKILL.md, its references/ and assets/: the design prose, plus the two commands

Only the audit crosses a network boundary. The make tool writes files into a project, so it has no route and no MCP tool.

Why it matters sooner than it seems

A hardcoded sentence in a template costs nothing on the day it is written. It costs a week the day somebody needs a second language and discovers the strings are scattered through the source: in JavaScript string literals, in inline scripts, in prompt templates buried in Python. The audit is cheap enough to put in a pre-commit hook, which is where it catches them one at a time instead of all at once.

Install

pip install sprezzature-ui

One line installs every surface: the audit, the catalogue tools (PyYAML), the click front door, the HTTP app, the MCP server and the skill. There are no feature extras. [dev] holds only the test toolchain.

Use

sprezzature-ui-i18n-audit src/                 # exit 1 on any finding
sprezzature-ui-i18n-audit src/ --json          # findings as a JSON array
sprezzature-ui-i18n-audit src/ --fix           # move strings into locales/i18n.yaml
sprezzature-ui-i18n-make                       # scaffold, compile, emit both loaders
sprezzature-ui-i18n-make --dir ../my-project --compile

sprezzature-ui-i18n-audit takes files and directories. Directories are walked recursively, skipping node_modules, .git, __pycache__, dist, build, vendor and .venv, below the directory you name: a project that itself lives under a build/ folder is still read. A path that does not exist is a usage error (exit 2), not a clean result. --catalog PATH changes the catalogue --fix writes to.

--fix writes the catalogue and prints, for each string it moved, the call to paste in its place. It does not rewrite the call site, and it still exits 1, because the strings are still in the code until the author replaces them. A string with no message id of its own is filed under <file>.line<N>. A locale whose value it cannot read (a plural object, a value built by code) is named in the output, for a hand to move.

sprezzature-ui-i18n-make runs four steps by default. --init, --compile, --emit-loader and --emit-python each run one step alone. --dir points at the project root; the catalogue is always <dir>/locales/i18n.yaml. The compile step refuses a prompt that declares no validated: locale, one that names a locale absent from locales:, or one with no text in it.

As a pre-commit hook

repos:
  - repo: https://github.com/warith-harchaoui/sprezzature-ui
    rev: v1.3.0
    hooks:
      - id: sprezzature-ui-i18n-audit

The hook runs on the files the audit reads: .js, .mjs, .cjs, .jsx, .ts, .tsx, .html, .htm and .py.

From Python

from sprezzature_ui import audit_path, gather

for file in gather(["src/"]):
    for finding in audit_path(file):
        print(finding["rule"], finding["path"], finding["line"])

gather walks the tree and drops what is not auditable; audit_path reads one pathlib.Path. They are separate because a pre-commit hook already knows which files changed and should not pay for a walk. Each finding is a dict with rule, severity, path, line, message and snippet.

Over HTTP

uvicorn sprezzature_ui.api:app --port 8000
curl -s localhost:8000/health
curl -s localhost:8000/v1/i18n-audit -H 'Content-Type: application/json' \
  -d '{"source": "const i18n = { en: \"Save\", fr: \"Enregistrer\" };", "filename": "app.js"}'

POST /v1/i18n-audit takes source (the file's text) and filename (default app.js, whose extension decides which rule runs). It returns findings_total and findings, with your filename in each path. The name is only reported back: it never becomes a path on the server. GET /health returns the status and the version. / redirects to /docs.

Over MCP

sprezzature-ui-mcp                       # 127.0.0.1:8000
sprezzature-ui-mcp --host 0.0.0.0 --port 9000

It serves the same FastAPI app with the MCP endpoint mounted at /mcp. The tool names are the routes' operation_id: health and audit_i18n. SPREZZATURE_UI_HOST and SPREZZATURE_UI_PORT set the defaults.

As a skill

sprezzature-ui-skill                          # is the installed copy in step?
sprezzature-ui-skill --install                # copy it into ~/.claude/skills/sprezzature-ui
sprezzature-ui-skill --install --agent opencode   # ~/.opencode/skills instead
sprezzature-ui-skill --path                   # where pip put it

The skill is the folder an agent reads: SKILL.md, its references/ and its assets/, under sprezzature_ui/skill/ in the installed package (sprezzature_ui.skill_path() returns it). Without --install the command only reports: in step, or which file differs, or how many do. With it, a previous copy is moved to ~/.claude/skills-superseded/ before the new one is written, so it is never read as a second skill. sprezzature-ui skill is the same command.

In containers

docker compose up -d
curl -s localhost:8000/health
docker compose run --rm api make-ui i18n-audit /work/src

The image serves the HTTP routes and the MCP endpoint on port 8000, from one process: its default command is sprezzature-ui-mcp --host 0.0.0.0, so /v1/... and /mcp both answer. Compose mounts ./work at /work, so the source to audit and the catalogue written beside it stay on the host.

What the audit sees

Rule Files What fires
I18N001 .js, .mjs, .cjs, .jsx, .ts, .tsx, .html, .htm a line declaring a table under a telltale name (const i18n = {, translations, messages, locales, strings, dictionary, lang, …), or an object literal with two or more locale keys ({ en: …, fr: … })
I18N002 .py a module-level or class-level constant whose name contains PROMPT or INSTRUCTION, assigned a string literal or an f-string

It reads JavaScript and HTML line by line, and Python through its AST (abstract syntax tree, the code split into its parts: this is a function, this is a string). It cannot tell whether a translation is good, or whether a string is user-facing at all. "0 findings" means that neither shape was found, not that the interface is ready to ship.

The design half

sprezzature_ui/skill/references/ holds the prose the skill reads: the Tailwind and vanilla-JS stack, the checklist, anti-patterns, dashboards, charts in SVG (Scalable Vector Graphics, a picture written as text that stays sharp at any zoom), colour psychology, a Material Design mapping, and platform guidelines under references/ui-guidelines/. sprezzature_ui/skill/assets/ holds a starter page, seven HTML components, two SVG charts, eight snippets indexed by a Law of UX (user experience, how an interface feels to use: whether you find the button, or give up) in assets/snippets/INDEX.md, and the three Roboto families under assets/fonts/.

The default typography is the three-Roboto rule: Roboto for the interface and body, Roboto Serif for long-form text, Roboto Mono for code. All three are self-hosted. The Python wheel carries all of it, inside the skill folder. The references/ and assets/ folders at the root of this repository hold the same files for a reader of the repository.

The boundary, said plainly

This package is small, and it will stay small. Its job is the aesthetic judgement written in prose (the three-Roboto rule, the design tokens, what an interface has to respect) plus the part of that judgement which can be mechanised. The i18n audit is that part. Adding routes to raise the count would be mistaking breadth for value.

See also

License

The three-clause BSD (Berkeley Software Distribution, a licence that lets anyone copy, change and sell the code as long as the copyright line stays) licence, BSD-3-Clause. See LICENSE.

Author

Warith HARCHAOUI, Ph.D.

Metadata

Release files for sprezzature-ui 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sprezzature-ui 1.3.1
File Size Uploaded Provenance Actions
sprezzature_ui-1.3.1.tar.gz 500.4 kB Without provenance Details for sprezzature_ui-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sprezzature-ui 1.3.1
File Interpreter ABI Platform Actions
sprezzature_ui-1.3.1-py3-none-any.whl Python 3 none any Details for sprezzature_ui-1.3.1-py3-none-any.whl

Total release size: 999.2 kB

Release files / sprezzature_ui-1.3.1.tar.gz

Download URL sprezzature_ui-1.3.1.tar.gz
Size 500.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a8730bb9506c5ff6e4bd3756a392fbc1ed08d68ada3668aa227b253ff96a164a
BLAKE2b-256 checksum
How to use checksums
a6c5d65571dc79f6d868a0479e8ff120c38a73cdd24256aee23c4e0b8a31d17a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / sprezzature_ui-1.3.1-py3-none-any.whl

Download URL sprezzature_ui-1.3.1-py3-none-any.whl
Size 498.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff15784395ef2fa4aa8f5e9e217e491d3a524a00d5556875b4cf74ce8b0462d
BLAKE2b-256 checksum
How to use checksums
f2ac701db3935b4f54877bdf6a6189a110eeb3cc42f4434106fc0b0d80a645f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for sprezzature-ui 1.3.1

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.

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