feat(packaging): add src/_legacy deprecation shims and fill quant_platform_* facades#34
Merged
Conversation
… facades V6 Phase 8 — establish the single mechanism for handling legacy import paths: * src/_legacy/__init__.py introduces emit_deprecation() (one-shot DeprecationWarning + structured quant_platform.legacy log), install_module_alias() (sys.modules aliasing), an empty LEGACY_ALIASES catalogue PR reviewers can grep, and reset_deprecation_cache() for tests. V6 Phase 7 fill-out — give the quant_platform_* facades real content: * quant_platform_adapters_cn now re-exports broker/data/messaging/ml/realtime/storage from src.adapters; ADAPTER_GROUPS updated to list all six. * quant_platform_ml now re-exports the full src.mlops public surface, exposes src.adapters.ml as quant_platform_ml.adapters, and ships dedicated training/registry/inference submodules. * All re-exports preserve object identity with src.* canonical implementations. Tests: 7 new shim tests + 8 new facade tests. Local CI test job: 1294 passed, 34 skipped (pre-existing one_click_demo stdout-mixing failure unrelated to this PR — also fails on main).
There was a problem hiding this comment.
Pull request overview
Adds a V6 “legacy compatibility shim layer” under src/_legacy/ to support deprecating old import paths without breaking downstream callers, and replaces placeholder quant_platform_* distribution facades with real re-exports of the canonical src.* implementations (with identity-preserving expectations locked in via tests).
Changes:
- Introduce
src/_legacyutilities (emit_deprecation,install_module_alias,LEGACY_ALIASES, etc.) plus focused tests for warning/log emission and alias behavior. - Fill
quant_platform_adapters_cnandquant_platform_mlfacades with real re-exports (includingquant_platform_ml.{training,registry,inference}submodules) and add facade identity/importability tests. - Update
CHANGELOG.mdwith entries for the new shim layer, facade fill-out, and related tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/_legacy/__init__.py |
Adds the legacy deprecation + module aliasing shim primitives. |
quant_platform_adapters_cn/__init__.py |
Re-exports canonical adapter namespaces and updates ADAPTER_GROUPS. |
quant_platform_ml/__init__.py |
Re-exports the src.mlops public surface and exposes src.adapters.ml as adapters. |
quant_platform_ml/training.py |
Re-exports training surface from src.mlops.training. |
quant_platform_ml/registry.py |
Re-exports model registry types from src.mlops.model_registry. |
quant_platform_ml/inference.py |
Re-exports inference surface from src.mlops.inference. |
tests/test_legacy_shim.py |
Adds unit coverage for one-shot deprecation warnings, structured logs, and aliasing. |
tests/test_quant_platform_facades.py |
Adds tests ensuring facade imports and object identity vs canonical src.* modules. |
CHANGELOG.md |
Documents the shim layer + facade fill-out and associated tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """ | ||
| from __future__ import annotations | ||
|
|
||
| from src import mlops as _mlops |
Comment on lines
+136
to
+140
| # Internal helper for tests so they can inspect the cache without poking | ||
| # at module-private state via ``getattr``. | ||
| def _emitted_snapshot() -> Dict[str, None]: # pragma: no cover - trivial | ||
| with _emitted_lock: | ||
| return {key: None for key in _emitted} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers V6 Phase 8 (legacy compatibility shim layer) and Phase 7 fill-out (real content for the
quant_platform_*distribution facades).Phase 8 —
src/_legacy/shim layerIntroduces the single mechanism the project uses for retiring legacy import paths without breaking callers:
emit_deprecation()— emits a one-shotDeprecationWarning(thread-safe, per-process deduplicated) and a structuredquant_platform.legacylog record pointing callers at the canonical V6 path.install_module_alias()— registers a legacy dotted name as an alias insys.modules, preserving object identity forisinstance/issubclass/id()callers.LEGACY_ALIASES— empty catalogue at Phase 8 start; entries are added per PR as paths are formally retired, giving reviewers a single grep-able matrix.reset_deprecation_cache()— test helper to clear the one-shot cache between test cases.Phase 7 fill-out —
quant_platform_*real contentReplaces the placeholder stubs with genuine re-exports:
quant_platform_adapters_cnADAPTER_GROUPSbroker,data,messaging,ml,realtime,storagefromsrc.adapters;ADAPTER_GROUPSlists all sixquant_platform_mlML_GROUPSsrc.mlopspublic surface (ModelRegistry,InferenceService,BatchInferenceRunner,SignalSchema, trainer adapters, etc.); addsadaptersnamespace andtraining/registry/inferencesubmodulesAll re-exports preserve object identity with their canonical
src.*implementations.Tests
tests/test_legacy_shim.py— 7 tests covering one-shot warning, structured log record, separate-key emission,sys.modulesaliasing, catalogue surface, and__all__.tests/test_quant_platform_facades.py— 8 tests covering adapter subpackage identity,quant_platform_mlre-export identity vssrc.mlops, new submodule imports, and the existingcore/sdk/cli/websurfaces.Local CI test job: 1294 passed, 34 skipped. The single pre-existing failure (
test_one_click_demo) is present onmainand unrelated to this PR.CHANGELOG
Updated
[Unreleased] - 2026-05-21with### Added(Phase 8 shim + Phase 7 fill-out) and### Testsentries.