Skip to content

DM-55493: Add safir to square_pypi_package dev dependencies - #353

Open
jonathansick wants to merge 1 commit into
mainfrom
tickets/DM-55493a
Open

DM-55493: Add safir to square_pypi_package dev dependencies#353
jonathansick wants to merge 1 commit into
mainfrom
tickets/DM-55493a

Conversation

@jonathansick

Copy link
Copy Markdown
Member

Summary

The data fixture added to both templates in 9f67f2b imports
safir.testing.data.Data in the generated tests/conftest.py, but
square_pypi_package's dev extra lists only coverage, pytest,
pytest-asyncio, mypy, documenteer, and scriv — no safir.

A freshly generated package therefore fails at test collection:

ImportError while loading conftest '.../tests/conftest.py'.
ModuleNotFoundError: No module named 'safir'

fastapi_safir_app is unaffected, since safir is a runtime dependency there.

This adds safir>=14.2.0 to the dev extra — 14.2.0 is the release that
introduced safir.testing.data.

Alternative worth considering

The minimal fix preserves the intent of 9f67f2b, but it does mean every
generated pure-Python package pulls safir into its dev environment purely
for the test-data fixture. If that isn't wanted for a generic PyPI package
template, the other option is to drop the fixture from
square_pypi_package instead and keep it in fastapi_safir_app only.
Happy to switch this PR to that approach — I picked the one that keeps
the fixture working.

Validation

  • scons re-rendered the example; the regenerated
    square_pypi_package/example/pyproject.toml is included.
  • templatekit check (with the two technote.toml ignores CI uses)
    passes: ✅ Passed!

References

Found while scanning template changes for the lsst-sqre maintenance
catalog. Ticket: DM-55493.

The generated tests/conftest.py imports safir.testing.data.Data, but the
dev extra did not include safir, so a freshly generated package fails at
test collection with ModuleNotFoundError.

safir>=14.2.0 is the release that introduced safir.testing.data.
@rra

rra commented Jul 28, 2026

Copy link
Copy Markdown
Member

Oh, this is a good point, we should probably talk about this in the context of our still unresolved question about the role of Safir as a library. I was going to bring that up next week when I'm back at work, since I also want to get the UWS pattern moved onto service discovery, which will require resolving that. I completely forgot that square_pypi_package didn't already depend on Safir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants