Skip to content

Commit

Permalink
Merge pull request #158 from lsst-sqre/tickets/DM-43846
Browse files Browse the repository at this point in the history
DM-43846: Update dependencies
  • Loading branch information
rra authored Apr 11, 2024
2 parents 5f34be5 + d8e812a commit ced9e42
Show file tree
Hide file tree
Showing 15 changed files with 616 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "py,coverage-report,typing"
tox-plugins: tox-docker
tox-plugins: "tox-docker tox-uv"

build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/periodic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
python-version: ${{ matrix.python }}
tox-envs: "lint,typing,py"
use-cache: false
tox-plugins: tox-docker
tox-plugins: "tox-docker tox-uv"

- name: Report status
if: always()
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# - Runs a non-root user.
# - Sets up the entrypoint and port.

FROM python:3.12.2-slim-bullseye as base-image
FROM python:3.12.2-slim-bookworm as base-image

# Update system packages
COPY scripts/install-base-packages.sh .
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# are based on stack containers and install any required supporting code
# for the image cutout backend, Dramatiq, and the backend worker definition.

FROM lsstsqre/centos:7-stack-lsst_distrib-w_2024_05
FROM lsstsqre/centos:7-stack-lsst_distrib-w_2024_15

# Reset the user to root since we need to do system install tasks.
USER root
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ help:
.PHONY: init
init:
pip install --upgrade uv
uv pip install pre-commit tox
uv pip install --editable .
uv pip install -r requirements/main.txt -r requirements/dev.txt
uv pip install --editable .
rm -rf .tox
pre-commit install

Expand Down
3 changes: 3 additions & 0 deletions changelog.d/20240411_104926_rra_DM_43846.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Other changes

- Update to the latest weekly as a base image for the cutout worker, which picks up new versions of lsst-resources and the Butler client.
5 changes: 5 additions & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

-c main.txt

# Development
pre-commit
tox
tox-uv

# Testing and linting
asgi-lifespan
coverage[toml]
Expand Down
472 changes: 307 additions & 165 deletions requirements/dev.txt

Large diffs are not rendered by default.

545 changes: 275 additions & 270 deletions requirements/main.txt

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from asgi_lifespan import LifespanManager
from dramatiq.middleware import CurrentMessage
from fastapi import FastAPI
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from safir.database import create_database_engine, initialize_database
from safir.datetime import current_datetime, isodatetime
from safir.testing.gcs import MockStorageClient, patch_google_storage
Expand Down Expand Up @@ -73,8 +73,9 @@ async def app() -> AsyncIterator[FastAPI]:
@pytest_asyncio.fixture
async def client(app: FastAPI) -> AsyncIterator[AsyncClient]:
"""Return an ``httpx.AsyncClient`` configured to talk to the test app."""
transport = ASGITransport(app=app) # type: ignore[arg-type]
async with AsyncClient(
app=app,
transport=transport,
base_url="https://example.com/",
headers={"X-Auth-Request-Token": "sometoken"},
) as client:
Expand Down
5 changes: 3 additions & 2 deletions tests/handlers/async_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from dramatiq import Worker
from fastapi import FastAPI
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient

from vocutouts.broker import broker

Expand Down Expand Up @@ -137,8 +137,9 @@ async def test_redirect(app: FastAPI) -> None:
the redirect to honor ``X-Forwarded-Proto`` and thus use ``https``. Also
test that the correct hostname is used if it is different.
"""
transport = ASGITransport(app=app) # type: ignore[arg-type]
async with AsyncClient(
app=app,
transport=transport,
base_url="http://foo.com/",
headers={"X-Auth-Request-Token": "sometoken"},
) as client:
Expand Down
7 changes: 5 additions & 2 deletions tests/handlers/external_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest
from fastapi import FastAPI
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient

from vocutouts.config import config

Expand Down Expand Up @@ -83,7 +83,10 @@ async def test_capabilities_urls(app: FastAPI) -> None:
the generated URLs to honor ``X-Forwarded-Proto`` and thus use ``https``.
We also want to honor the ``Host`` header.
"""
async with AsyncClient(app=app, base_url="http://foo.com/") as client:
transport = ASGITransport(app=app) # type: ignore[arg-type]
async with AsyncClient(
transport=transport, base_url="http://foo.com/"
) as client:
r = await client.get(
"/api/cutout/capabilities",
headers={
Expand Down
6 changes: 3 additions & 3 deletions tests/uws/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from asgi_lifespan import LifespanManager
from dramatiq import Broker
from fastapi import FastAPI
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from safir.database import create_database_engine, initialize_database
from safir.dependencies.db_session import db_session_dependency
from safir.dependencies.http_client import http_client_dependency
Expand Down Expand Up @@ -89,10 +89,10 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
@pytest_asyncio.fixture
async def client(app: FastAPI) -> AsyncIterator[AsyncClient]:
"""Return an ``httpx.AsyncClient`` configured to talk to the test app."""
transport = ASGITransport(app=app) # type: ignore[arg-type]
async with AsyncClient(
app=app,
transport=transport,
base_url="https://example.com/",
# Mock the Gafaelfawr delegated token header.
headers={"X-Auth-Request-Token": "sometoken"},
) as client:
yield client
Expand Down
7 changes: 5 additions & 2 deletions tests/uws/job_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pytest
from dramatiq import Worker
from fastapi import FastAPI
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from safir.datetime import isodatetime
from structlog.stdlib import BoundLogger

Expand Down Expand Up @@ -368,7 +368,10 @@ async def test_redirects(

# Try various actions that result in redirects and ensure the redirect is
# correct.
async with AsyncClient(app=app, base_url="http://foo.com/") as client:
transport = ASGITransport(app=app) # type: ignore[arg-type]
async with AsyncClient(
transport=transport, base_url="http://foo.com/"
) as client:
r = await client.post(
"/jobs/1/destruction",
headers={
Expand Down

0 comments on commit ced9e42

Please sign in to comment.