-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
131 lines (101 loc) · 3.1 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Set the default recipe to list all available commands
@default:
@just --list
# Set the Python version
python_version := "3.13"
# Set the uv run command
uv := "uv run --python 3.13 --extra test"
#Set the uv command to run a tool
uv-tool := "uv tool run"
# Sphinx settings
SPHINXOPTS := ""
SPHINXBUILD := "sphinx-build"
SPHINXPROJ := "djpress"
SOURCEDIR := "docs"
BUILDDIR := "docs/_build"
# Run the Django development server
@run:
@just sync
{{uv}} example/manage.py runserver
# Make migrations
@makemigrations:
{{uv}} example/manage.py makemigrations
# Apply migrations
@migrate:
{{uv}} example/manage.py migrate
# Create a superuser
@createsuperuser:
{{uv}} example/manage.py createsuperuser
# Collect static files
@collectstatic:
{{uv}} example/manage.py collectstatic
# Run Django shell
@shell:
{{uv}} example/manage.py shell
# Check for any problems in your project
@check:
{{uv}} example/manage.py check
# Run pytest
@test:
{{uv}} pytest
# Run Ruff linking
@lint:
{{uv-tool}} ruff check
# Run Ruff formatting
@format:
{{uv-tool}} ruff format
# Run nox
@nox:
{{uv-tool}} nox --session test
# Run coverage
@cov:
{{uv}} -m pytest --cov
# Run coverage
@cov-html:
{{uv}} -m pytest --cov --cov-report=html --cov-context=test
echo Coverage report: file://`pwd`/htmlcov/index.html
# Sync the package
@sync:
uv sync --python {{python_version}} --all-extras
# Sync the package
@sync-up:
uv sync --python {{python_version}} --all-extras --upgrade
# Lock the package version
@lock:
uv lock
# Build the package
@build:
uv build
# Publish the package - this requires a $HOME/.pypirc file with your credentials
@publish:
rm -rf ./dist/*
uv build
{{uv-tool}} twine check dist/*
{{uv-tool}} twine upload dist/*
# Upgrade pre-commit hooks
@pc-up:
{{uv-tool}} pre-commit autoupdate
# Run pre-commit hooks
@pc-run:
{{uv-tool}} pre-commit run --all-files
# Use Sphinx to build and view the documentation
@docs:
uv run sphinx-autobuild -b html "{{SOURCEDIR}}" "{{BUILDDIR}}" {{SPHINXOPTS}}
# Use BumpVer to increase the patch version number. Use just bump -d to view a dry-run.
@bump *ARGS:
uv run bumpver update --patch {{ ARGS }}
uv sync
# Use BumpVer to increase the minor version number. Use just bump -d to view a dry-run.
@bump-minor *ARGS:
uv run bumpver update --minor {{ ARGS }}
uv sync
# Create a new GitHub release - this requires Python 3.11 or newer, and the GitHub CLI must be installed and configured
version := `echo "from tomllib import load; print(load(open('pyproject.toml', 'rb'))['project']['version'])" | uv run - `
[confirm("Are you sure you want to create a new release?\nThis will create a new GitHub release and will build and deploy a new version to PyPi.\nYou should have already updated the version number using one of the bump recipes.\nTo check the version number, run just version.\n\nCreate release?")]
@release:
echo "Creating a new release for v{{version}}"
git pull
gh release create "v{{version}}" --generate-notes
@version:
git pull
echo {{version}}