/
justfile
69 lines (53 loc) · 2.06 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
set shell := ["nu", "-c"]
DEFAULT_VERSION := "3.11"
SUPPORTED_VERSIONS := "['3.8' '3.9' '3.10' '3.11' '3.12']"
# Bootstrap with all supported Python versions
bootstrap:
mkdir tmp
for version in {{ SUPPORTED_VERSIONS }} { just bootstrap-with $version }
just py -m pip install -r requirements-dev.txt
# Set up Python environment with specified Python version
bootstrap-with VERSION:
if not (".{{ VERSION }}.venv" | path exists) { py -{{ VERSION }} -m venv .{{ VERSION }}.venv }
just python {{ VERSION }} -m pip install --upgrade pip pip-tools build twine
just python {{ VERSION }} -m pip install -r requirements-test.txt
just python {{ VERSION }} -m pip install -e . --upgrade --upgrade-strategy eager
# Run a specific Python interpreter
python VERSION *ARGS:
@^".{{ VERSION }}.venv/Scripts/python.exe" -X dev {{ ARGS }}
# Run python command with the default Python version
py *ARGS:
@just python {{DEFAULT_VERSION }} {{ ARGS }}
# Run every check against source code
check: black mypy pylint test
# Check static typing
mypy:
just py -m mypy src
# Static code analysis with Pylint
pylint:
just py -m pylint src *.py
# Check code formatting
black:
just py -m black --check src *.py
# Test with all supported Python versions
test:
for version in {{ SUPPORTED_VERSIONS }} { just test-with $version }
# Run the tests with specified Python version
test-with VERSION:
^".{{ VERSION }}.venv/Scripts/pytest.exe"
# Remove compiled assets
clean:
rm --force --recursive --verbose build dist persistedstate.egg-info
# Upgrade depedencies
upgrade-deps:
just py -m piptools compile pyproject.toml --output-file=requirements-test.txt --upgrade --resolver=backtracking --extra test
just py -m piptools compile pyproject.toml --output-file=requirements-dev.txt --upgrade --resolver=backtracking --extra dev --extra perftest
# Run performance test
perftest:
just py perftest.py
# Build the whole project, create a release
build: clean bootstrap check
just py -m build
# Upload the release to PyPi
upload:
just py -m twine upload dist/*