Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions python/sdist/amici/sim/sundials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from types import ModuleType
from typing import Protocol, runtime_checkable

from ... import amici_path
import amici
from amici import amici_path, import_model_module

#: boolean indicating if this is the full package with swig interface or
# the raw package without extension
Expand All @@ -22,6 +23,11 @@
#: boolean indicating if amici was compiled with hdf5 support
hdf5_enabled: bool = False

__all__ = [
"import_model_module",
"ModelModule",
]

if has_clibs:
# Import SWIG module and swig-dependent submodules
# if required and available
Expand All @@ -37,7 +43,7 @@
message="builtin type .* has no __module__ attribute",
)
# The swig-generated Python module
from amici._installation import amici
from amici._installation import amici as amici_swig_py

# TODO: selective import to avoid loading unneeded symbols
from amici._installation.amici import *
Expand All @@ -61,10 +67,25 @@ class ModelModule(Protocol): # noqa: F811

To enable static type checking."""

def get_model(self) -> amici.Model:
def get_model(self) -> amici_swig_py.Model:
"""Create a model instance."""
...

AmiciModel = amici.Model | amici.ModelPtr
AmiciModel = amici_swig_py.Model | amici_swig_py.ModelPtr

from . import _swig_wrappers

__all__ += [
*amici._installation.amici.__all__,
"ExpDataView",
"ReturnDataView",
"evaluate",
"ModelModule",
*_swig_wrappers.__all__,
"AmiciModel",
]

# expose the swig module itself
amici = amici_swig_py
else:
ModelModule = ModuleType
2 changes: 1 addition & 1 deletion swig/amici.i
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ from collections.abc import Sequence
import numpy as np
if TYPE_CHECKING:
import numpy
from .numpy import ReturnDataView
from amici.sim.sundials import ReturnDataView
%}

%pythoncode %{
Expand Down
Loading