From 8ceeda4f1c3727ee9e99b8b3e30d11b7b3ea9796 Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Sat, 12 Oct 2024 17:26:32 +1300 Subject: [PATCH 1/2] Remove .python-version from gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7faf52d..1b09487 100644 --- a/.gitignore +++ b/.gitignore @@ -52,9 +52,6 @@ coverage.xml # Jupyter Notebook .ipynb_checkpoints -# pyenv -.python-version - # celery celerybeat-schedule.* From 48d835f37e23bfc92e2510e9d0b13bb5de41880b Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Sat, 12 Oct 2024 17:26:47 +1300 Subject: [PATCH 2/2] Update uv workflow --- .github/workflows/test.yml | 2 +- .python-version | 1 + justfile | 50 ++++++++++++++++++-------------------- 3 files changed, 25 insertions(+), 28 deletions(-) create mode 100644 .python-version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d02d42d..fc7ab57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/justfile b/justfile index cdbefc9..78f04a2 100644 --- a/justfile +++ b/justfile @@ -2,63 +2,59 @@ 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: @@ -66,11 +62,11 @@ 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: @@ -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())"