Skip to content

derive version from git tags via hatch-vcs#119

Merged
tobixen merged 5 commits into
masterfrom
feat/hatch-vcs-versioning
Jun 26, 2026
Merged

derive version from git tags via hatch-vcs#119
tobixen merged 5 commits into
masterfrom
feat/hatch-vcs-versioning

Conversation

@tobixen

@tobixen tobixen commented Jun 25, 2026

Copy link
Copy Markdown
Member

Supercedes #118

tobixen and others added 5 commits June 25, 2026 06:25
Migrate packaging from setup.py to a PEP 621 pyproject.toml using the
hatchling build backend with hatch-vcs, so the version is derived from
git tags instead of being hardcoded.

Addresses one of the root cause behind
#117: the version in
calendar_cli/metadata.py had drifted from the real releases (stuck at
1.0.1 while PyPI shipped 1.0.2).

- Add pyproject.toml (hatchling + hatch-vcs); version-file
  calendar_cli/_version.py, console-script entry point 'calendar-cli'.
- Drop the hardcoded 'version' key from calendar_cli/metadata.py.
- legacy.py: resolve __version__ from importlib.metadata, falling back
  to _version.py and then 'unknown' for bare source checkouts.
- Remove setup.py; gitignore the generated _version.py and editor backups.
- Exclude editor backup files (*~, #*#, ...) from built artifacts.

Prompt: Have a look into #117 (...) we should use autoversioning and hatch

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Round out the project modernization on top of the hatch-vcs migration:

- pyproject.toml: scope ruff to real-error lint rules (legacy/LTS code, so
  no wholesale reformat), add pytest config and a 'dev' optional-deps extra.
- GitHub Actions: tests.yml (ruff + pytest across Python 3.9-3.14),
  publish.yml (PyPI trusted publishing on v* tags), linkcheck.yml (lychee).
- Extend .pre-commit-config.yaml (keeping ai-prompt-auto-commit): ruff lint,
  standard hygiene hooks, conventional-commit check, and pre-push pytest /
  link-check / no-push-to-master. lychee.toml for link-check config.
- Add Makefile (make install/dev/lint/test) and CONTRIBUTING.md; point the
  README install instructions at 'make install' instead of the removed
  setup.py.
- Add CHANGELOG.md (Keep a Changelog).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

AI Prompts:
claude-sonnet-4-6: Continue with the other stuff from my python modernization skill - CHANGELOG, auto-publish, etc.
The --interactive-config code path was broken on Python 3: it called the
removed Python 2 'raw_input' builtin and referenced 'os', 'time' and
'getpass' without importing them, so it crashed immediately.

Import os/time/getpass, switch raw_input -> input, and add a regression
test exercising the save path (the function previously had none and
carried an 'untested code ahead' warning).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Apply ruff's safe fixes to the legacy modules: remove unused imports
(time, json, getpass in legacy.py; datetime in template.py; pytest and
datetime in the test) and mark the COUNT regex literals as raw strings to
silence invalid-escape-sequence warnings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The shell integration harness (test_calendar-cli.sh) no longer worked out
of the box:

- Radicale rejected the hard-coded testuser/password1 because it was
  started without an auth backend; configure htpasswd auth so the tests
  authenticate (radicale's defaults deny anonymous access).
- Servers were launched via "sh -c '... &'", so $! was the wrapper shell
  and the later kill orphaned the actual server, leaving it holding its
  port and breaking the next run. Launch them directly and add an EXIT
  trap that always tears them down.
- The xandikos branch invoked ../bin/calendar-cli without PYTHONPATH, which
  now fails with ModuleNotFoundError (no setup.py installs the package into
  the source tree anymore); set PYTHONPATH like the radicale branch.
- _setup_alias: prefer the installed 'calendar-cli' console script, and
  make the source-tree fallback self-contained by setting PYTHONPATH.

The radicale path now runs the full tests.sh suite to completion. Xandikos
remains functionally incompatible (already noted in the tests README).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

AI Prompts:
claude-sonnet-4-6: Create an issue for the "out of scope"-task
claude-sonnet-4-6: post it against pycalendar/calendar-cli
claude-sonnet-4-6: Please look through the test script for integration testing, does it still work?
claude-sonnet-4-6: please fix things
claude-sonnet-4-6: retry
@tobixen tobixen merged commit 7200545 into master Jun 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant