Skip to content

Commit

Permalink
Merge pull request #123 from stuartmaxwell:update-uv-workflow
Browse files Browse the repository at this point in the history
Update-uv-workflow
  • Loading branch information
stuartmaxwell authored Oct 12, 2024
2 parents 007c07a + 48d835f commit fc4036b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
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())"

0 comments on commit fc4036b

Please sign in to comment.