Skip to content

feat(packaging): add src/_legacy deprecation shims and fill quant_platform_* facades#34

Merged
magic-alt merged 1 commit into
mainfrom
feature/v6-phase8-legacy-shim-and-pkg-content
May 21, 2026
Merged

feat(packaging): add src/_legacy deprecation shims and fill quant_platform_* facades#34
magic-alt merged 1 commit into
mainfrom
feature/v6-phase8-legacy-shim-and-pkg-content

Conversation

@magic-alt
Copy link
Copy Markdown
Owner

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 layer

Introduces the single mechanism the project uses for retiring legacy import paths without breaking callers:

  • emit_deprecation() — emits a one-shot DeprecationWarning (thread-safe, per-process deduplicated) and a structured quant_platform.legacy log record pointing callers at the canonical V6 path.
  • install_module_alias() — registers a legacy dotted name as an alias in sys.modules, preserving object identity for isinstance / 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 content

Replaces the placeholder stubs with genuine re-exports:

Package Before After
quant_platform_adapters_cn stub constant ADAPTER_GROUPS re-exports broker, data, messaging, ml, realtime, storage from src.adapters; ADAPTER_GROUPS lists all six
quant_platform_ml stub constant ML_GROUPS re-exports full src.mlops public surface (ModelRegistry, InferenceService, BatchInferenceRunner, SignalSchema, trainer adapters, etc.); adds adapters namespace and training / registry / inference submodules

All 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.modules aliasing, catalogue surface, and __all__.
  • tests/test_quant_platform_facades.py — 8 tests covering adapter subpackage identity, quant_platform_ml re-export identity vs src.mlops, new submodule imports, and the existing core/sdk/cli/web surfaces.

Local CI test job: 1294 passed, 34 skipped. The single pre-existing failure (test_one_click_demo) is present on main and unrelated to this PR.

CHANGELOG

Updated [Unreleased] - 2026-05-21 with ### Added (Phase 8 shim + Phase 7 fill-out) and ### Tests entries.

… 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).
Copilot AI review requested due to automatic review settings May 21, 2026 02:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/_legacy utilities (emit_deprecation, install_module_alias, LEGACY_ALIASES, etc.) plus focused tests for warning/log emission and alias behavior.
  • Fill quant_platform_adapters_cn and quant_platform_ml facades with real re-exports (including quant_platform_ml.{training,registry,inference} submodules) and add facade identity/importability tests.
  • Update CHANGELOG.md with 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 thread src/_legacy/__init__.py
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}
@magic-alt magic-alt merged commit 548c16c into main May 21, 2026
14 checks passed
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