Skip to content

Commit

Permalink
Switch to just and uv (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve authored Dec 10, 2024
1 parent 318c9f1 commit bb7ac49
Show file tree
Hide file tree
Showing 14 changed files with 1,798 additions and 212 deletions.
111 changes: 69 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: test
name: Test

on: [ push, pull_request ]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: test-${{ github.head_ref }}
Expand All @@ -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
Expand All @@ -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()
Expand Down
82 changes: 27 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
# Example database
example/db.sqlite3
24 changes: 13 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## In development

- Switch to just and uv for package management (#734).
- Remove `<nav>` from pagination (#686, @xi).
- Drop support for Python 3.8 in the test matrix

Expand Down
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,28 @@ You will need some knowledge of git, github, and Python/Django development. Usin

### Local installation

This section assumes you know about local Python versions and virtual environments.
This package uses [uv](https://github.com/astral-sh/uv) and [just](https://github.com/casey/just).

To clone the repository and install the requirements for local development:
After installing both, check out this repository and type `just bootstrap` to bootstrap a development environment.

```console
git clone git://github.com/zostera/django-bootstrap5.git
cd django-bootstrap5
pip install -U pip -r requirements-dev.txt
pip install -e .
just bootstrap
```

### Running the tests

To run the tests:

```console
make test
just test
```

To run the tests on all supported Python/Django combinations:

```console
make tests
just tests
```

## Pull Request Guidelines
Expand Down
67 changes: 0 additions & 67 deletions Makefile

This file was deleted.

Loading

0 comments on commit bb7ac49

Please sign in to comment.