forked from mscribellito/jilutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
70 lines (55 loc) · 1.91 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
70
#!/usr/bin/env just --justfile
set dotenv-load := true
SRC_DIR := "jilutil"
EXTRAS := "dev"
VERSION := `echo $(python3 -c 'from jilutil import __version__; print(__version__)')`
PYTHON := `which python || which python3`
default:
@just --choose
# Print this help text
help:
@just --list
# Install project and python dependencies (incl. pre-commit) locally
install EDITABLE='':
{{ PYTHON }} -m pip install {{EDITABLE}} '.[{{EXTRAS}}]'
# Install pre-commit to local project
install-precommit: install
pre-commit install
# Update the baseline for detect-secrets / pre-commit
update-secrets:
detect-secrets scan > .secrets.baseline # pragma: allowlist secret
# Run pytests with config from pyproject.toml
test:
{{ PYTHON }} -m pytest -c pyproject.toml
# Test and emit a coverage report
test-with-coverage:
{{ PYTHON }} -m pytest -c pyproject.toml --cov=./ --cov-report=xml
# Run ruff and black (normally done with pre-commit)
lint:
ruff check .
# Remove temporary or build folders
clean:
rm -rf build dist site *.egg-info
find . | grep -E "(__pycache__|\.pyc|\.pyo$$)" | xargs rm -rf
# Tag as v$(<src>.__version__) and push to Github
tag:
# Delete tag if it already exists
git tag -d v{{VERSION}} || true
# Tag and push
git tag v{{VERSION}}
# Push tag to Github
deploy-tag: tag
git push origin v{{VERSION}}
# Push tag to Github
deploy: deploy-tag
# Build the project
build: install clean
{{ PYTHON }} -m build
# Upload to TestPyPi for testing (note: you can only use each version once)
upload-testpypi: clean install build
python -m twine check dist/*
TWINE_USER=${TWINE_USER} TWINE_PASS=${TWINE_PASS} python -m twine upload --repository testpypi dist/*
# Upload to PyPi - DO NOT USE THIS, GHA DOES THIS AUTOMATICALLY
upload-pypi: clean install build
python -m twine check dist/*
TWINE_USER=${TWINE_USER} TWINE_PASS=${TWINE_PASS} python -m twine upload dist/*