11# * Variables
22SHELL ?= /usr/bin/env bash
3- PYTHON ?= python
4- PYTHONPATH := ` pwd `
5- POETRY ?= poetry
3+ ACTIVEPYTHON = $(shell which python)
64
7- # * Poetry
8- .PHONY : poetry-install
9- poetry-install :
10- curl -sSL https://install.python-poetry.org | $(PYTHON ) -
11-
12- .PHONY : poetry-remove
13- poetry-remove :
14- curl -sSL https://install.python-poetry.org | $(PYTHON ) - --uninstall
15-
16- .PHONY : poetry-plugins
17- poetry-plugins :
18- $(POETRY ) self add poetry-plugin-up
19-
20- .PHONY : poetry-env
21- poetry-env :
22- $(POETRY ) config virtualenvs.in-project true
5+ # * UV
6+ .PHONY : setup
7+ setup :
8+ which uv > /dev/null || (curl -LsSf https://astral.sh/uv/install.sh | sh)
239
2410.PHONY : publish
2511publish :
26- $( POETRY ) publish --build
12+ uv publish --build
2713
2814# * Installation
2915.PHONY : install
30- install : poetry-env
31- $(POETRY ) lock -n && poetry export --without-hashes > requirements-lock.txt
32- $(POETRY ) install -n
33- -poetry run mypy --install-types --non-interactive ./
16+ install : setup
17+ uv export --format requirements-txt -o requirements.txt --no-dev
18+ uv pip install --python $(ACTIVEPYTHON ) -r requirements.txt
3419
3520.PHONY : install-dev
36- install-dev : poetry-env install
37- $(POETRY ) install -n --with dev
21+ install-dev : setup
22+ uv export --format requirements-txt -o requirements-dev.txt
23+ uv pip install --python $(ACTIVEPYTHON ) -r requirements-dev.txt
3824
3925.PHONY : pre-commit-install
40- pre-commit-install :
41- $(POETRY ) run pre-commit install
42-
26+ pre-commit-install : setup
27+ uv run --python $(ACTIVEPYTHON ) pre-commit install
4328
4429# * Formatters
4530.PHONY : codestyle
46- codestyle :
47- $( POETRY ) run ruff format --config=pyproject.toml stac_model tests
31+ codestyle : setup
32+ uv run --python $( ACTIVEPYTHON ) ruff format --config=pyproject.toml stac_model tests
4833
4934.PHONY : format
5035format : codestyle
5136
5237# * Linting
5338.PHONY : test
54- test :
55- PYTHONPATH= $( PYTHONPATH ) poetry run pytest -c pyproject.toml --cov-report=html --cov=stac_model tests/
39+ test : setup
40+ uv run --python $( ACTIVEPYTHON ) pytest -c pyproject.toml --cov-report=html --cov=stac_model tests/
5641
5742.PHONY : check
5843check : check-examples check-markdown check-lint check-mypy check-safety check-citation
@@ -61,37 +46,28 @@ check: check-examples check-markdown check-lint check-mypy check-safety check-ci
6146check-all : check
6247
6348.PHONY : mypy
64- mypy :
65- $( POETRY ) run mypy --config-file pyproject.toml ./
49+ mypy : setup
50+ uv run --python $( ACTIVEPYTHON ) mypy --config-file pyproject.toml ./
6651
6752.PHONY : check-mypy
6853check-mypy : mypy
6954
70- # NOTE:
71- # purposely running with docker rather than python package due to conflicting dependencies
72- # see https://github.com/citation-file-format/cffconvert/issues/292
73- .PHONY : check-citation
74- check-citation :
75- docker run --rm -v $(PYTHONPATH ) /CITATION.cff:/app/CITATION.cff citationcff/cffconvert --validate
76-
7755.PHONY : check-safety
78- check-safety :
79- $(POETRY ) check
80- $(POETRY ) run safety check --full-report
81- $(POETRY ) run bandit -ll --recursive stac_model tests
56+ check-safety : setup
57+ uv run --python $(ACTIVEPYTHON ) safety check --full-report
58+ uv run --python $(ACTIVEPYTHON ) bandit -ll --recursive stac_model tests
8259
8360.PHONY : lint
84- lint :
85- $(POETRY ) run ruff --config=pyproject.toml ./
86- $(POETRY ) run pydocstyle --count --config=pyproject.toml ./
87- $(POETRY ) run pydoclint --config=pyproject.toml ./
61+ lint : setup
62+ uv run --python $(ACTIVEPYTHON ) ruff check --fix --config=pyproject.toml ./
8863
8964.PHONY : check-lint
9065check-lint : lint
66+ uv run --python $(ACTIVEPYTHON ) ruff check --config=pyproject.toml ./
9167
9268.PHONY : format-lint
93- format-lint :
94- $( POETRY ) run ruff --config=pyproject.toml --fix ./
69+ format-lint : lint
70+ ruff format --config=pyproject.toml ./
9571
9672.PHONY : install-npm
9773install-npm :
@@ -120,8 +96,9 @@ $(addprefix fix-, $(FORMATTERS)): fix-%: format-%
12096lint-all : lint mypy check-safety check-markdown
12197
12298.PHONY : update-dev-deps
123- update-dev-deps :
124- $(POETRY ) up --only=dev-dependencies --latest
99+ update-dev-deps : setup
100+ uv export --only-dev --format requirements-txt -o requirements-only-dev.txt
101+ uv pip install --python $(ACTIVEPYTHON ) -r requirements-only-dev.txt
125102
126103# * Cleaning
127104.PHONY : pycache-remove
0 commit comments