Summary
Convert every public symbol in litestar.repository.* into a thin deprecation shim that re-exports from advanced_alchemy.* and emits DeprecationWarning on access via PEP 562 module __getattr__. Internal Litestar callers (3 sites: 1 e2e test, 2 docs/examples) migrate to direct advanced_alchemy imports so the package does not warn against itself.
The custom tests/unit/test_repository/ directory is deleted — the abstract repository and the generic mock have no advanced_alchemy migration target, and rewriting 443 LOC of mock-repository tests against advanced_alchemy's testing utilities is out of scope. A new tests/unit/test_repository_deprecation.py asserts the deprecation warnings fire correctly across every public symbol.
This sets up the deprecation-then-removal pathway for the abstract repository module that PR #3299 originally proposed as a hard removal in 2024.
Out of scope (delegated to pre-ga-shim-removal)
git rm -r litestar/repository/ (whole module).
git rm -r docs/reference/repository/ (3 RSTs).
- Stripping
docs/conf.py lines 209-212 (litestar.repository.*.id_attribute PY_ATTR nitpick suppressions — they remain valid while the shims live).
Scope (this PR)
- Migrate 3 in-tree call sites:
tests/e2e/test_advanced_alchemy.py:4, docs/examples/sqla/sqlalchemy_repository_bulk_operations.py:10, docs/examples/sqla/sqlalchemy_sync_repository.py:24.
- Add deprecation shims to:
litestar/repository/__init__.py, exceptions.py, filters.py, handlers.py, abc/__init__.py, testing/__init__.py. Move handlers.py body to a private _handlers.py.
- Rewrite 7 in-package internal cross-imports to use private modules (
_filters, _exceptions, abc._async, abc._sync) so the package does not warn against itself.
- Delete
tests/unit/test_repository/ (4 files, 768 LOC).
- Add
tests/unit/test_repository_deprecation.py.
- Add
.. deprecated:: 3.0.0 directives to docs/reference/repository/{abc,handlers,testing}.rst.
- Bootstrap
docs/release-notes/migration_guide_3.rst with the deprecation table.
- Append "Deprecated" entries to
whats-new-3.rst and changelog.rst.
Summary
Convert every public symbol in
litestar.repository.*into a thin deprecation shim that re-exports fromadvanced_alchemy.*and emitsDeprecationWarningon access via PEP 562 module__getattr__. Internal Litestar callers (3 sites: 1 e2e test, 2 docs/examples) migrate to directadvanced_alchemyimports so the package does not warn against itself.The custom
tests/unit/test_repository/directory is deleted — the abstract repository and the generic mock have noadvanced_alchemymigration target, and rewriting 443 LOC of mock-repository tests against advanced_alchemy's testing utilities is out of scope. A newtests/unit/test_repository_deprecation.pyasserts the deprecation warnings fire correctly across every public symbol.This sets up the deprecation-then-removal pathway for the abstract repository module that PR #3299 originally proposed as a hard removal in 2024.
Out of scope (delegated to
pre-ga-shim-removal)git rm -r litestar/repository/(whole module).git rm -r docs/reference/repository/(3 RSTs).docs/conf.pylines 209-212 (litestar.repository.*.id_attributePY_ATTR nitpick suppressions — they remain valid while the shims live).Scope (this PR)
tests/e2e/test_advanced_alchemy.py:4,docs/examples/sqla/sqlalchemy_repository_bulk_operations.py:10,docs/examples/sqla/sqlalchemy_sync_repository.py:24.litestar/repository/__init__.py,exceptions.py,filters.py,handlers.py,abc/__init__.py,testing/__init__.py. Movehandlers.pybody to a private_handlers.py._filters,_exceptions,abc._async,abc._sync) so the package does not warn against itself.tests/unit/test_repository/(4 files, 768 LOC).tests/unit/test_repository_deprecation.py... deprecated:: 3.0.0directives todocs/reference/repository/{abc,handlers,testing}.rst.docs/release-notes/migration_guide_3.rstwith the deprecation table.whats-new-3.rstandchangelog.rst.