From bb7ac49c7ca556311c16ddfecd9c0287329c1934 Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Tue, 10 Dec 2024 10:41:15 +0100 Subject: [PATCH] Switch to just and uv (#734) --- .github/workflows/test.yml | 111 ++- .gitignore | 82 +- .readthedocs.yaml | 24 +- CHANGELOG.md | 1 + CONTRIBUTING.md | 11 +- Makefile | 67 -- README.md | 4 +- docs/requirements.txt | 3 - justfile | 96 +++ pyproject.toml | 21 +- requirements-dev.txt | 8 - requirements-test.txt | 6 - tox.ini | 28 +- uv.lock | 1548 ++++++++++++++++++++++++++++++++++++ 14 files changed, 1798 insertions(+), 212 deletions(-) delete mode 100644 Makefile delete mode 100644 docs/requirements.txt create mode 100644 justfile delete mode 100644 requirements-dev.txt delete mode 100644 requirements-test.txt create mode 100644 uv.lock diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b36e308..9b29e8b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ -name: test +name: Test -on: [ push, pull_request ] +on: + push: + branches: ["main"] + pull_request: concurrency: group: test-${{ github.head_ref }} @@ -18,7 +21,7 @@ jobs: needs: [ ruff ] strategy: matrix: - python-version: [3.9, "3.10", 3.11, 3.12] + python-version: [3.9, "3.10", 3.11, 3.12, 3.13] django-version: [4.2, 5.0, 5.1, "main"] exclude: # Django 5.0 @@ -34,61 +37,85 @@ jobs: django-version: "main" steps: - - uses: actions/checkout@v4 - - name: Update repositories - run: sudo apt-get update - - name: Install GDAL binaries - run: sudo apt-get install binutils libproj-dev gdal-bin - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: requirements-test.txt - - run: python -m pip install -r requirements-test.txt - - run: python -m pip install -U Django==${{ matrix.django-version }} - if: matrix.django-version != 'main' - - run: python -m pip install -U https://github.com/django/django/archive/master.tar.gz - if: matrix.django-version == 'main' - - run: python -m pip install -e . - - run: coverage run manage.py test - - run: python -m pip install -U coveralls - - name: Upload coveralls (parallel) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_PARALLEL: true - run: coveralls --service=github + - uses: actions/checkout@v4 + + - name: Update repositories + run: sudo apt-get update + + - name: Install GDAL binaries + run: sudo apt-get install binutils libproj-dev gdal-bin + + - name: Set up Python with uv + uses: drivendataorg/setup-python-uv-action@main + with: + python-version: ${{ matrix.python-version }} + cache: packages + cache-dependency-path: >- + pyproject.toml + + - name: Install dependencies + run: uv sync --all-extras --all-groups --upgrade + + - name: Install Django ${{ matrix.django-version }} + run: uv pip install Django==${{ matrix.django-version }} + if: matrix.django-version != 'main' + - name: Install Django main branch + run: uv pip install -U https://github.com/django/django/archive/master.tar.gz + if: matrix.django-version == 'main' + + - name: Run tests + run: | + uv run coverage run manage.py test + uv run coverage report + + - name: Upload coveralls (parallel) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + run: | + uv pip install coveralls + uv run coveralls --service=github + docs: runs-on: ubuntu-latest needs: [ tests_matrix ] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + + - name: Set up Python with uv + uses: drivendataorg/setup-python-uv-action@main with: - python-version: "3.11" - cache: 'pip' - cache-dependency-path: docs/requirements.txt + python-version: 3.12 + cache: packages + cache-dependency-path: >- + pyproject.toml + + - name: Set up just + uses: extractions/setup-just@v2 + - name: Build documentation - run: | - python -m pip install -r docs/requirements.txt - make docs + run: just docs build: runs-on: ubuntu-latest needs: [ tests_matrix ] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + + - name: Set up Python with uv + uses: drivendataorg/setup-python-uv-action@main with: - python-version: "3.11" - cache: 'pip' - cache-dependency-path: requirements-dev.txt - - name: Build package - run: | - python -m pip install -r requirements-dev.txt - make build + python-version: 3.12 + cache: packages + cache-dependency-path: >- + pyproject.toml + - name: Set up just + uses: extractions/setup-just@v2 + + - name: Build package + run: just build tests: if: always() diff --git a/.gitignore b/.gitignore index 1054e7b4..b3fd3cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,65 +1,37 @@ -# Python -*.py[cod] - -# C extensions -*.so -# Packages -.eggs -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 -pip-wheel-metadata/ +# Editors +.vscode/ +.idea/ -# Installer logs -pip-log.txt -*.log +# Local development +.python-version +.env* +.venv -# Unit test / coverage reports -htmlcov/ +# Testing +.coverage* .tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover - -# Translations -*.mo -*.pot -# Mr Developer -.mr.developer.cfg -.project -.pydevproject +# Vagrant +.vagrant/ -# Complexity -output/*.html -output/*/index.html +# Mac/OSX +.DS_Store -# Sphinx -docs/_build +# Windows +Thumbs.db -# Pycharm -.idea* - -# Django -local_settings.py +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class -# pyenv -.python-version -reports +# Distribution / packaging +*.egg-info +docs/_build/ +dist/ +build/ +build-check-description/ -# example database -example/db.sqlite3 \ No newline at end of file +# Example database +example/db.sqlite3 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 6cf291b8..de20c18c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,19 +1,21 @@ -# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +# Required version: 2 +# Set the version of Python and other tools you might need build: - os: ubuntu-22.04 - tools: - python: "3.11" + os: ubuntu-22.04 + tools: + python: "3.12" + commands: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + - uv sync --only-group docs --frozen + - uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html +# Build documentation in the docs/ directory with Sphinx sphinx: - configuration: docs/conf.py - -python: - install: - - requirements: docs/requirements.txt - - method: pip - path: . + configuration: docs/conf.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 094b3bfb..426339ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## In development +- Switch to just and uv for package management (#734). - Remove `