-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b7d8e0e
commit 4b3c687
Showing
9 changed files
with
1,814 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
set unstable := true | ||
|
||
justfile := justfile_directory() + "/.just/copier.just" | ||
|
||
[private] | ||
default: | ||
@just --list --justfile {{ justfile }} | ||
|
||
[private] | ||
fmt: | ||
@just --fmt --justfile {{ justfile }} | ||
|
||
# Create a copier answers file | ||
[no-cd] | ||
copy TEMPLATE_PATH DESTINATION_PATH=".": | ||
uv run copier copy --trust {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }} | ||
|
||
# Recopy the project from the original template | ||
[no-cd] | ||
recopy ANSWERS_FILE *ARGS: | ||
uv run copier recopy --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }} | ||
|
||
# Loop through all answers files and recopy the project using copier | ||
[no-cd] | ||
@recopy-all *ARGS: | ||
for file in `ls .copier/`; do just copier recopy .copier/$file "{{ ARGS }}"; done | ||
|
||
# Update the project using a copier answers file | ||
[no-cd] | ||
update ANSWERS_FILE *ARGS: | ||
uv run copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }} | ||
|
||
# Loop through all answers files and update the project using copier | ||
[no-cd] | ||
@update-all *ARGS: | ||
for file in `ls .copier/`; do just copier update .copier/$file "{{ ARGS }}"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
set unstable := true | ||
|
||
justfile := justfile_directory() + "/.just/documentation.just" | ||
|
||
[private] | ||
default: | ||
@just --list --justfile {{ justfile }} | ||
|
||
[private] | ||
fmt: | ||
@just --fmt --justfile {{ justfile }} | ||
|
||
# Build documentation using Sphinx | ||
[no-cd] | ||
build LOCATION="docs/_build/html": cog | ||
uv run --extra docs sphinx-build docs {{ LOCATION }} | ||
|
||
# Serve documentation locally | ||
[no-cd] | ||
serve PORT="8000": cog | ||
#!/usr/bin/env sh | ||
HOST="localhost" | ||
if [ -f "/.dockerenv" ]; then | ||
HOST="0.0.0.0" | ||
fi | ||
uv run --extra docs sphinx-autobuild docs docs/_build/html --host "$HOST" --port {{ PORT }} | ||
[no-cd] | ||
[private] | ||
cog: | ||
uv run --extra docs cog -r docs/development/just.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,45 @@ | ||
set dotenv-load := true | ||
set unstable := true | ||
|
||
@_default: | ||
just --list | ||
mod copier ".just/copier.just" | ||
mod docs ".just/documentation.just" | ||
|
||
demo: | ||
python -m nox -session "demo" | ||
|
||
# ---------------------------------------------------------------------- | ||
# DEPENDENCIES | ||
# ---------------------------------------------------------------------- | ||
|
||
bootstrap: | ||
@just pup | ||
@just install | ||
[private] | ||
default: | ||
@just --list | ||
|
||
install: | ||
python -m uv pip install --editable '.[dev]' | ||
|
||
pup: | ||
python -m pip install --upgrade pip uv | ||
|
||
# ---------------------------------------------------------------------- | ||
# TESTING/TYPES | ||
# ---------------------------------------------------------------------- | ||
[private] | ||
fmt: | ||
@just --fmt | ||
@just copier fmt | ||
@just docs fmt | ||
|
||
test *ARGS: | ||
python -m nox --session "test" -- "{{ ARGS }}" | ||
[private] | ||
nox SESSION *ARGS: | ||
uv run nox --session "{{ SESSION }}" -- "{{ ARGS }}" | ||
|
||
testall *ARGS: | ||
python -m nox --session "tests" -- "{{ ARGS }}" | ||
bootstrap: | ||
uv python install | ||
uv sync --frozen | ||
|
||
coverage: | ||
python -m nox --session "coverage" | ||
|
||
types: | ||
python -m nox --session "mypy" | ||
|
||
# ---------------------------------------------------------------------- | ||
# DJANGO | ||
# ---------------------------------------------------------------------- | ||
|
||
manage *COMMAND: | ||
#!/usr/bin/env python | ||
import sys | ||
try: | ||
from django.conf import settings | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
@just nox coverage | ||
|
||
settings.configure(INSTALLED_APPS=["django_simple_nav"]) | ||
execute_from_command_line(sys.argv + "{{ COMMAND }}".split(" ")) | ||
|
||
alias mm := makemigrations | ||
|
||
makemigrations *APPS: | ||
@just manage makemigrations {{ APPS }} | ||
|
||
migrate *ARGS: | ||
@just manage migrate {{ ARGS }} | ||
|
||
# ---------------------------------------------------------------------- | ||
# DOCS | ||
# ---------------------------------------------------------------------- | ||
|
||
@docs-install: | ||
@just pup | ||
python -m uv pip install 'django-simple-nav[docs] @ .' | ||
|
||
@docs-serve: | ||
#!/usr/bin/env sh | ||
just _cog | ||
if [ -f "/.dockerenv" ]; then | ||
sphinx-autobuild docs docs/_build/html --host "0.0.0.0" | ||
else | ||
sphinx-autobuild docs docs/_build/html --host "localhost" | ||
fi | ||
@docs-build LOCATION="docs/_build/html": | ||
just _cog | ||
sphinx-build docs {{ LOCATION }} | ||
|
||
_cog: | ||
cog -r docs/development/just.md | ||
|
||
# ---------------------------------------------------------------------- | ||
# UTILS | ||
# ---------------------------------------------------------------------- | ||
|
||
# format justfile | ||
fmt: | ||
just --fmt --unstable | ||
demo: | ||
@just nox demo | ||
|
||
# run pre-commit on all files | ||
lint: | ||
python -m nox --session "lint" | ||
uv run --with pre-commit-uv pre-commit run --all-files | ||
just fmt | ||
|
||
# ---------------------------------------------------------------------- | ||
# COPIER | ||
# ---------------------------------------------------------------------- | ||
lock *ARGS: | ||
uv lock {{ ARGS }} | ||
|
||
# apply a copier template to project | ||
copier-copy TEMPLATE_PATH DESTINATION_PATH=".": | ||
copier copy {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }} | ||
test *ARGS: | ||
@just nox test {{ ARGS }} | ||
|
||
# update the project using a copier answers file | ||
copier-update ANSWERS_FILE *ARGS: | ||
copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }} | ||
testall *ARGS: | ||
@just nox tests {{ ARGS }} | ||
|
||
# loop through all answers files and update the project using copier | ||
@copier-update-all *ARGS: | ||
for file in `ls .copier/`; do just copier-update .copier/$file "{{ ARGS }}"; done | ||
types *ARGS: | ||
@just nox types {{ ARGS }} |
Oops, something went wrong.