|
1 | 1 | #Makefile for causalAssembly |
2 | 2 |
|
| 3 | + |
3 | 4 | MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) |
4 | 5 | CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))) |
5 | 6 |
|
6 | 7 | VENV_NAME := venv_${CURRENT_DIR} |
7 | 8 | PYTHON=${VENV_NAME}/bin/python |
8 | 9 |
|
| 10 | +ALLOWED_LICENSES := "$(shell tr -s '\n' ';' < allowed_licenses.txt)" |
| 11 | +ALLOWED_PACKAGES := $(shell tr -s '\n' ' ' < allowed_packages.txt) |
| 12 | + |
9 | 13 | sync-venv: |
10 | 14 | : # Create or update default virtual environment to latest pinned |
11 | 15 | : # dependencies |
12 | 16 | test -d $(VENV_NAME) || \ |
13 | 17 | python3.10 -m virtualenv $(VENV_NAME); \ |
14 | | - ${PYTHON} -m pip install -U pip; \ |
15 | | - ${PYTHON} -m pip install pip-tools |
16 | | - . $(VENV_NAME)/bin/activate && pip-sync requirements_dev.txt |
17 | | - #. $(VENV_NAME)/bin/activate && pip install --no-deps -e . |
| 18 | + ${PYTHON} -m pip install -U uv; \ |
| 19 | + . $(VENV_NAME)/bin/activate && uv pip sync requirements_dev.txt |
| 20 | + . $(VENV_NAME)/bin/activate && uv pip install --no-deps -e . |
18 | 21 |
|
19 | 22 | requirements: |
20 | 23 | : # Update requirements_dev.txt if only new library is added |
21 | 24 | : # Assumes virtual environment with pip-tools installed is activated |
22 | | - pip-compile --extra dev -o requirements_dev.txt pyproject.toml --annotation-style line --no-emit-index-url --no-emit-trusted-host --allow-unsafe --resolver=backtracking |
| 25 | + uv pip compile pyproject.toml --output-file=requirements.txt --annotation-style=line |
| 26 | + uv pip compile pyproject.toml --extra=dev --output-file=requirements_dev.txt --annotation-style=line |
23 | 27 |
|
24 | 28 |
|
25 | 29 | update-requirements: |
26 | 30 | : # Update requirements_dev.txt if dependencies should be updated |
27 | 31 | : # Assumes virtual environment with pip-tools installed is activated |
28 | | - pip-compile --extra dev -o requirements_dev.txt pyproject.toml --annotation-style line --no-emit-index-url --no-emit-trusted-host --allow-unsafe --resolver=backtracking --upgrade |
| 32 | + uv pip compile pyproject.toml --output-file=requirements.txt --annotation-style=line --upgrade |
| 33 | + uv pip compile pyproject.toml --extra=dev --output-file=requirements_dev.txt --annotation-style=line --upgrade |
| 34 | + |
| 35 | + |
| 36 | +precommit: |
| 37 | + : # Run precommit on all files locally (this runs only the pre-commit and not the pre-push hooks) |
| 38 | + pre-commit install |
| 39 | + pre-commit run --all-files |
| 40 | + |
| 41 | +test: |
| 42 | + : # Run pytest |
| 43 | + python -m pytest |
| 44 | + |
| 45 | +licenses: |
| 46 | + : # Create file with used licenses and check if these are permissive |
| 47 | + pip-licenses --order=license --ignore-packages ${ALLOWED_PACKAGES} --allow-only=${ALLOWED_LICENSES} > licenses.txt |
| 48 | + |
| 49 | +clean-branches: |
| 50 | + git branch --merged | grep -v '\\*\\|main\\|develop' | xargs -n 1 -r git branch -d |
0 commit comments