@@ -13,7 +13,6 @@ COVERAGE_DIR := $(PACKAGE_DIR)/build/documentation/coverage/
1313
1414DEP_FILES := $(wildcard setup.* ) $(wildcard requirements* .txt) $(wildcard pyproject.toml)
1515
16-
1716# ###################
1817# #@ Helper Commands
1918# ###################
@@ -27,7 +26,6 @@ help: ## Display this help
2726# #@ Cleaning Commands
2827# #####################
2928
30-
3129clean-venv : # # Clean virtualenv
3230 rm -rf $(VENV ) /
3331
@@ -60,37 +58,32 @@ obliterate: clean-venv clean ## alias to clean, clean-venv
6058
6159.PHONY : clean-venv clean-install-stamp clean-build clean-pyc clean-test clean obliterate
6260
63-
6461# ########################
6562# #@ Installation Commands
6663# ########################
6764
68- create-venv : $(PYTHON ) # # Creates virtualenv
69- $(PYTHON ) :
70- python3 -m venv $(VENV ) --prompt $(shell basename $(PACKAGE_DIR ) )
71- $(PYTHON ) -m pip install --upgrade pip
65+ .uv : # # Check that uv is installed
66+ @uv -V || echo ' Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
7267
73- install : $(INSTALL_STAMP ) # # Installs package dependencies
74- $(INSTALL_STAMP ) : $(PYTHON ) $(DEP_FILES )
75- @. $(VENV_BIN ) /activate; \
76- $(PIP ) install -e .[dev];
77- @touch $(INSTALL_STAMP )
68+ install : .uv # # Installs development (dev/lint) related dependencies
69+ uv sync --frozen --group dev
7870
79- install-release : clean-install-stamp $(PYTHON ) $(DEP_FILES ) # # Installs package for release
80- @. $(VENV_BIN ) /activate; \
81- $(PIP ) install .[release]
71+ install-release : .uv # # Installs package dependencies
72+ uv sync --frozen --group release
8273
83- install-force : clean-install-stamp install # # Force install package dependencies
74+
75+ rebuild-lockfile : .uv # # Rebuilds the lockfile
76+ uv lock --upgrade
8477
8578link-packages : # # Link local packages to virtualenv
8679 @parent_dir=$$(dirname $$(pwd ) ) ; \
8780 local_packages=$$(ls $$parent_dir ) ; \
88- dependencies=$$($( PIP ) list --format freeze --exclude-editable | awk -F '==' '{print $$1}') ; \
81+ dependencies=$$(uv pip list --format freeze --exclude-editable | awk -F '==' '{print $$1}' ) ; \
8982 for local_package in $$ local_packages; do \
9083 for dependency in $$ dependencies; do \
9184 if [ $$ local_package == $$ dependency ]; then \
9285 echo " Reinstalling $$ local_package dependency to local override" ; \
93- $( PIP ) install -e $$ parent_dir/$$ local_package --no-deps ; \
86+ uv add -v --editable --frozen $$ parent_dir/$$ local_package; \
9487 fi \
9588 done ; \
9689 done
@@ -99,72 +92,64 @@ unlink-packages: ## Unlink local packages from virtualenv
9992 @parent_dir=$$(dirname $$(pwd ) ) ; \
10093 this_package=$$(basename $$(pwd ) ) ; \
10194 local_packages=$$(ls $$parent_dir ) ; \
102- dependencies=$$($( PIP ) list --format freeze --editable | awk -F '==' '{print $$1}') ; \
95+ dependencies=$$(uv pip list --format freeze --editable | awk -F '==' '{print $$1}' ) ; \
10396 is_found=0; \
10497 for local_package in $$ local_packages; do \
10598 for dependency in $$ dependencies; do \
10699 if [ $$ local_package == $$ dependency ] && [ $$ local_package != $$ this_package ]; then \
107100 is_found=1; \
101+ uv remove --frozen $$ local_package; \
108102 fi ; \
109103 done \
110104 done ; \
111105 if [ $$ is_found == 1 ]; then \
112106 echo " Found dependencies installed locally, reinstalling..." ; \
113- make clean-install-stamp install; \
107+ make install; \
114108 fi
115109
116- .PHONY : create-venv install install-force link-packages unlink-packages
110+ .PHONY : .uv install install-release install rebuild-lockfile link-packages unlink-packages
117111
118112# ######################
119113# #@ Formatting Commands
120114# ######################
121115
122- lint-black : $(INSTALL_STAMP ) # # Run black (check only)
123- $(VENV_BIN ) /black ./ --check
124-
125- lint-isort : $(INSTALL_STAMP ) # # Run isort (check only)
126- $(VENV_BIN ) /isort ./ --check
127-
128- lint-mypy : $(INSTALL_STAMP ) # # Run mypy
129- $(VENV_BIN ) /mypy ./
116+ lint-ruff : install # # Run ruff checker
117+ uv run ruff check
130118
119+ lint-mypy : install # # Run mypy
120+ uv run mypy ./
131121
132- lint : lint-isort lint-black lint- mypy # # Run all lint targets (black, isort , mypy)
122+ lint : lint-ruff lint-mypy # # Run all lint targets (ruff , mypy)
133123
134124
135- format-black : $(INSTALL_STAMP ) # # Format code using black
136- $(VENV_BIN ) /black ./
125+ format-ruff : install # # Run ruff formatter
126+ uv run ruff check --fix
127+ uv run ruff format
137128
138- format-isort : $(INSTALL_STAMP ) # # Format code using isort
139- $(VENV_BIN ) /isort ./
129+ format : format-ruff # # Run all formatters (ruff)
140130
141-
142- format : format-isort format-black # # Run all formatters (black, isort)
143-
144- .PHONY : lint-isort lint-black lint-mypy lint format-lint format-black format-mypy format
131+ .PHONY : lint-ruff lint-mypy lint format-ruff format-mypy format
145132
146133# ####################
147134# #@ Testing Commands
148135# ####################
149136
150- pytest : $(INSTALL_STAMP ) # # Run test (pytest)
151- $(VENV_BIN ) /pytest -vv --durations=10
152-
153- tox : $(INSTALL_STAMP ) # # Run Test in tox environment
154- $(VENV_BIN ) /tox
137+ pytest : install # # Run test (pytest)
138+ uv run pytest -vv --durations=10
155139
156140test : pytest # # Run Standard Tests
157141
158- .PHONY : pytest tox test
159-
142+ .PHONY : pytest test
160143
161144# ####################
162145# #@ Inspect Commands
163146# ####################
164147
165- coverage-server : $( INSTALL_STAMP ) # # Run coverage server
148+ coverage-server : install # # Run coverage server
166149 $(PYTHON ) -m http.server $(COVERAGE_SERVER_PORT ) -d $(COVERAGE_DIR )
167150
151+ .PHONY : coverage-server
152+
168153
169154# ####################
170155# #@ Docker Commands
@@ -183,8 +168,7 @@ docker-build: ## Build docker image
183168# ####################
184169
185170dist : install-release # # Build source and wheel package
186- @. $(VENV_BIN ) /activate; \
187- $(PYTHON ) -m build;
171+ uv build
188172
189173reinstall : obliterate install # # Recreate environment and install
190174
@@ -194,4 +178,4 @@ post-build: lint test ## Run linters and tests
194178release : pre-build build post-build # # Runs pre-build, build, post-build
195179run : release
196180
197- .PHONY : reinstall pre-build build post-build release run
181+ .PHONY : dist reinstall pre-build build post-build release run
0 commit comments