Deprecate SumTo1 transform#8356
Open
andreruizloera wants to merge 1 commit into
Open
Conversation
Emit a FutureWarning when SumTo1 is instantiated or when pymc.distributions.transforms.sum_to_1 is accessed, per maintainer guidance in pymc-devs#7009. The module-level sum_to_1 instance is now served lazily via a module __getattr__ so importing PyMC emits no warning; only actual access does. The transform remains fully functional. Includes a test verifying the warning fires on both access paths and that the transform still works.
Documentation build overview
16 files changed ·
|
ricardoV94
reviewed
Jul 15, 2026
| name = "sumto1" | ||
| ndim_supp = 1 | ||
|
|
||
| def __init__(self): |
Member
There was a problem hiding this comment.
I think it's enough to deprecate access to the sum_to_1 and leave the class noiseless. Less code in this PR and same result, as I don't expect people to be creating their own instances
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.
Closes #7009.
Adds a
FutureWarningwhenSumTo1is instantiated or whenpymc.distributions.transforms.sum_to_1is accessed, per maintainer guidance in the issue ("We can warn first"). The module-levelsum_to_1instance is now served lazily via a module__getattr__(the same pattern used inpymc/logprob/utils.py) so that importing PyMC emits no warning; only actual access does. The transform remains fully functional.Includes a test verifying the warning fires on both access paths and that the transform still works. Existing functional tests were switched to a single warning-suppressed instance so the suite stays warning-clean, including at collection time (two usages live inside
@pytest.mark.parametrizedecorators, which evaluate when tests are collected).Verification
python -W error::FutureWarning -c "import pymc"is clean (no warning on import)tr.sum_to_1and callingtr.SumTo1()both raise theFutureWarningfrom pymc.distributions.transforms import *still exposessum_to_1tests/distributions/test_transform.pysuite: 78 passedruff checkandruff format --checkclean on both modified filesChecklist
test_sum_to_1_deprecated)