Warming up the neural circuits...
By the end of this chapter you will:
Many teams can build packages. Fewer teams can release safely and repeatedly.
Most release incidents happen because engineering discipline is missing:
Release engineering turns "it works on my machine" into reliable product delivery.
Version meaning:
If behavior changes contract expectations for users, treat it as a major boundary.
A practical changelog entry should include:
No release should be tag-only without human-readable notes.
Recommended pre-publish gate:
twine check Only publish if all gates pass.
Trusted publishing reduces secret sprawl by issuing short-lived credentials tied to CI identity and repository policy.
Benefits:
Minimal response playbook:
Do not improvise during incident pressure.
A release is not done when upload succeeds. It is done when users can safely install, run, and recover from failure scenarios.
| Situation | Decision |
|---|---|
| Bug fix with no API change | PATCH |
| New backward-compatible capability | MINOR |
| Breaking behavior or API contract | MAJOR |
| Critical post-release regression | Hotfix patch with incident note |
| Mistake | Why it hurts | Better move |
|---|---|---|
| Version bumps without policy | User confusion and upgrade risk | Enforce semver rules in review |
| Publishing from local laptop manually | Inconsistent and unaudited path | Publish through CI workflow |
| Skipping artifact check | Broken installs on user side | Always run twine check |
| No install smoke test | Runtime surprises post publish | Test install in clean env |
| Missing rollback plan | Slow incident recovery | Keep hotfix/rollback runbook ready |
API rename, bug fix, optional feature additionCorrect semver mapping with reasonsTest, lint, type, build, publish flowOrdered checklist with clear pass gates"updated stuff" style noteClear change summary, impact, migration noteShared CI environmentTrusted publishing rationaleProduction users failing after updateRollback and communication sequenceBeginner:
"How do you decide patch versus minor release?"
Patch is for backward-compatible bug fixes. Minor is for backward-compatible new features.
"Why should release notes include migration guidance?"
It reduces upgrade risk and support load by telling users exactly what action is required.
Senior:
"What is the strongest control to prevent bad package releases?"
Enforced CI release gates plus trusted publishing and clean-environment install verification.
"How do you design for safe rollback in package ecosystems where unpublish is restricted?"
Use rapid hotfix patch releases, clear version advisories, and compatibility guards in consumers.
Fix only? -> patch
Backward-compatible feature? -> minor
Breaking contract? -> major
Safe publish? -> CI gates + trusted publishingA backward-compatible new feature should usually trigger which semver bump?