Skip to content

Commit 7077355

Browse files
tobixenclaude
andcommitted
build: migrate from Poetry to Hatch
- Replace poetry-core + poetry-dynamic-versioning build backend with hatchling + hatch-vcs - Move dev dependencies from [tool.poetry.group.dev] to [project.optional-dependencies] dev group (install with pip install -e ".[dev]") - Add [tool.hatch.build.hooks.vcs] to generate plann/_version.py at install time - Set dynamic = ["version"] in [project] so hatch-vcs controls the version - Remove poetry.lock (no lock file with hatch) - Update CI workflows to use pip install -e ".[dev]" and python -m pytest/deptry - Update Makefile dev/test/lint targets accordingly - Add plann/_version.py to .gitignore (auto-generated, commit-specific) This fixes the broken versioning: pip show plann now reports the correct version from git tags instead of 0.0.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3cb38a1 commit 7077355

6 files changed

Lines changed: 37 additions & 2564 deletions

File tree

‎.github/workflows/publish.yaml‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,23 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818
with:
19-
fetch-depth: 0 # Fetch all history for poetry-dynamic-versioning
19+
fetch-depth: 0 # Fetch all history for hatch-vcs
2020

2121
- name: Set up Python ${{ matrix.python-version }}
2222
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525

2626
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install poetry
30-
poetry install --with dev
27+
run: pip install -e ".[dev]"
3128

3229
- name: Run Ruff linter
3330
uses: astral-sh/ruff-action@v3
3431
with:
3532
args: check .
3633

3734
- name: Run tests
38-
run: |
39-
poetry run pytest
35+
run: python -m pytest
4036

4137
publish:
4238
needs: test # Only publish if tests pass
@@ -50,27 +46,18 @@ jobs:
5046
- name: Checkout repository
5147
uses: actions/checkout@v4
5248
with:
53-
fetch-depth: 0 # Fetch all history for poetry-dynamic-versioning
49+
fetch-depth: 0 # Fetch all history for hatch-vcs
5450

5551
- name: Set up Python
5652
uses: actions/setup-python@v5
5753
with:
5854
python-version: '3.11'
5955

6056
- name: Install build tools
61-
run: |
62-
python -m pip install --upgrade pip
63-
pip install build
64-
65-
- name: Verify version from git tags
66-
run: |
67-
git describe --tags --long
68-
echo "Git tag detected above ^"
57+
run: pip install build hatch-vcs
6958

7059
- name: Build package
71-
run: |
72-
# Build using PEP 517 with poetry-dynamic-versioning backend
73-
python -m build --sdist --wheel
60+
run: python -m build --sdist --wheel
7461

7562
- name: Display built packages
7663
run: |

‎.github/workflows/tests.yaml‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ jobs:
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Fetch all history for hatch-vcs
2325

2426
- name: Set up Python ${{ matrix.python-version }}
2527
uses: actions/setup-python@v5
2628
with:
2729
python-version: ${{ matrix.python-version }}
2830

2931
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install poetry
33-
poetry install --with dev
32+
run: pip install -e ".[dev]"
3433

3534
- name: Run Ruff linter
3635
uses: astral-sh/ruff-action@v3
@@ -39,9 +38,7 @@ jobs:
3938

4039
- name: Check dependencies with deptry
4140
if: matrix.python-version != '3.9'
42-
run: |
43-
poetry run deptry .
41+
run: python -m deptry .
4442

4543
- name: Run tests
46-
run: |
47-
poetry run pytest
44+
run: python -m pytest

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ tmp/
5858
# OS
5959
.DS_Store
6060
Thumbs.db
61+
plann/_version.py

‎Makefile‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ help:
1616
@echo " make uninstall Uninstall plann"
1717
@echo ""
1818
@echo "Development:"
19-
@echo " make dev Install in development mode (Poetry)"
19+
@echo " make dev Install in development mode"
2020
@echo " make test Run tests"
2121
@echo " make lint Run linter"
2222
@echo " make clean Clean build artifacts"
@@ -56,17 +56,17 @@ uninstall:
5656
# Install in development mode
5757
dev:
5858
@echo "Installing in development mode..."
59-
@poetry install
59+
@PIP_BREAK_SYSTEM_PACKAGES=1 pip install -e ".[dev]"
6060
@echo ""
61-
@echo "Installed! Run: poetry run plann --help"
61+
@echo "Installed! Run: plann --help"
6262

6363
# Run tests
6464
test:
65-
@poetry run pytest tests/ -v
65+
@python -m pytest tests/ -v
6666

6767
# Run linter
6868
lint:
69-
@poetry run ruff check .
69+
@python -m ruff check .
7070

7171
# Clean build artifacts
7272
clean:
@@ -84,7 +84,7 @@ install-completion-user:
8484
@echo "Installing shell completion for current user..."
8585
@mkdir -p "$(COMPLETION_DIR_USER)"
8686
@_PLANN_COMPLETE=bash_source plann > "$(COMPLETION_DIR_USER)/plann" 2>/dev/null || \
87-
poetry run python -c "import click; from plann.cli import cli; print(click.shell_completion.get_completion_class('bash')(cli, {}, 'plann', '_PLANN_COMPLETE').source())" > "$(COMPLETION_DIR_USER)/plann"
87+
python -c "import click; from plann.cli import cli; print(click.shell_completion.get_completion_class('bash')(cli, {}, 'plann', '_PLANN_COMPLETE').source())" > "$(COMPLETION_DIR_USER)/plann"
8888
@echo "Completion script installed to $(COMPLETION_DIR_USER)/plann"
8989
@echo "Restart your shell or run: source $(COMPLETION_DIR_USER)/plann"
9090

0 commit comments

Comments
 (0)