Skip to content

Commit 16d7001

Browse files
committed
cleanup makefile and codspeed
1 parent 7c83ed2 commit 16d7001

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

.github/workflows/codspeed.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626

2727
- name: install deps
2828
run: |
29-
uv sync --python 3.13 --group testing
30-
uv pip uninstall pytest-speed -y
29+
uv sync --python 3.13 --group testing --no-install-project
30+
uv pip uninstall pytest-speed
3131
uv pip install pytest-benchmark==4.0.0 pytest-codspeed
3232
3333
- name: install rust stable

Makefile

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ sources = python/pydantic_core tests generate_self_schema.py wasm-preview/run_te
44
# using pip install cargo (via maturin via pip) doesn't get the tty handle
55
# so doesn't render color without some help
66
export CARGO_TERM_COLOR=$(shell (test -t 0 && echo "always") || echo "auto")
7-
# maturin develop only makes sense inside a virtual env, is otherwise
8-
# more or less equivalent to pip install -e just a little nicer
9-
USE_MATURIN = $(shell [ "$$VIRTUAL_ENV" != "" ] && (which maturin))
107

118
.PHONY: .uv ## Check that uv is installed
129
.uv:
@@ -19,7 +16,7 @@ USE_MATURIN = $(shell [ "$$VIRTUAL_ENV" != "" ] && (which maturin))
1916
.PHONY: install
2017
install: .uv .pre-commit
2118
uv pip install -U wheel
22-
uv sync --frozen --group all
19+
uv sync --frozen --group all --no-install-project
2320
uv pip install -v -e .
2421
pre-commit install
2522

@@ -38,56 +35,37 @@ install-rust-coverage:
3835
.PHONY: build-dev
3936
build-dev:
4037
@rm -f python/pydantic_core/*.so
41-
ifneq ($(USE_MATURIN),)
42-
uv run maturin develop
43-
else
44-
uv pip install --force-reinstall -v -e . --config-settings=build-args='--profile dev'
45-
endif
38+
uv sync --frozen --group maturin --no-install-project
39+
uv run --no-sync maturin develop
4640

4741
.PHONY: build-prod
4842
build-prod:
4943
@rm -f python/pydantic_core/*.so
50-
ifneq ($(USE_MATURIN),)
51-
uv run maturin develop --release
52-
else
53-
uv pip install -v -e .
54-
endif
44+
uv sync --frozen --group maturin --no-install-project
45+
uv run --no-sync maturin develop --release
5546

5647
.PHONY: build-profiling
5748
build-profiling:
5849
@rm -f python/pydantic_core/*.so
59-
ifneq ($(USE_MATURIN),)
60-
uv run maturin develop --profile profiling
61-
else
62-
uv pip install --force-reinstall -v -e . --config-settings=build-args='--profile profiling'
63-
endif
50+
uv sync --frozen --group maturin --no-install-project
51+
uv run --no-sync maturin develop --profile profiling
6452

6553
.PHONY: build-coverage
6654
build-coverage:
6755
@rm -f python/pydantic_core/*.so
68-
ifneq ($(USE_MATURIN),)
69-
RUSTFLAGS='-C instrument-coverage' uv run maturin develop --release
70-
else
71-
RUSTFLAGS='-C instrument-coverage' uv pip install -v -e .
72-
endif
56+
uv sync --frozen --group maturin --no-install-project
57+
RUSTFLAGS='-C instrument-coverage' uv run --no-sync maturin develop --release
7358

7459
.PHONY: build-pgo
7560
build-pgo:
7661
@rm -f python/pydantic_core/*.so
7762
$(eval PROFDATA := $(shell mktemp -d))
78-
ifneq ($(USE_MATURIN),)
63+
uv sync --frozen --group maturin --no-install-project
7964
RUSTFLAGS='-Cprofile-generate=$(PROFDATA)' uv run maturin develop --release
80-
else
81-
RUSTFLAGS='-Cprofile-generate=$(PROFDATA)' uv pip install --force-reinstall -v -e .
82-
endif
8365
pytest tests/benchmarks
8466
$(eval LLVM_PROFDATA := $(shell rustup run stable bash -c 'echo $$RUSTUP_HOME/toolchains/$$RUSTUP_TOOLCHAIN/lib/rustlib/$$(rustc -Vv | grep host | cut -d " " -f 2)/bin/llvm-profdata'))
8567
$(LLVM_PROFDATA) merge -o $(PROFDATA)/merged.profdata $(PROFDATA)
86-
ifneq ($(USE_MATURIN),)
8768
RUSTFLAGS='-Cprofile-use=$(PROFDATA)/merged.profdata' uv run maturin develop --release
88-
else
89-
RUSTFLAGS='-Cprofile-use=$(PROFDATA)/merged.profdata' uv pip install --force-reinstall -v -e .
90-
endif
9169
@rm -rf $(PROFDATA)
9270

9371

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ wasm = [
8282
'maturin>=1,<2',
8383
'ruff',
8484
]
85+
maturin = [
86+
'maturin>=1,<2',
87+
'pip'
88+
]
8589

8690
all = [
8791
{ include-group = 'testing' },

uv.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)