Skip to content

Commit a44eca6

Browse files
Merge pull request #5 from mirumee/chore/replace-hatch-with-uv
build(ci): use uv for dev and CI; add justfile
2 parents 9f23e8c + e999e3e commit a44eca6

6 files changed

Lines changed: 112 additions & 49 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ jobs:
2424
- name: Checkout source code
2525
uses: actions/checkout@v4
2626

27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
2732
- name: Set up Python 3.10
2833
uses: actions/setup-python@v5
2934
with:
3035
python-version: "3.10"
3136

32-
- name: Install Hatch
33-
run: pipx install hatch
34-
35-
- name: Set package version from tag
36-
run: hatch version "$(git describe --tags --always)"
37+
- name: Set package version from git
38+
run: |
39+
VERSION=$(git describe --tags --always)
40+
printf '__version__ = "%s" # Set by CI from git describe.\n' "$VERSION" > ariadne_lambda/__about__.py
3741
3842
- name: Build package
39-
run: hatch build
43+
run: uv build
4044

4145
- name: Store the distribution packages
4246
uses: actions/upload-artifact@v4

.github/workflows/test.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,24 @@ jobs:
3030
- name: Checkout source code
3131
uses: actions/checkout@v4
3232

33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v5
35+
with:
36+
enable-cache: true
37+
3338
- name: Set up Python ${{ matrix.python-version }}
3439
uses: actions/setup-python@v5
3540
with:
3641
python-version: ${{ matrix.python-version }}
3742

38-
- name: Install Hatch
39-
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
43+
- name: Install dependencies
44+
run: uv sync --all-extras
4045

4146
- name: Run static analysis
42-
run: hatch run lint
47+
run: |
48+
uv run ruff format --check ariadne_lambda tests
49+
uv run ruff check ariadne_lambda tests
50+
uv run ty check
4351
44-
- name: Run tests
45-
run: hatch test -c -py ${{ matrix.python-version }}
52+
- name: Run tests with coverage
53+
run: uv run pytest --cov --cov-report=term-missing

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ For released versions, see the [Releases](https://github.com/mirumee/ariadne-lam
2222

2323
### CI/CD
2424

25-
- Run tests on **Python 3.10–3.14** in a matrix; refresh GitHub Actions (`actions/setup-python`, reusable **test** / **build** / **prepare_release** / **publish** workflows).
25+
- Run tests on **Python 3.10–3.14** in a matrix; use **uv** (`astral-sh/setup-uv`) for dependency sync and running checks.
26+
- Refresh GitHub Actions (`actions/setup-python`, reusable **test** / **build** / **prepare_release** / **publish** workflows).
2627
- Replace older standalone workflows (`run_tests`, `code_quality`, `deploy`) with the modernized pipeline.
2728

2829
### Build System
2930

30-
- **Hatch** packaging, expanded `pyproject.toml` metadata, optional extras for dev/test/types, and **git-cliff** (`cliff.toml`) for release notes.
31+
- **Hatchling** remains the build backend; **uv** replaces the Hatch CLI for environments, tests, lint, and builds (`uv sync`, `uv run`, `uv build`).
32+
- Expanded `pyproject.toml` metadata, optional extras for dev/test/types (including **ruff** and **git-cliff** in `dev`), and **git-cliff** (`cliff.toml`) for release notes.
33+
- Add a **justfile** with common `uv run` targets (`lint`, `test`, `check`, changelog helpers).
3134
- Disable coverage **`fail_under`** until the test suite is expanded (previously targeted 90%).
32-
- Add **`pip`** to the `dev` optional extra so Hatch can install into a uv-managed `.venv` when `[tool.hatch.envs.default] path = ".venv"` is set (Hatch syncs via pip).
35+
- Add **`pip`** to the `dev` optional extra for edge cases where `pip` is invoked alongside uv.
3336
- Add **`uv.lock`** for reproducible local and CI installs.
3437

3538
### Documentation

justfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Development tasks (requires uv: https://docs.astral.sh/uv/ and just: https://github.com/casey/just)
2+
# Sync env: uv sync --all-extras
3+
4+
lint:
5+
uv run ruff format --check ariadne_lambda tests
6+
uv run ruff check ariadne_lambda tests
7+
uv run ty check
8+
9+
fmt:
10+
uv run ruff format ariadne_lambda tests
11+
uv run ruff check --fix ariadne_lambda tests
12+
13+
test:
14+
uv run pytest
15+
16+
test-cov:
17+
uv run pytest --cov --cov-report=term-missing
18+
19+
check: fmt test test-cov
20+
uv run ty check
21+
22+
changelog-preview:
23+
uv run git-cliff --unreleased --strip all
24+
25+
changelog-update:
26+
uv run git-cliff --unreleased -o CHANGELOG.md
27+
28+
release-notes:
29+
uv run git-cliff --latest --strip all

pyproject.toml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ dependencies = [
3131
]
3232

3333
[project.optional-dependencies]
34-
# `pip` is required in `.venv` when using Hatch with `path = ".venv"` (Hatch syncs via pip).
35-
dev = ["ipdb", "pip>=24.0"]
34+
dev = [
35+
"git-cliff>=2.0.0,<3.0.0",
36+
"ipdb",
37+
"pip>=24.0",
38+
"ruff==0.15.0",
39+
]
3640
test = [
3741
"pytest>=9.0.0,<10.0.0",
3842
"pytest-asyncio>=1.0.0,<2.0.0",
39-
"pytest-cov[toml]>=7.0.0,<8.0.0",
43+
"pytest-cov>=7.0.0,<8.0.0",
4044
]
4145
types = ["ty>=0.0.20,<0.1.0"]
4246

@@ -53,37 +57,6 @@ exclude = ["tests"]
5357
[tool.hatch.version]
5458
path = "ariadne_lambda/__about__.py"
5559

56-
[tool.hatch.envs.default]
57-
python = "3.10"
58-
features = ["dev", "types", "test"]
59-
path = ".venv"
60-
61-
[tool.hatch.envs.default.scripts]
62-
lint = ["hatch fmt --check", "hatch run types:check"]
63-
check = [
64-
"hatch fmt",
65-
"hatch test -a -p",
66-
"hatch test --cover",
67-
"hatch run types:check",
68-
]
69-
changelog-preview = "git cliff --unreleased --strip all"
70-
changelog-update = "git cliff --unreleased -o CHANGELOG.md"
71-
release-notes = "git cliff --latest --strip all"
72-
73-
[tool.hatch.envs.types.scripts]
74-
check = ["ty check"]
75-
76-
[tool.hatch.envs.hatch-static-analysis]
77-
config-path = "none"
78-
dependencies = ["ruff==0.15.0"]
79-
80-
[tool.hatch.envs.hatch-test]
81-
features = ["test"]
82-
extra-args = []
83-
84-
[[tool.hatch.envs.hatch-test.matrix]]
85-
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
86-
8760
[tool.ty.environment]
8861
python-version = "3.10"
8962

uv.lock

Lines changed: 47 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)