feat(v4): deprecate the 8 estimator wrappers + alias diet via module __getattr__; SCM alias (2(d) PR-A, M-070..M-077/M-132..M-135/M-062) - #752
Conversation
|
/ai-review |
…__getattr__; SCM alias (2(d) PR-A, M-070..M-077/M-132..M-135/M-062)
The eight module-level convenience wrappers (imputation_did,
two_stage_did, stacked_did, trop, synthetic_control, triple_difference,
bacon_decompose, chaisemartin_dhaultfoeuille) deprecate in 3.9 and are
removed in 4.0: every call emits a FutureWarning naming the class
successor on one uniform template (Bacon says "construct the
DIAGNOSTIC" - BaconDecompositionResults subclasses the Diagnostic
marker), and each docstring gains the deprecation note the kept
autofunction pages render. The wrappers stay pure construct+fit relays:
bit-exact equivalence vs the class path is pinned across the full
inference quintet at zero tolerance (Bacon: an enumerated diagnostic
field list + the comparisons payload), and the aggregate/balance_e
sentinel forwarding is unchanged - a plain wrapper call fires exactly
ONE warning; four plain-call no-warn pins flipped BY DESIGN.
DiagnosticReport's internal Bacon runner migrated to the class
(weights= to the ctor, survey_design= on fit; the two mock-based
threading tests re-pointed to the class split); emitted guidance in
twfe/visualization/practitioner rewords to class form.
ALIAS DIET (M-132..M-134 via mechanism row M-135): CDiD / Gardner /
Stacked leave module globals - gone from dir()/vars() and static
autocomplete - but stay importable and in __all__ through 3.9, served
by a new PEP 562 module __getattr__ that warns and returns
ContinuousDiD / TwoStageDiD / StackedDiD. The package import protocol
resolves each missing __all__ name twice, so a star-import records six
warnings for the three aliases; tests assert the message SET (both
access routes covered). NEW: SCM = SyntheticControl (M-062,
introduce-only, silent). Emitted-guidance register: the practitioner
recommendation rosters use full class names ("CallawaySantAnna,
SunAbraham, or TwoStageDiD"), the TwoStageDiD display label drops its
dying "(Gardner)" parenthetical (kept-alias parentheticals stay), and
the report Bacon caveats name classes.
Ledger: M-070..M-077 shimmed (phase 5, test_ref
tests/test_v4_wrapper_shims.py, api-page code_refs); M-062 + M-135
done; M-132..M-134 notes annotated; M-021/M-022 + their REGISTRY twins
amended (plain wrapper calls now warn); v4-design records the 2(d)
two-PR split in section 9 and PR-B's locked M-081/M-096 implementation
decisions in section 7. Tests: new 30-test shim suite; ~140 wrapper
call sites migrated to the class API via suite-local helpers; ~40
wrapper-specific keeps updated for the new warning; alias suite
rewritten (dual-route pins, set-wise star-import). Docs: guides
annotate the dying Alias lines and drop them from the use-this roster;
estimators.rst carries the RST deprecation note; three api-page
convenience blocks and four tutorials migrated to the class quick-form
(notebooks re-executed; numbers unchanged - the wrappers were pure
relays).
6840083 to
d8c8e04
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks goodExecutive summary
MethodologyFinding — P3 informational
Code QualityNo findings. Warning messages, sentinel forwarding, and PEP 562 alias behavior are consistently implemented and tested. PerformanceNo findings. Only negligible warning and attribute-lookup overhead was added. MaintainabilityNo findings. Deprecated aliases are centralized in Tech DebtNo findings. Deprecation work is recorded in SecurityNo findings. No secrets, unsafe runtime evaluation, or new external-input handling was introduced. Documentation/TestsFinding — P3 informational
Runtime tests could not be executed because this environment lacks |
Summary
imputation_did,two_stage_did,stacked_did,trop,synthetic_control,triple_difference,bacon_decompose,chaisemartin_dhaultfoeuille) for 3.9 → removed in 4.0 (ledger rows [M-070]..[M-077] →shimmed, phase 5): every call emits aFutureWarningnaming the class successor on one uniform template (diagnostic wording for Bacon —BaconDecompositionResultssubclasses theDiagnosticmarker), and each docstring gains a deprecation note rendered by the keptautofunctionpages. Wrappers stay pure construct+fit relays — bit-exact equivalence vs the class path is pinned across the full inference quintet at zero tolerance (assert_allclose(rtol=0, atol=0, equal_nan=True); Bacon compares an enumerated diagnostic field list + thecomparisonspayload) in the newtests/test_v4_wrapper_shims.py.done):CDiD/Gardner/Stackedleave module globals (gone fromdir()/vars()and static autocomplete) but stay importable and in__all__through 3.9, served by a new PEP 562 module__getattr__that warns and returnsContinuousDiD/TwoStageDiD/StackedDiD. The package import protocol resolves each missing__all__name twice, so a star-import records six warnings for the three aliases — the tests assert the message set, covering both access routes.SCM = SyntheticControl([M-062] →done, silent).DiagnosticReport's internal Bacon runner migrated to the class (weights=→ ctor,survey_design=→ fit; the two mock-based threading tests re-pointed accordingly).practitioner_next_steps()'s TwoStageDiD display label drops the dying "(Gardner)" parenthetical (kept-alias parentheticals stay), and the report Bacon caveats name classes.docs/v4-design.mdrecords the 2(d) two-PR split (§9) and PR-B's locked [M-081]/[M-096] implementation decisions (§7); guides annotate the dying**Alias:**lines and drop them from the use-this roster;docs/api/estimators.rstcarries the RST deprecation note; three api-page convenience blocks and four tutorials (02/08/09/10) migrated to the class quick-form.Methodology references (required if estimator / math changes)
Validation
tests/test_v4_wrapper_shims.py(new — warning pins onre.escaped full messages, zero-tolerance quintet equivalence gate, sentinel-forwarding pins),tests/test_aliases.py(rewritten — dual-route warn pins, set-wise star-import,dir()/vars()absence, SCM), ~140 wrapper call sites migrated to the class API via suite-local helpers (test_methodology_synthetic_control.py,test_bacon.py,test_methodology_bacon.py,test_trop.py, report/fixture suites), ~40 wrapper-specific keeps updated for the new warning, 6 forwarded-shim pins updated for dual warnings, per-site emitted-guidance pins intest_practitioner.py/test_business_report.py/test_diagnostic_report.py, matrix/naming-guard green (M-070..M-077 flips, M-062/M-135 done).-Wbuild + the docs CI's four post-build HTML guards pass.Security / privacy