Skip to content

Commit

Permalink
Merge pull request #252 from lsst/tickets/DM-43714
Browse files Browse the repository at this point in the history
DM-43714: Use tox-uv for Python templates
  • Loading branch information
rra committed Apr 17, 2024
2 parents 0424573 + 1991eab commit f9d8347
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "py,coverage-report,typing"
tox-requirements: requirements/tox.txt

build:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "lint,typing,py"
tox-requirements: requirements/tox.txt
use-cache: false

- name: Report status
Expand Down
9 changes: 7 additions & 2 deletions project_templates/fastapi_safir_app/example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ help:
.PHONY: init
init:
pip install --upgrade uv
uv pip install --upgrade pre-commit tox
uv pip install -r requirements/main.txt -r requirements/dev.txt \
-r requirements/tox.txt
uv pip install --editable .
uv pip install -r requirements/main.txt -r requirements/dev.txt
rm -rf .tox
uv pip install --upgrade pre-commit
pre-commit install

.PHONY: run
Expand All @@ -32,6 +33,8 @@ update-deps:
--output-file requirements/main.txt requirements/main.in
uv pip compile --upgrade --generate-hashes \
--output-file requirements/dev.txt requirements/dev.in
uv pip compile --upgrade --generate-hashes \
--output-file requirements/tox.txt requirements/tox.in

# Useful for testing against a Git version of Safir.
.PHONY: update-deps-no-hashes
Expand All @@ -41,3 +44,5 @@ update-deps-no-hashes:
--output-file requirements/main.txt requirements/main.in
uv pip compile --upgrade \
--output-file requirements/dev.txt requirements/dev.in
uv pip compile --upgrade \
--output-file requirements/tox.txt requirements/tox.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ asgi-lifespan
coverage[toml]
httpx
mypy
pre-commit
pydantic
pytest
pytest-asyncio
pytest-cov
ruff

# Documentation
scriv
14 changes: 14 additions & 0 deletions project_templates/fastapi_safir_app/example/requirements/tox.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- conf -*-
#
# Editable tox dependencies
# Add tox and its plugins here. These will be installed in the user's venv for
# local development and by CI when running tox actions.
#
# After editing, update requirements/dev.txt by running:
# make update-deps

-c main.txt
-c dev.txt

tox
tox-uv
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
with:
python-version: {{ "${{ matrix.python }}" }}
tox-envs: "py,coverage-report,typing"
tox-requirements: requirements/tox.txt

build:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
python-version: {{ "${{ matrix.python }}" }}
tox-envs: "lint,typing,py"
tox-requirements: requirements/tox.txt
use-cache: false
{% if cookiecutter.github_org == "lsst-sqre" %}
- name: Report status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ help:
.PHONY: init
init:
pip install --upgrade uv
uv pip install --upgrade pre-commit tox
uv pip install -r requirements/main.txt -r requirements/dev.txt \
-r requirements/tox.txt
uv pip install --editable .
uv pip install -r requirements/main.txt -r requirements/dev.txt
rm -rf .tox
uv pip install --upgrade pre-commit
pre-commit install

.PHONY: run
Expand All @@ -32,6 +33,8 @@ update-deps:
--output-file requirements/main.txt requirements/main.in
uv pip compile --upgrade --generate-hashes \
--output-file requirements/dev.txt requirements/dev.in
uv pip compile --upgrade --generate-hashes \
--output-file requirements/tox.txt requirements/tox.in

# Useful for testing against a Git version of Safir.
.PHONY: update-deps-no-hashes
Expand All @@ -41,3 +44,5 @@ update-deps-no-hashes:
--output-file requirements/main.txt requirements/main.in
uv pip compile --upgrade \
--output-file requirements/dev.txt requirements/dev.in
uv pip compile --upgrade \
--output-file requirements/tox.txt requirements/tox.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ asgi-lifespan
coverage[toml]
httpx
mypy
pre-commit
pydantic
pytest
pytest-asyncio
pytest-cov
ruff

