-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjustfile
50 lines (38 loc) · 1.05 KB
/
justfile
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
50
# VARIABLE DEFINITIONS
venv := ".venv"
bin := venv + "/bin"
python := bin + "/python"
python_version := "python3.12"
target_dirs := "src tests"
# SENTINELS
venv-exists := path_exists(venv)
# ALIASES
alias t := test
# RECIPES
# Shows list of recipes.
help:
just --list --unsorted
# Generate the virtual environment.
venv:
@if ! {{ venv-exists }}; \
then \
POETRY_VIRTUALENVS_IN_PROJECT=1 poetry env use {{ python_version }}; \
poetry install; \
fi
# Cleans all artifacts generated while running this project, including the virtualenv.
clean:
@rm -f .coverage*
@rm -rf {{ venv }}
# Runs the tests with the specified arguments (any path or pytest argument).
test *test-args='': venv
poetry run pytest {{ test-args }} --no-cov
# Runs all tests including coverage report.
test-all: venv
poetry run pytest
# Format all code in the project.
format: venv
poetry run ruff check {{ target_dirs }} --fix
# Lint all code in the project.
lint: venv
poetry run ruff check {{ target_dirs }}
poetry run mypy {{ target_dirs }}