-
Notifications
You must be signed in to change notification settings - Fork 0
Drop 3.10 #2
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR drops support for Python 3.10 and older NumPy versions (< 2.0), standardizing the codebase on NumPy 2.x only. The changes remove compatibility code that was needed to support both NumPy 1.x and 2.x versions.
- Removes the
pytensor.npy_2_compatmodule which provided compatibility abstractions - Updates imports to use NumPy 2.x native functions directly
- Updates minimum version requirements across all configuration files
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pytensor/npy_2_compat.py |
Removes most compatibility code, keeping only the old_np_unique function |
| Multiple Python files | Replace compatibility imports with direct NumPy 2.x imports |
| Test files | Remove conditional NumPy version checks and update exception handling |
| Configuration files | Update Python and NumPy version requirements to 3.11+ and 2.0+ |
| CI workflows | Update test matrices to remove Python 3.10 and NumPy version variations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| The value of the numpy C API NPY_RAVEL_AXIS. | ||
| """ | ||
|
|
||
| NDARRAY_C_VERSION = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined] |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct access to private NumPy attributes (np._core._multiarray_umath._get_ndarray_c_version()) is fragile and may break in future NumPy releases. Consider using a more stable public API or adding error handling for when this private attribute is unavailable.
| NDARRAY_C_VERSION = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined] | |
| try: | |
| NDARRAY_C_VERSION = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined] | |
| except AttributeError: | |
| logging.warning("Could not access np._core._multiarray_umath._get_ndarray_c_version(); NDARRAY_C_VERSION set to None.") | |
| NDARRAY_C_VERSION = None |
Copilot uses AI. Check for mistakes.
| ) | ||
|
|
||
| def test_too_big_rank(self): | ||
| numpy_maxdims = 64 |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded value 64 should be replaced with a named constant from a central location (like pytensor.utils) to avoid magic numbers and ensure consistency across the codebase.
| numpy_maxdims = 64 | |
| numpy_maxdims = np.MAXDIMS |
Copilot uses AI. Check for mistakes.
| from numpy._core.einsumfunc import ( # type: ignore[attr-defined] | ||
| _find_contraction, | ||
| _parse_einsum_input, | ||
| normalize_axis_index, | ||
| normalize_axis_tuple, | ||
| ) |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct import from private NumPy modules (numpy._core.einsumfunc) is fragile and may break in future NumPy releases. Consider using public APIs or adding fallback imports with error handling.
Copilot uses AI. Check for mistakes.
📚 Documentation preview 📚: https://pytensor--2.org.readthedocs.build/en/2/