feature:upgrade
Table of contents
- Introduction
- Previewing the plan
- Upgrading some features
- Pinning an editable feature
- How the plan is made
- Keeping the migration history
- What applying changes
- Reference
- Requirements
- See also
Introduction
feature:upgrade moves your product’s features to the newest versions that install together and that the features’ contracts accept. pip makes the plan, a version that would rewrite a feature’s migration history is refused, the planned product is validated before anything changes, and applying changes only the pins.
splent feature:upgrade
feature:upgrade my_product
Feature Pinned Planned
notes v1.6.2 v1.18.0 upgrade, adds 1 migration
shop v1.0.2 v1.5.0 upgrade
Migrations db:upgrade will apply
notes notes0002_visibility Add visibility to notes (private unless the product says otherwise).
Upgrade 2 features as planned? [y/N]: y
Validating the planned product
the whole plan validates
Applying
pin notes v1.6.2 to v1.18.0
pin shop v1.0.2 to v1.5.0
...
Next steps
splent product:derive installs the new versions and restarts the product
splent db:upgrade applies the 1 new migration listed above
Previewing the plan
splent feature:upgrade --dry-run
It prints the plan and writes nothing. In CI, pass --yes instead to skip the prompt.
Upgrading some features
splent feature:upgrade notes shop
The rest stay at their pins. A name can be notes, splent_feature_notes or splent-io/splent_feature_notes.
Pinning an editable feature
splent feature:upgrade reports
A whole-product upgrade leaves editable features alone, so name one to pin it. The copy must be a git checkout with the release tag and nothing after it, committed or not.
Not upgraded
reports the editable copy has 2 commits after v0.3.0 that no release has. Pinning it to v0.3.0 would drop them, so it stays editable. Release them first with splent feature:release.
How the plan is made
pip resolves without installing anything. It gets the upgraded features at or above their pins, the rest at their pins, your framework range and the newest splent_cli, as the production image installs it.
A feature’s newest version is its newest tag on the forge. When PyPI serves that version, pip gets the package. When it does not, pip gets the dependencies that tag declares instead, read from the forge, so the version is checked all the same: development installs tags, and product:build falls back to the tag for a version PyPI lacks.
| Case | What the plan does |
|---|---|
| A tag PyPI does not serve | Takes it, checked through its dependencies, with a note |
| A tag that does not install with the rest | Tries the older ones, up to three, and else keeps the pin with what pip said |
| A version on PyPI the forge has not tagged | Refuses it |
| A pin PyPI does not serve | Checks it through its tag’s dependencies |
| A feature pinned differently in two lists | Leaves it alone until the pins agree |
With --pypi-only the plan takes only what PyPI serves, as it did before: a newer tag is reported, and a feature PyPI does not serve is left as it is.
What the contracts require
A contract may require a version of another feature, as in features = ["auth>=1.23.0"]. Every version the plan takes must meet the requirements of the other features at their planned versions. An upgrade that needs more than the plan has, or that another feature does not accept, stays at its pin and the plan says which requirement held it.
Keeping the migration history
The new version must ship every migration of the pinned one, each with the same parent. Otherwise it is refused and stays at its pin, since your database would point at history the new code lacks.
Read the migrations the plan lists before you run db:upgrade. Some need a decision from the product first (see A migration that needs a decision).
What applying changes
The new versions are cloned into .splent_cache, then only the pins in pyproject.toml change, with comments and layout kept. The links in features/<namespace>/ move, recorded as declared. If a release cannot be fetched, nothing changes.
Before that, the planned pyproject.toml goes through every phase of product:validate, with --pyproject, which reads the new versions from the cache and writes nothing.
| The planned product | What happens |
|---|---|
| Validates | Every upgrade is applied |
| Does not validate, and the product as it is does | As many upgrades are kept as validate together, trying them in halves in the dependency order, the way product:upgrade does. The others are listed with what product:validate said |
| Does not validate, and neither does the product as it is | Nothing changes. Fix what product:validate reports first |
On success the product’s CI workflows follow the new pins (see Keeping the workflows in step).
To prove an upgrade on the running product, with its migrations and its tests, use product:upgrade.
Reference
| Argument / Option | Description |
|---|---|
FEATURE |
Optional, one or more. Upgrade only these |
--dry-run |
Print the plan and change nothing |
--yes |
Skip the confirmation prompt |
--pypi-only |
Take only versions PyPI serves |
It exits 1 when pip cannot resolve the set, applying fails, a feature was refused or an upgrade did not validate. A dry run exits 0 unless pip cannot resolve.
| Message | What to do |
|---|---|
pip could not resolve the set. |
Read pip’s explanation |
'<name>' is not declared in this product. |
Check the name |
pip is not installed in the Python the CLI runs on ... |
Run python -m ensurepip |
The forge rate limit stopped the check of <repo> (HTTP 403). |
Set SPLENT_FORGE_TOKEN |
Could not check 1 feature on PyPI (cache, HTTP 429). |
Run again later |
Nothing in the product was changed. |
Fix what the line above says |
Requirements
- A selected product (
SPLENT_APP). - pip in the Python the CLI runs on.
SPLENT_FORGE_TOKEN(orGITHUB_TOKEN) raises the forge’s rate limit.
See also
feature:outdatedshows which pinned features have newer tags.feature:attachpins a specific version.db:upgradeapplies the migrations the plan listed.