Skip to content

refactor(clv): drop _prior suffix backwards-compat shim#2576

Draft
anevolbap wants to merge 2 commits into
pymc-labs:mainfrom
anevolbap:refactor/1516-clv-prior-suffix-shim
Draft

refactor(clv): drop _prior suffix backwards-compat shim#2576
anevolbap wants to merge 2 commits into
pymc-labs:mainfrom
anevolbap:refactor/1516-clv-prior-suffix-shim

Conversation

@anevolbap
Copy link
Copy Markdown
Contributor

@anevolbap anevolbap commented May 15, 2026

Summary

Removes the _prior-suffix backwards-compat shim from CLVModel. This was added in #1498 as a v1.0 deprecation. #1516 is the CLV-deprecations umbrella; this PR covers the first item there and leaves the rest as follow-ups.

Three sites in pymc_marketing/clv/models/basic.py:

  • The deprecated_keys rename loop in __init__.
  • The _rename_posterior_variables call inside build_from_idata.
  • The _rename_posterior_variables method itself.

Two deprecation tests in tests/clv/models/test_basic.py are dropped (test_backwards_compatibility_with_old_config, test_deprecation_warning_on_old_config).

Mechanical follow-up: covariate convergence tests in test_beta_geo.py and test_modified_beta_geo.py still passed _prior-suffixed keys (relying on the shim's silent rename). The same applied to docs/source/notebooks/clv/dev/bg_nbg_covariates_test_issues.ipynb. Renamed those keys to drop the suffix so they exercise the same priors directly.

Note on timing

This is a hard breaking change: users still passing _prior-suffixed keys will get a silent fallback to defaults, and saved netCDFs with _prior-suffixed posterior vars will not load cleanly. The original intent was a v1.0 cut. v1.0 (#2108) is still open. Can hold this PR until v1.0 is being cut, or merge now to start closing out the deprecations early. Preference?

Remaining CLV deprecations tracked in #1516 (clv.utils.clv_summary, ShiftedBetaGeoModelIndividual per #2157, unused distribution blocks per #2158, plotting parameter, fit(fit_method=...), CLVModel.build_with_data) are intentionally out of scope and would land as separate PRs.

Test plan

  • pre-commit run on the touched files: pass
  • pytest tests/clv/: 313 passed, 17 skipped
  • Targeted convergence tests after the key rename: 4/4 pass

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.88%. Comparing base (1a3f0d0) to head (c5fc5b2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2576      +/-   ##
==========================================
- Coverage   93.90%   93.88%   -0.02%     
==========================================
  Files          92       92              
  Lines       14089    14078      -11     
==========================================
- Hits        13230    13217      -13     
- Misses        859      861       +2     

☔ 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.

Remove the model_config rename loop in CLVModel.__init__ and the
_rename_posterior_variables hook in build_from_idata, plus the matching
tests. This was added in pymc-labs#1498 as a v1.0 deprecation and is one of the
items flagged for removal in pymc-labs#1516.

Also rename the _prior-suffixed keys in BetaGeoModel and ModifiedBetaGeoModel
covariate convergence tests, and in the bg_nbg_covariates_test_issues dev
notebook, which previously relied on the shim.

Refs pymc-labs#1516
@anevolbap anevolbap force-pushed the refactor/1516-clv-prior-suffix-shim branch from 82b5a81 to 66ee144 Compare May 17, 2026 23:33
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions Bot added the docs Improvements or additions to documentation label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLV docs Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant