forked from pls-rs/pls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
60 lines (47 loc) · 1.45 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
set dotenv-load := false
# Show all available recipes
default:
@just --list --unsorted
###############
# Development #
###############
# Install dependencies and set up pre-commit Git hook
install:
poetry install
poetry run pre-commit install --hook-type pre-push --hook-type pre-commit
# Run pre-commit to lint and reformat all files
lint:
poetry run pre-commit run --all-files
# Run mypy under pre-commit to typecheck code
mypy *args="--all-files":
poetry run pre-commit run mypy {{ args }}
# Run Black under pre-commit to reformat code
black *args="--all-files":
poetry run pre-commit run black {{ args }}
# Run unit tests using pytest
test *args:
env CI="true" poetry run pytest --cov=src/ {{ args }}
# Open an IPython shell
shell:
poetry run ipython
# Remove all Python cache files
pyclean:
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
##############
# Deployment #
##############
# Print the current version of `pls` from the `pyproject.toml` file
ver:
grep 'version' pyproject.toml | cut -d'"' -f 2
# Bump the version number of the project, commit the code and tag the commit
bump level="minor":
poetry version {{ level }}
git add pyproject.toml
git commit -m "Bump version to $(just ver)"
git tag -a "$(just ver)" -m "$(just ver)"
git push origin main
git push origin $(just ver)
# Build the project and publish to PyPI
deploy:
poetry build
poetry publish