Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump PyTensor and support numpy>2.0 and Python 3.13 #7688

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Feb 23, 2025

Closes #7592
Closes #7551
Closes #7417


📚 Documentation preview 📚: https://pymc--7688.org.readthedocs.build/en/7688/

@ricardoV94 ricardoV94 added release major Include in major changes release notes section labels Feb 23, 2025
@github-actions github-actions bot added the bug label Feb 23, 2025
@ricardoV94 ricardoV94 force-pushed the pytensor_python_bump branch 2 times, most recently from 15722b5 to 7721a0d Compare February 23, 2025 21:11
Comment on lines -244 to -245
@_class_or_instancemethod
@property
Copy link
Member Author

Choose a reason for hiding this comment

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

Python 3.13 stopped allowing chaining property and classmethods

@ricardoV94
Copy link
Member Author

mypy seems to be tripped by new type-hint stuff in numpy?

@ricardoV94 ricardoV94 force-pushed the pytensor_python_bump branch 4 times, most recently from 583489b to 5e5c72e Compare February 24, 2025 12:40
@@ -369,7 +369,7 @@ def get_support_shape(
support_shape_offset = [0] * ndim_supp
elif isinstance(support_shape_offset, int):
support_shape_offset = [support_shape_offset] * ndim_supp
inferred_support_shape: Sequence[int | np.ndarray | Variable] | None = None
inferred_support_shape: Sequence[int | np.ndarray | TensorVariable] | None = None
Copy link
Member Author

Choose a reason for hiding this comment

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

Mypy complains correctly that - is not defined for base Variable classes

if active_dims is None:
self.active_dims = np.arange(input_dim)
else:
self.active_dims = np.asarray(active_dims, int)

if max(self.active_dims) > self.input_dim:
if self.active_dims.max() > self.input_dim:
Copy link
Member Author

Choose a reason for hiding this comment

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

mypy is dumb

@@ -876,7 +876,7 @@ def sample_posterior_predictive(
try:
with progress:
task = progress.add_task("Sampling ...", completed=0, total=samples)
for idx in np.arange(samples):
for idx in range(samples):
Copy link
Member Author

Choose a reason for hiding this comment

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

mypy doesn't like one iterating over arange anymore. Anwyay I don't think that we need to, so I'll let it have its way

@ricardoV94 ricardoV94 force-pushed the pytensor_python_bump branch 2 times, most recently from 62a898f to 95cf770 Compare February 24, 2025 13:11
@ricardoV94
Copy link
Member Author

We seem to have a lingering test failing due to pymc-devs/pytensor#1242

Everything else is green!

@ricardoV94 ricardoV94 changed the title Bump PyTensor and support Python 3.13 Bump PyTensor and support numpy>2.0 and Python 3.13 Feb 24, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.66%. Comparing base (358b825) to head (c69924b).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7688      +/-   ##
==========================================
- Coverage   92.70%   92.66%   -0.05%     
==========================================
  Files         107      107              
  Lines       18391    18313      -78     
==========================================
- Hits        17050    16969      -81     
- Misses       1341     1344       +3     
Files with missing lines Coverage Δ
pymc/backends/mcbackend.py 99.25% <100.00%> (ø)
pymc/distributions/distribution.py 93.01% <100.00%> (+1.12%) ⬆️
pymc/distributions/multivariate.py 93.58% <100.00%> (ø)
pymc/distributions/shape_utils.py 90.90% <100.00%> (ø)
pymc/gp/cov.py 98.66% <100.00%> (+<0.01%) ⬆️
pymc/logprob/transforms.py 95.40% <100.00%> (ø)
pymc/logprob/utils.py 92.46% <ø> (ø)
pymc/model/core.py 92.98% <100.00%> (ø)
pymc/sampling/forward.py 96.26% <100.00%> (ø)

... and 2 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug major Include in major changes release notes section release
Projects
None yet
1 participant