# Documentation
scriv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- conf -*-
#
# Editable tox dependencies
# Add tox and its plugins here. These will be installed in the user's venv for
# local development and by CI when running tox actions.
#
# After editing, update requirements/dev.txt by running:
# make update-deps

-c main.txt
-c dev.txt

tox
tox-uv
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "py,typing"
tox-plugins: tox-uv

docs:

Expand All @@ -73,6 +74,7 @@ jobs:
tox-envs: "docs"
# Add docs-linkcheck when the docs and PyPI package are published
# tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv

# Only attempt documentation uploads for tagged releases and pull
# requests from ticket branches in the same repository. This avoids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "lint,typing,py"
tox-plugins: tox-uv
use-cache: false

docs:
Expand All @@ -40,6 +41,7 @@ jobs:
with:
python-version: "3.12"
tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv
use-cache: false

test-packaging:
Expand Down
4 changes: 2 additions & 2 deletions project_templates/square_pypi_package/example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ clean:
.PHONY: init
init:
pip install --upgrade uv
uv pip install --upgrade pip tox pre-commit
uv pip install --upgrade pre-commit tox tox-uv
uv pip install --upgrade -e ".[dev]"
pre-commit install
rm -rf .tox
Expand All @@ -41,5 +41,5 @@ update: update-deps init
.PHONY: update-deps
update-deps:
pip install --upgrade uv
uv pip install pre-commit
uv pip install --upgrade pre-commit
pre-commit autoupdate
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dev = [
"coverage[toml]",
"pytest",
"pytest-asyncio",
"pre-commit",
"mypy",
# Documentation
"documenteer[guide]<2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
with:
python-version: {{ "${{ matrix.python }}" }}
tox-envs: "py,typing"
tox-plugins: tox-uv

docs:

Expand All @@ -73,6 +74,7 @@ jobs:
tox-envs: "docs"
# Add docs-linkcheck when the docs and PyPI package are published
# tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv

# Only attempt documentation uploads for tagged releases and pull
# requests from ticket branches in the same repository. This avoids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
python-version: {{ "${{ matrix.python }}" }}
tox-envs: "lint,typing,py"
tox-plugins: tox-uv
use-cache: false

docs:
Expand All @@ -40,6 +41,7 @@ jobs:
with:
python-version: "3.12"
tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv
use-cache: false

test-packaging:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ clean:
.PHONY: init
init:
pip install --upgrade uv
uv pip install --upgrade pip tox pre-commit
uv pip install --upgrade pre-commit tox tox-uv
uv pip install --upgrade -e ".[dev]"
pre-commit install
rm -rf .tox
Expand All @@ -41,5 +41,5 @@ update: update-deps init
.PHONY: update-deps
update-deps:
pip install --upgrade uv
uv pip install pre-commit
uv pip install --upgrade pre-commit
pre-commit autoupdate
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dev = [
"coverage[toml]",
"pytest",
"pytest-asyncio",
"pre-commit",
"mypy",
# Documentation
"documenteer[guide]<2",
Expand Down
2 changes: 1 addition & 1 deletion project_templates/technote_md/testn-000/technote.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ series_id = "TESTN"
canonical_url = "https://testn-000.lsst.io"
github_url = "https://github.com/lsst/testn-000"
github_default_branch = "main"
date_created = 2024-04-09T19:31:55Z
date_created = 2024-04-17T18:46:44Z
organization.name = "Vera C. Rubin Observatory"
organization.ror = "https://ror.org/048g3cy84"
license.id = "CC-BY-4.0"
Expand Down
2 changes: 1 addition & 1 deletion project_templates/technote_rst/testn-000/technote.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ series_id = "TESTN"
canonical_url = "https://testn-000.lsst.io"
github_url = "https://github.com/lsst/testn-000"
github_default_branch = "main"
date_created = 2024-04-09T19:31:55Z
date_created = 2024-04-17T18:46:44Z
organization.name = "Vera C. Rubin Observatory"
organization.ror = "https://ror.org/048g3cy84"
license.id = "CC-BY-4.0"
Expand Down

0 comments on commit f9d8347

Please sign in to comment.