check:product
Table of contents
- Introduction
- Fixing a missing env var
- Fixing a broken static link
- Refreshing stale contracts
- Reference
Introduction
check:product checks how the features of your selected product fit together. It looks at the static links of your templates, the environment variables the features need, the feature links, the configuration keys one feature overwrites in another, and the blueprints. It only reads, so it is safe in CI.
splent check:product
check:product — my_first_app
Static links
All static links in the product templates resolve.
Env Vars
Variable Feature(s) Source Status
------------------------------ ------------------------- -------------- ----------
MAIL_DEFAULT_SENDER mailer, mailcatcher docker/.env ✔
MAIL_HOST mailer inject_config ✔
REDIS_URL cache, sessions_in_cache docker/.env ✔
Symlinks
Feature Status
------------------------- ----------
notes@v1.5.3 ✔
mailer ✔
Config Overwrites
Key Set by Overwritten by
------------------------- ------------------------- -------------------------
MAIL_HOST mailer mailcatcher
MAIL_PORT mailer mailcatcher
Blueprints
Blueprint Feature
-------------------- -------------------------
mailer mailer
notes notes
4 passed, 2 warnings
A failure exits 1. splent doctor runs it in its Product section.
Fixing a missing env var
A variable a feature’s contract declares in requires.env_vars must be set in docker/.env, or put in app.config by a feature’s inject_config. Otherwise its row reads ✖ missing, and the run fails.
splent product:env --merge --dev
That merges the features’ variables into docker/.env. You can instead give the feature a config.py with inject_config(app), which feature:inject-config writes from the os.getenv() calls in its source.
Fixing a broken static link
It searches your product’s own templates (.html, .j2, .jinja or .jinja2 under src/<product>/templates/) for url_for('static', filename='...') with a literal file name. A file missing from src/<product>/static/ is a warning, with the fix.
Static links
⚠ templates/400.html line 10 links static/img/icons/icon-250x250.png, which does not exist.
Replace that line with <link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}">
For an icon link the fix points at the first of favicon.svg, favicon.ico, favicon-32.png and favicon.png in static/. Any other link is told to add the file or point at one that exists.
A name built while the template renders ('img/' ~ name) is not checked, and neither are the features’ templates. This check runs first, so a product with no features gets it too.
Refreshing stale contracts
Before it reads the contracts, it lists each editable feature whose .py or .html files are newer than its pyproject.toml.
⚠ 1 feature(s) with potentially stale contracts:
- splent_feature_notes
Run: splent feature:contract <feature> --write
It never rewrites a contract itself. Pinned features are served from their snapshot and are not checked.
Reference
| Section | What it shows | Counts as |
|---|---|---|
| Static links | Template links to a file static/ lacks |
Warning each |
| Env Vars | Each variable the contracts require, with its source, docker/.env or inject_config, or a dash when it is set nowhere |
Failure each missing one |
| Config Keys | The app.config keys the contracts list in requires.config_keys, as ✔ set or · the feature's default |
Nothing |
| Symlinks | Each link in <product>/features/, as ✔, ✖ broken or not linked |
Failure each broken one |
| Config Overwrites | Each key one feature set and another overwrote | Warning each |
| Blueprints | The blueprints the app registered, and their features | Nothing |
Features that need the same variable share one row. A feature pyproject.toml that cannot be parsed is a failure, and the other features are still checked. Without docker/.env the env vars are not checked and it warns. When the app cannot be built, the last two sections warn Could not boot app and are skipped.
It needs a selected product (SPLENT_APP), and checks the features of the current SPLENT_ENV, features_dev when it is unset. splent product:resolve links a feature that is not linked.
See check:features for the health of each feature.