Skip to content

Extract palace.util into a uv workspace package (PP-4076)#3231

Open
jonathangreen wants to merge 3 commits intomainfrom
chore/extract-palace-util
Open

Extract palace.util into a uv workspace package (PP-4076)#3231
jonathangreen wants to merge 3 commits intomainfrom
chore/extract-palace-util

Conversation

@jonathangreen
Copy link
Copy Markdown
Member

@jonathangreen jonathangreen commented Apr 13, 2026

Description

Convert the repo into a uv workspace 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

  • 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

❌ Patch coverage is 99.64664% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.30%. Comparing base (5b11aa7) to head (5e5983c).

Files with missing lines Patch % Lines
src/palace/manager/scripts/availability.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3231   +/-   ##
=======================================
  Coverage   93.30%   93.30%           
=======================================
  Files         497      498    +1     
  Lines       46144    46147    +3     
  Branches     6318     6318           
=======================================
+ Hits        43054    43058    +4     
  Misses       2004     2004           
+ Partials     1086     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-util branch 3 times, most recently from f523689 to 5001201 Compare April 13, 2026 17:49
@jonathangreen jonathangreen requested a review from a team April 14, 2026 12:50
@jonathangreen jonathangreen force-pushed the chore/extract-palace-util branch 2 times, most recently from 5c84059 to 3da1c0d Compare April 14, 2026 13:24
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. 🚀

The documentation updates are especially helpful. I didn't spend too much time looking at the changes under src/palace/manager, as I suspected (and it looked like) those changes were mostly about imports. Let me know if I misunderstood and, if so, I can take a deeper look there.

@jonathangreen jonathangreen force-pushed the chore/migrate-poetry-to-uv branch from 88c618a to c9d32ed Compare April 14, 2026 18:47
Base automatically changed from chore/migrate-poetry-to-uv to main April 14, 2026 18:58
Convert the repo into a uv workspace and carve out a new namespace
package at packages/palace-util/ (namespace palace.util) holding the
small set of cross-cutting utilities that are genuinely reusable.

- palace.util.exceptions: BasePalaceException, PalaceValueError,
  PalaceTypeError.
- palace.util.datetime_helpers: the full timezone-aware datetime
  helpers module (utc_now, to_utc, datetime_utc, from_timestamp,
  minute_timestamp, previous_months, strptime_utc).
- palace.util.log: LoggerMixin, LoggerType, LoggerAdapterType,
  logger_for_cls.
Root config: list workspace packages explicitly under known_palace
(['palace.opds', 'palace.util']) instead of the broad 'palace' prefix.
The broad prefix accidentally caught 'from palace import manager' (the
module being imported is 'palace', not 'palace.manager') and pulled it
into the PALACE section instead of FIRSTPARTY.

Add a per-package isort config to packages/palace-util so files there
treat palace.util as their FIRSTPARTY (and need no PALACE section since
palace-util depends on no other Palace package). isort discovers the
nearest pyproject.toml per-file, so editor and pre-commit invocations
pick the right config automatically.
Without this file downstream packages using mypy will treat every
import from palace.util as untyped, losing the type information the
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-util branch from f1a63b2 to 5e5983c Compare April 14, 2026 19:01
@jonathangreen jonathangreen marked this pull request as ready for review April 14, 2026 19:02
@jonathangreen jonathangreen changed the title Extract palace.util into a uv workspace package Extract palace.util into a uv workspace package (PP-4076) Apr 14, 2026
@jonathangreen jonathangreen enabled auto-merge (squash) April 14, 2026 19:06
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