diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dc3583..c2a5d27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,10 @@ name: Python package -on: [pull_request, push] +on: + pull_request: + push: + branches: + - master jobs: test-on-linux: @@ -14,7 +18,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "windows-latest"] - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 with: @@ -28,10 +32,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install Dependences run: | - conda install --yes conda-build conda-verify pytest pytest-cov hypothesis statsmodels pytensor c-compiler + conda install --yes conda-build boa conda-verify pytest pytest-cov hypothesis statsmodels pytensor c-compiler - name: Build package run: | - conda build --variants "{python: [${{ matrix.python-version }}]}" ./sunode/conda + conda mambabuild --variants "{python: [${{ matrix.python-version }}]}" ./sunode/conda - name: Install package run: | conda install --yes -c file:///${CONDA_PREFIX}/conda-bld/ sunode diff --git a/conda/meta.yaml b/conda/meta.yaml index 16fcfa3..7542a86 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -20,18 +20,16 @@ requirements: host: - python - pip - - numpy >=1.14 - liblapack - cffi - sundials >=5.3,<6.0 run: - python - - numpy >=1.14 - cffi - xarray - scipy - sundials >=5.3,<6.0 - - numba >=0.49 + - numba >=0.57 - typing_extensions - sympy >=1.8 diff --git a/setup.py b/setup.py index b85d287..d6a07ea 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ def get_version(): author='Adrian Seyboldt', author_email='adrian.seyboldt@gmail.com', description='Python wrapper of sundials for solving ordinary differential equations', - url='https://github.com/aseyboldt/sunode', + url='https://github.com/pymc-devs/sunode', setup_requires=["cffi>=1.0.0"], cffi_modules=[ "sunode/build_cvodes.py:ffibuilder", diff --git a/sunode/wrappers/__init__.py b/sunode/wrappers/__init__.py index 9fb2e5e..d0945c9 100644 --- a/sunode/wrappers/__init__.py +++ b/sunode/wrappers/__init__.py @@ -1,4 +1,3 @@ from . import as_pytensor -from . import as_pytensor as as_aesara -__all__ = ['as_aesara', 'as_pytensor'] \ No newline at end of file +__all__ = ("as_pytensor",) diff --git a/sunode/wrappers/as_pytensor.py b/sunode/wrappers/as_pytensor.py index 69c11eb..137ad74 100644 --- a/sunode/wrappers/as_pytensor.py +++ b/sunode/wrappers/as_pytensor.py @@ -1,15 +1,8 @@ -try: - import pytensor.tensor as pt - from pytensor.graph.basic import Constant, Variable - from pytensor.graph.fg import MissingInputError - from pytensor.graph.op import Op - from pytensor.gradient import grad_not_implemented -except ModuleNotFoundError: - import aesara.tensor as pt - from aesara.graph.basic import Constant, Variable - from aesara.graph.fg import MissingInputError - from aesara.graph.op import Op - from aesara.gradient import grad_not_implemented +import pytensor.tensor as pt +from pytensor.graph.basic import Constant, Variable +from pytensor.graph.fg import MissingInputError +from pytensor.graph.op import Op +from pytensor.gradient import grad_not_implemented import copy from typing import Dict, Optional, Any, Callable @@ -52,12 +45,11 @@ def read_dict(vals, name=None): if isinstance(vals, tuple): tensor, dim_names = vals else: - try: - tensor, dim_names = vals, pt.as_tensor_variable(vals, dtype="float64").shape.eval() - except MissingInputError as e: + tensor, dim_names = vals, pt.as_tensor_variable(vals, dtype="float64").type.shape + if any(d is None for d in dim_names): raise ValueError( - 'Shapes of tensors need to be statically ' - 'known or given explicitly.') from e + 'Shapes of tensors need to be statically known or given explicitly.' + ) if isinstance(dim_names, (str, int)): dim_names = (dim_names,) tensor = pt.as_tensor_variable(tensor, dtype="float64")