Add deprecation shims for bundled_libraries module globals - #6967
Conversation
#6382 moved the module-level `bundled_libraries` list out of `reflex_base.components.dynamic` and onto `RegistrationContext`, which breaks every published reflex-enterprise (0.8.0 through 0.9.4a4 all read `dynamic.bundled_libraries` in `LiteralLambdaVar._validate_and_extend_return_expr`) when paired with reflex-base 0.9.9. Add a module-level `__getattr__` that resolves `bundled_libraries` (and `DEFAULT_BUNDLED_LIBRARIES`) against the active `RegistrationContext` and emits a deprecation warning pointing at the new API. Because it resolves on each attribute access, callers see the live list for whatever context is current rather than an import-time snapshot. reflex-enterprise reaches the module through `reflex.components.dynamic`, whose star re-export cannot see a module-level `__getattr__`, so that shim module gets a `__getattr__` delegating any missed name to `reflex_base.components.dynamic`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RU2VRJPPA3MWrjCGL15sy
Greptile SummaryThis PR restores deprecated read compatibility for bundled-library module globals by resolving them through the active registration context.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/components/dynamic.py | Adds deprecated module-level attribute shims backed by RegistrationContext while preserving standard AttributeError behavior. |
| reflex/components/dynamic.py | Delegates attributes omitted by the wildcard re-export to the base dynamic-components module. |
| tests/units/reflex_base/components/test_dynamic.py | Covers active-context resolution, namespace delegation, default values, warning emission, and unknown attributes. |
| news/+bundled-libraries-shim.deprecation.md | Documents the deprecated compatibility API and recommended replacements. |
| packages/reflex-base/news/6382.breaking.md | Clarifies that legacy reads remain supported until version 1.0. |
Reviews (2): Last reviewed commit: "Move bundled-libraries shim news fragmen..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
The fragment lands in the `reflex` changelog rather than reflex-base's, so name the `reflex.components.dynamic` path users import from. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RU2VRJPPA3MWrjCGL15sy
Maps in-flight PRs #6967/#6959 to findings, lists 11 fix-before-release items (security, confirmed regressions, high-impact/simple), and the post-release GitHub issue list for reflex and reflex-enterprise, with suggested sequencing. No fixes applied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMjBXPozsNeQNSBZecNH8x
Type of change
Description
Adds compatibility shims to maintain backward compatibility with downstream packages (notably reflex-enterprise) that read
reflex_base.components.dynamic.bundled_librariesandDEFAULT_BUNDLED_LIBRARIESdirectly.These module-level globals were moved onto
RegistrationContextin a prior breaking change. This PR restores read access to them via__getattr__hooks that:RegistrationContextwhen accessedAttributeErrorfor unknown attributesThe shims are implemented in:
reflex_base.components.dynamic.__getattr__()— handles the actual resolutionreflex/components/dynamic.__getattr__()— delegates to reflex_base for names the star import missesChanges
__getattr__()to provide deprecated access tobundled_librariesandDEFAULT_BUNDLED_LIBRARIES, resolving them against the active context with deprecation warnings__getattr__()to delegate attribute lookups to reflex_base (needed because star imports don't trigger__getattr__)Test Plan
Added unit tests covering:
All tests pass with adequate coverage.
Checklist
uv run ruff check .anduv run ruff format .cleanuv run pyright reflex testspasseshttps://claude.ai/code/session_019RU2VRJPPA3MWrjCGL15sy