Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-uv-workflow #123

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
uses: astral-sh/setup-uv@v2

- name: Run tests
run: uv run --frozen --python 3.13 pytest
run: uv run --locked pytest
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ coverage.xml
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery
celerybeat-schedule.*

Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
50 changes: 23 additions & 27 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,71 @@
default:
@just --list

# Set the Python version
python_version := "3.13"

# Set the uv run command
uv := "uv run --python 3.13 --extra test"
uvr := "uv run --extra test --locked"

#Set the uv command to run a tool
uv-tool := "uv tool run"
uvt := "uv tool run"

# Sync the package
sync:
uv sync --all-extras --locked

# Sync and upgrade the package
sync-up:
uv sync --all-extras --upgrade

# Run the Django development server
run:
@just sync
{{uv}} manage.py runserver
{{uvr}} manage.py runserver

# Make migrations
makemigrations:
{{uv}} manage.py makemigrations
{{uvr}} manage.py makemigrations

# Apply migrations
migrate:
{{uv}} manage.py migrate
{{uvr}} manage.py migrate

# Create a superuser
createsuperuser:
{{uv}} manage.py createsuperuser
{{uvr}} manage.py createsuperuser

# Collect static files
collectstatic:
{{uv}} manage.py collectstatic
{{uvr}} manage.py collectstatic

# Run Django shell
shell:
{{uv}} manage.py shell
{{uvr}} manage.py shell

# Check for any problems in your project
check:
{{uv}} manage.py check
{{uvr}} manage.py check

# Run pytest
test:
{{uv}} pytest
{{uvr}} pytest

# Run Ruff linking
lint:
{{uv-tool}} ruff check
{{uvt}} ruff check

# Run Ruff formatting
format:
{{uv-tool}} ruff format

# Sync the package
sync:
uv sync --python {{python_version}} --all-extras

# Sync and upgrade the package
sync-up:
uv sync --python {{python_version}} --all-extras --upgrade
{{uvt}} ruff format

# Lock the package version
lock:
uv lock

# Upgrade pre-commit hooks
pc-up:
{{uv-tool}} pre-commit autoupdate
{{uvt}} pre-commit autoupdate

# Run pre-commit hooks
pc-run:
{{uv-tool}} pre-commit run --all-files
{{uvt}} pre-commit run --all-files

# Run Docker compose up on the development environment
dc-up-dev:
Expand All @@ -86,4 +82,4 @@ dc-exec-dev:

# Generate a secret key for Django
secret:
{{uv}} manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
{{uvr}} manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"