Skip to content

2026.03.06: chore: fix scripts/upgrade.py to work with date versioning (#108)

Latest

Choose a tag to compare

@github-actions github-actions released this 06 Mar 20:16
· 1 commit to main since this release
6af5cf0
### what

- Rewrite `scripts/upgrade.py` to read/write the version from
  `stacklet/client/platform/__init__.py` instead of `pyproject.toml`
- Replace `--bump-patch/minor/major` flags with a single optional
  `VERSION` argument: omit for a patch bump, pass `today` for today's
  date as `YYYY.MM.DD`, or pass an explicit `YYYY.MM.DD`; the latter two
  error if the result is not strictly greater than the current version
- Fix patch bump to preserve zero-padding (e.g. `06` → `07`, not `7`)
- Drop `semver` and `toml` imports in favour of stdlib `re` and
  `datetime`
- Update `just pkg-prep` to match: accepts an optional `version`
  argument (default empty = patch bump) and stages
  `stacklet/client/platform/__init__.py` instead of `pyproject.toml`
- Add unit tests for all three modes and error cases

### why

`upgrade.py` was already broken after the switch to dynamic versioning
(`dynamic = ["version"]` in `pyproject.toml`, sourced from
`__init__.py`): it attempted to read and write a `version` key that no
longer exists in `pyproject.toml`. The script also had no concept of the
date-based version scheme (`YYYY.MM.DD`) introduced with the `2026.01.0`
release.

### testing

12 unit tests covering patch bump, `today`, explicit `YYYY.MM.DD`, and
all error cases (non-bump, invalid format). All passing.

### docs

No docs changes needed.

---------------------------

🤖 Generated with [Claude Code](https://claude.com/claude-code)