ansys / ansys/pyansys-tools-variableinterop
Not compatible with NumPy >= 2.5.0
- Dominant language
- Python
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### π Before submitting the issue
- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment
### π Description of the bug
If you try to use this AVI library with NumPy 2.5.0 or greater, you will receive a weird error:
```
from .variable_value import IVariableValue
File "/home/nsharp/ver/py-cam-common/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/variable_value.py", line 107, in
class CommonArrayValue(Generic[T], NDArray[T], IVariableValue, ABC):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
```
This is because numpy 2.5.0 redefines numpy.typing.NDArray as a PEP 695 type alias (typing.TypeAliasType), which is not a class and therefore cannot be used as a base class. pyansys-tools-variableinterop 0.1.4 does exactly that in variable_value.py:107:
```Python
class CommonArrayValue(Generic[T], NDArray[T], IVariableValue, ABC):
```
### π Steps to reproduce
```
nsharp@ubuntu-linux-2404:~/src/delme$ python3 -m venv .venv
nsharp@ubuntu-linux-2404:~/src/delme$ . .venv/bin/activate
(.venv) nsharp@ubuntu-linux-2404:~/src/delme$ pip install pyansys-tools-variableinterop==0.1.4
Collecting pyansys-tools-variableinterop==0.1.4
Using cached pyansys_tools_variableinterop-0.1.4-py3-none-any.whl.metadata (10 kB)
Collecting anyio>=3.5 (from pyansys-tools-variableinterop==0.1.4)
Using cached anyio-4.14.2-py3-none-any.whl.metadata (4.6 kB)
Collecting numpy>=1.20.3 (from pyansys-tools-variableinterop==0.1.4)
Downloading numpy-2.5.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.metadata (6.6 kB)
Collecting overrides>=7.4 (from pyansys-tools-variableinterop==0.1.4)
Using cached overrides-7.7.0-py3-none-any.whl.metadata (5.8 kB)
Collecting idna>=2.8 (from anyio>=3.5->pyansys-tools-variableinterop==0.1.4)
Using cached idna-3.18-py3-none-any.whl.metadata (6.1 kB)
Collecting typing_extensions>=4.5 (from anyio>=3.5->pyansys-tools-variableinterop==0.1.4)
Using cached typing_extensions-4.16.0-py3-none-any.whl.metadata (3.3 kB)
Using cached pyansys_tools_variableinterop-0.1.4-py3-none-any.whl (86 kB)
Using cached anyio-4.14.2-py3-none-any.whl (125 kB)
Downloading numpy-2.5.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (15.6 MB)
ββββββββββββββββββββββββββββββββββββββββ 15.6/15.6 MB 31.1 MB/s eta 0:00:00
Using cached overrides-7.7.0-py3-none-any.whl (17 kB)
Using cached idna-3.18-py3-none-any.whl (65 kB)
Using cached typing_extensions-4.16.0-py3-none-any.whl (45 kB)
Installing collected packages: typing_extensions, overrides, numpy, idna, anyio, pyansys-tools-variableinterop
Successfully installed anyio-4.14.2 idna-3.18 numpy-2.5.2 overrides-7.7.0 pyansys-tools-variableinterop-0.1.4 typing_extensions-4.16.0
(.venv) nsharp@ubuntu-linux-2404:~/src/delme$ python
Python 3.12.3 (main, Jun 19 2026, 12:46:00) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ansys.tools.variableinterop import RealValue
Traceback (most recent call last):
File "", line 1, in
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/__init__.py", line 39, in
from .api_serialization import from_api_string, to_api_string
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/api_serialization.py", line 27, in
from .api_string_to_value_visitor import APIStringToValueVisitor
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/api_string_to_value_visitor.py", line 33, in
from .array_values import BooleanArrayValue, IntegerArrayValue, RealArrayValue, StringArrayValue
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/array_values.py", line 36, in
from .scalar_values import BooleanValue, IntegerValue, RealValue, StringValue
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/scalar_values.py", line 32, in
from .exceptions import IncompatibleTypesException
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/exceptions.py", line 28, in
from .variable_type import VariableType
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/variable_type.py", line 29, in
from .variable_value import IVariableValue
File "/home/nsharp/src/delme/.venv/lib/python3.12/site-packages/ansys/tools/variableinterop/variable_value.py", line 107, in
class CommonArrayValue(Generic[T], NDArray[T], IVariableValue, ABC):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
>>>
```
### π» Which operating system are you using?
Linux
### π Which ANSYS version are you using?
_No response_
### π Which Python version are you using?
3.12
### π¦ Installed packages
```shell
anyio==4.14.2
idna==3.18
numpy==2.5.2
overrides==7.7.0
pyansys-tools-variableinterop==0.1.4
typing_extensions==4.16.0
```
Contributor guide
Research direction
Start at variable_value.py:107 and reproduce the import failure with NumPy 2.5.0 or newer using the issue's virtual-environment steps. Check how CommonArrayValue uses numpy.typing.NDArray, then verify that importing ansys.tools.variableinterop succeeds with the affected NumPy versions and add or update regression coverage if the repository provides it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100