Skip to content

Commit b4b81c4

Browse files
authored
chore: use dependency groups (#219)
1 parent ab45f1d commit b4b81c4

File tree

6 files changed

+864
-55
lines changed

6 files changed

+864
-55
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,7 @@ jobs:
171171
shell: bash
172172

173173
- name: Test Install
174-
run: |
175-
uv venv
176-
source ./.venv/Scripts/activate
177-
uv pip install wheelhouse/rfc3161_client*.whl
178-
python -c "import rfc3161_client"
174+
run: uv run --with wheelhouse/rfc3161_client*.whl python -c "import rfc3161_client"
179175
shell: bash
180176

181177
- name: Upload wheels

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
cache-dependency-glob: pyproject.toml
3434

3535
- name: lint
36-
run: make lint INSTALL_EXTRA=lint
36+
run: make lint

.github/workflows/tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: uv python install ${{ matrix.python }}
4040

4141
- name: test
42-
run: make test INSTALL_EXTRA=test
42+
run: make test
4343

4444
test-windows:
4545
strategy:
@@ -89,11 +89,7 @@ jobs:
8989
echo "OPENSSL_NO_VENDOR=1" >> $GITHUB_ENV
9090
9191
- name: test
92-
run: |
93-
# We need to do this in CI because setup-uv@v5 automatically creates a new venv and it prevents us from
94-
# installing our dependencies in the Makefile.
95-
touch pyproject.toml
96-
make test INSTALL_EXTRA=test
92+
run: make test
9793
shell: bash
9894

9995
all-tests-pass:

Makefile

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,12 @@ PY_IMPORT = rfc3161_client
55
ALL_PY_SRCS := $(shell find src -name '*.py') \
66
$(shell find test -name '*.py')
77

8-
# Optionally overriden by the user, if they're using a virtual environment manager.
9-
VENV ?= .venv
10-
11-
# On Windows, venv scripts/shims are under `Scripts` instead of `bin`.
12-
VENV_BIN := $(VENV)/bin
13-
ifeq ($(OS),Windows_NT)
14-
VENV_BIN := $(VENV)/Scripts
15-
endif
16-
178
# Optionally overridden by the user in the `release` target.
189
BUMP_ARGS :=
1910

2011
# Optionally overridden by the user in the `test` target.
2112
TESTS :=
2213

23-
# Optionally overridden by the user/CI, to limit the installation to a specific
24-
# subset of development dependencies.
25-
INSTALL_EXTRA := dev
26-
2714
# If the user selects a specific test pattern to run, set `pytest` to fail fast
2815
# and only run tests that match the pattern.
2916
# Otherwise, run all tests and enable coverage assertions, since we expect
@@ -41,42 +28,37 @@ all:
4128
@echo "Run my targets individually!"
4229

4330
.PHONY: dev
44-
dev: $(VENV)/pyvenv.cfg
45-
@. $(VENV_BIN)/activate && maturin develop --uv
46-
47-
$(VENV)/pyvenv.cfg: pyproject.toml
48-
uv venv $(VENV)
49-
@. $(VENV_BIN)/activate && uv pip install -e '.[$(INSTALL_EXTRA)]'
31+
dev:
32+
uv sync --group dev
33+
uv run maturin develop --uv
5034

5135
.PHONY: lint
52-
lint: $(VENV)/pyvenv.cfg
53-
. $(VENV_BIN)/activate && \
54-
ruff format --check && \
55-
ruff check
56-
cargo fmt --check --manifest-path rust/Cargo.toml
57-
cargo fmt --check --manifest-path rust/tsp-asn1/Cargo.toml
58-
. $(VENV_BIN)/activate && \
59-
interrogate -c pyproject.toml .
60-
. $(VENV_BIN)/activate && \
61-
ty check
36+
lint:
37+
uv sync --group lint
38+
uv run ruff format --check && \
39+
uv run ruff check && \
40+
cargo fmt --check --manifest-path rust/Cargo.toml && \
41+
cargo fmt --check --manifest-path rust/tsp-asn1/Cargo.toml && \
42+
uv run interrogate -c pyproject.toml . && \
43+
uv run ty check
6244

6345
.PHONY: reformat
6446
reformat:
65-
. $(VENV_BIN)/activate && \
66-
ruff format && \
67-
ruff check --fix
68-
cargo fmt --manifest-path rust/Cargo.toml
69-
cargo fmt --manifest-path rust/tsp-asn1/Cargo.toml
47+
uv sync --group lint
48+
uv run ruff format && \
49+
uv run ruff check --fix && \
50+
cargo fmt --manifest-path rust/Cargo.toml && \
51+
cargo fmt --manifest-path rust/tsp-asn1/Cargo.toml
7052

7153
.PHONY: doc
7254
doc:
7355
@echo "No documentation set up"
7456

7557

7658
.PHONY: test tests
77-
test tests: $(VENV)/pyvenv.cfg
78-
. $(VENV_BIN)/activate && \
79-
pytest --cov=$(PY_IMPORT) $(T) $(TEST_ARGS) && \
80-
python -m coverage report -m $(COV_ARGS)
81-
cargo test --manifest-path rust/Cargo.toml
82-
cargo test --manifest-path rust/tsp-asn1/Cargo.toml
59+
test tests:
60+
uv sync --group test
61+
uv run pytest --cov=$(PY_IMPORT) $(T) $(TEST_ARGS) && \
62+
uv run coverage report -m $(COV_ARGS) && \
63+
cargo test --manifest-path rust/Cargo.toml && \
64+
cargo test --manifest-path rust/tsp-asn1/Cargo.toml

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ license = { file = "LICENSE" }
1919
authors = [{ name = "Trail of Bits", email = "[email protected]" }]
2020
dependencies = ["cryptography>=43"]
2121

22-
[project.optional-dependencies]
22+
[dependency-groups]
2323
doc = []
2424
test = ["pytest", "pytest-cov", "pretend", "coverage[toml]"]
25-
lint = ["ruff >= 0.7,< 0.15", "interrogate", "ty>=0.0.14", "rfc3161-client[test]"]
26-
dev = ["rfc3161-client[test,lint,doc]", "maturin>=1.7,<2.0"]
25+
lint = ["ruff >= 0.7,< 0.15", "interrogate", "ty>=0.0.14", { include-group = "test" }]
26+
dev = [{ include-group = "lint" }, { include-group = "doc" }, "maturin>=1.7,<2.0"]
2727

2828
[project.urls]
2929
Homepage = "https://pypi.org/project/rfc3161-client"

0 commit comments

Comments
 (0)