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