Skip to content

Extract palace.opds into a uv workspace package (PP-4074)#3230

Merged
jonathangreen merged 4 commits intomainfrom
chore/extract-palace-opds
Apr 14, 2026
Merged

Extract palace.opds into a uv workspace package (PP-4074)#3230
jonathangreen merged 4 commits intomainfrom
chore/extract-palace-opds

Conversation

@jonathangreen
Copy link
Copy Markdown
Member

@jonathangreen jonathangreen commented Apr 13, 2026

Description

Move palace.manager.opds into a new workspace package palace-opds (namespace palace.opds) and retarget all callers to palace.opds.*. palace-opds depends on palace-util for the small set of cross-cutting symbols the OPDS models need (PalaceValueError, utc_now / to_utc, LoggerMixin); it depends on no other Palace package — same dependency-graph rule documented in #3231.

Motivation and Context

The OPDS Pydantic model tree describes formats exchanged across system boundaries — other Palace services and ingestion tools could reuse it without dragging in the full palace-manager application. Extracting it as a workspace member lets us publish it independently in the future while keeping the monorepo as the source of truth.

JIRA: PP-4074

How Has This Been Tested?

  • uv sync resolves the workspace cleanly with all three members.
  • uv build --package palace-opds produces a wheel containing only palace/opds/**.
  • mypy passes (1126 source files).
  • pytest tests/palace_opds tests/palace_util — 232 tests pass.
  • Full DB-requiring suite (tox -e py312-docker) will run in CI.

Conventions

This PR follows the workspace-member conventions established in #3231:

  • Tests live under tests/palace_opds/ (mirrors the tests/palace_util/ layout) so they share root pytest fixtures and conftest plugins automatically.
  • No re-export shims in palace.manager — callers import from palace.opds.* directly.
  • Workspace-member pyproject.toml files are copied (manifest-only) into the Docker cache layer so uv can resolve workspace deps.
  • palace-opds/README.md follows the same template as palace-util/README.md — purpose, scope, dependency-graph hard rule, stability, development.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.30%. Comparing base (773e930) to head (568b49d).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3230      +/-   ##
==========================================
- Coverage   93.31%   93.30%   -0.01%     
==========================================
  Files         498      498              
  Lines       46147    46147              
  Branches     6318     6318              
==========================================
- Hits        43060    43059       -1     
  Misses       2003     2003              
- Partials     1084     1085       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch from 62c3010 to 1cfbce1 Compare April 13, 2026 17:16
@jonathangreen jonathangreen changed the title Extract palace.opds and palace.util into uv workspace packages Extract palace.opds into a uv workspace package Apr 13, 2026
@jonathangreen jonathangreen changed the base branch from chore/migrate-poetry-to-uv to chore/extract-palace-util April 13, 2026 17:17
@jonathangreen jonathangreen force-pushed the chore/extract-palace-util branch 2 times, most recently from 193d6be to f523689 Compare April 13, 2026 17:44
@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch from 1cfbce1 to e8f5c0c Compare April 13, 2026 17:47
@jonathangreen jonathangreen force-pushed the chore/extract-palace-util branch from f523689 to 5001201 Compare April 13, 2026 17:49
@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch from e8f5c0c to d22102d Compare April 13, 2026 17:52
@jonathangreen jonathangreen force-pushed the chore/extract-palace-util branch 2 times, most recently from 5c84059 to 3da1c0d Compare April 14, 2026 13:24
@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch 3 times, most recently from 659eb42 to e5d909b Compare April 14, 2026 14:59
@jonathangreen jonathangreen requested a review from a team April 14, 2026 15:11
Copy link
Copy Markdown
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, too. 🚀

One overall comment: Since this is just for OPDS models, should it be named palace-opds-models to avoid confusion with other Palace OPDS stuff? If so, I'd say that now is the time to do it.

@jonathangreen jonathangreen force-pushed the chore/extract-palace-util branch from f1a63b2 to 5e5983c Compare April 14, 2026 19:01
Base automatically changed from chore/extract-palace-util to main April 14, 2026 19:24
jonathangreen added a commit that referenced this pull request Apr 14, 2026
## Description

Convert the repo into a [`uv`
workspace](https://docs.astral.sh/uv/concepts/projects/workspaces/) and
carve out a new namespace package `palace-util` (namespace
`palace.util`) that sits at the bottom of the Palace dependency graph —
other Palace packages depend on it; it depends on no other Palace
package. The package holds the small set of reusable, dependency-light
utilities:

- `palace.util.exceptions` — the base of Palace exception hierarchy 
- `palace.util.datetime_helpers` — timezone-aware datetime helpers.
- `palace.util.log` — the standardized logging toolkit 

## Motivation and Context

Sets up the monorepo as a `uv` workspace and extracts the minimum subset
of palace-manager that needs to come along with the upcoming
`palace-opds` extraction (#3230). Having `palace-util` as its own
workspace member lets both `palace-manager` and `palace-opds` (and
eventually any other Palace project) depend on it without any of them
pulling in each other.

JIRA: PP-4076

## How Has This Been Tested?

- Tests run in CI

## Checklist

- [x] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch from e5d909b to f42c076 Compare April 14, 2026 19:26
@jonathangreen jonathangreen marked this pull request as ready for review April 14, 2026 19:26
@jonathangreen jonathangreen changed the title Extract palace.opds into a uv workspace package Extract palace.opds into a uv workspace package (PP-4074) Apr 14, 2026
@jonathangreen
Copy link
Copy Markdown
Member Author

I think palace-opds works as a package name. Kind of like pyopds2.

Stacked on the palace-util extraction. Move palace.manager.opds into a
new workspace package at packages/palace-opds/ (namespace palace.opds)
and retarget all callers. The OPDS model tree is generic and reusable
across Palace projects; making it a standalone workspace member lets us
publish it independently without dragging in palace-manager.

palace-opds depends on palace-util for the three small cross-cutting
symbols the models need (PalaceValueError, utc_now/to_utc, LoggerMixin).

Callers rewritten (palace.manager.opds.* → palace.opds.*):
- 17 source files across palace.manager.{api, celery, data_layer, feed,
  integration, sqlalchemy}.
- 15 test files across tests/manager/**.

Moved tests:
- tests/manager/opds/** → packages/palace-opds/tests/opds/**. The 5
  tests that only use OPDS2FilesFixture / OPDS2WithODLFilesFixture as
  type annotations now import them under TYPE_CHECKING so the package
  tests don't need tests.fixtures.files at import time; pytest still
  injects the fixtures at runtime via the root-conftest plugin.
- tests/manager/opds/types/test_language.py: replace LogLevel.warning
  with stdlib logging.WARNING so the test has no palace.manager import.

Tooling:
- pyproject.toml: palace-opds added to [project.dependencies],
  workspace members, mypy files/mypy_path, coverage source, pytest
  testpaths. tests-mypy override picks up "opds.*".
- docker/Dockerfile, docker/Dockerfile.baseimage: copy
  packages/palace-opds/pyproject.toml in the cache layer alongside
  palace-util.
- README.md, CLAUDE.md: workspace section extended with palace-opds.
…hing

Add a [tool.isort] block to packages/palace-opds/pyproject.toml that
treats palace.opds as FIRSTPARTY (the package's own namespace) and
palace.util as PALACE (other Palace package).

Pass --resolve-all-configs (with --config-root .) to the pre-commit
isort hook. Without this, pre-commit's batched --all-files invocation
uses a single isort config (whichever it discovers first) for every
file in the batch, defeating per-package configs and producing
non-deterministic results between local and CI runs.

Reflow the four palace-opds source files that imported both
palace.opds and palace.util — they now show palace.util in PALACE
above palace.opds in FIRSTPARTY.
Rewrite packages/palace-opds/README.md from an internal-conventions
doc (workspace dependency rules, test layout, contributor criteria)
into a consumer-facing one: what specs are covered, how to install,
a quick usage example, design tradeoffs, then a short Project context
section that acknowledges the Palace origin and points back to the
monorepo for contributions. The internal-conventions content lives
in CLAUDE.md where contributors look for it.

Drop pydantic-xml from the dependencies — it was inherited from the
palace-manager dep list but isn't actually imported anywhere in
packages/palace-opds/src/. palace-manager keeps its own pydantic-xml
dep for the places it does use it.
Without this file downstream packages using mypy will treat every
import from palace.opds as untyped, losing the type information the
Pydantic models already carry. PEP 561 requires the empty marker to
opt the package into inline-typing distribution.
@jonathangreen jonathangreen force-pushed the chore/extract-palace-opds branch from f42c076 to 568b49d Compare April 14, 2026 19:30
@jonathangreen jonathangreen enabled auto-merge (squash) April 14, 2026 19:30
@jonathangreen jonathangreen merged commit 11171c1 into main Apr 14, 2026
20 checks passed
@jonathangreen jonathangreen deleted the chore/extract-palace-opds branch April 14, 2026 19:40
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