derive version from git tags via hatch-vcs#119
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supercedes #118