From c95694bbe9d0e6f1502f9329b749491b692a79d1 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 13 Nov 2025 22:13:08 +0100 Subject: [PATCH] Regenerate test models, update version * update version number - missed update on `main` * regenerate test models - missed updating after recent changes to the templates --- models/model_calvetti_py/CMakeLists.txt | 8 ++++- models/model_calvetti_py/model_calvetti_py.h | 4 +-- models/model_calvetti_py/setup.py | 4 +-- .../swig/model_calvetti_py.i | 31 +++++++++++++++++-- models/model_dirac_py/CMakeLists.txt | 8 ++++- models/model_dirac_py/model_dirac_py.h | 4 +-- .../model_dirac_py/model_dirac_py.py | 24 ++++++++++++-- models/model_dirac_py/setup.py | 4 +-- models/model_dirac_py/swig/model_dirac_py.i | 31 +++++++++++++++++-- models/model_events_py/CMakeLists.txt | 8 ++++- models/model_events_py/model_events_py.h | 4 +-- models/model_events_py/setup.py | 4 +-- models/model_events_py/swig/model_events_py.i | 31 +++++++++++++++++-- .../model_jakstat_adjoint_py/CMakeLists.txt | 8 ++++- .../model_jakstat_adjoint_py.h | 4 +-- models/model_jakstat_adjoint_py/setup.py | 4 +-- .../swig/model_jakstat_adjoint_py.i | 31 +++++++++++++++++-- models/model_nested_events_py/CMakeLists.txt | 8 ++++- .../model_nested_events_py.h | 4 +-- models/model_nested_events_py/setup.py | 4 +-- .../swig/model_nested_events_py.i | 31 +++++++++++++++++-- models/model_neuron_py/CMakeLists.txt | 8 ++++- models/model_neuron_py/model_neuron_py.h | 4 +-- models/model_neuron_py/setup.py | 4 +-- models/model_neuron_py/swig/model_neuron_py.i | 31 +++++++++++++++++-- models/model_robertson_py/CMakeLists.txt | 8 ++++- .../model_robertson_py/model_robertson_py.h | 4 +-- models/model_robertson_py/setup.py | 4 +-- .../swig/model_robertson_py.i | 31 +++++++++++++++++-- models/model_steadystate_py/CMakeLists.txt | 8 ++++- .../model_steadystate_py.h | 4 +-- .../model_steadystate_py/__init__.py | 9 +++--- models/model_steadystate_py/setup.py | 4 +-- .../swig/model_steadystate_py.i | 31 +++++++++++++++++-- version.txt | 2 +- 35 files changed, 340 insertions(+), 71 deletions(-) diff --git a/models/model_calvetti_py/CMakeLists.txt b/models/model_calvetti_py/CMakeLists.txt index 8044324d40..d4a097eeba 100644 --- a/models/model_calvetti_py/CMakeLists.txt +++ b/models/model_calvetti_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_calvetti_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_calvetti_py/model_calvetti_py.h b/models/model_calvetti_py/model_calvetti_py.h index 97de93af24..665d6f8ec9 100644 --- a/models/model_calvetti_py/model_calvetti_py.h +++ b/models/model_calvetti_py/model_calvetti_py.h @@ -549,7 +549,7 @@ class Model_model_calvetti_py : public amici::Model_DAE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -557,7 +557,7 @@ class Model_model_calvetti_py : public amici::Model_DAE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_calvetti_py/setup.py b/models/model_calvetti_py/setup.py index 8396442dc5..31bec93508 100644 --- a/models/model_calvetti_py/setup.py +++ b/models/model_calvetti_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_calvetti_py/swig/model_calvetti_py.i b/models/model_calvetti_py/swig/model_calvetti_py.i index 9e75161f53..3a33581e7f 100644 --- a/models/model_calvetti_py/swig/model_calvetti_py.i +++ b/models/model_calvetti_py/swig/model_calvetti_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_calvetti_py{ext_suffix}' _model_calvetti_py = amici._module_from_path( 'model_calvetti_py._model_calvetti_py' if __package__ or '.' in __name__ else '_model_calvetti_py', - Path(__file__).parent / f'_model_calvetti_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_calvetti_py",moduleimport=MODULEIMPORT) model_calvetti_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_dirac_py/CMakeLists.txt b/models/model_dirac_py/CMakeLists.txt index c200d17d5b..1273db6cb8 100644 --- a/models/model_dirac_py/CMakeLists.txt +++ b/models/model_dirac_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_dirac_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_dirac_py/model_dirac_py.h b/models/model_dirac_py/model_dirac_py.h index d0c73abcc5..865ec0c018 100644 --- a/models/model_dirac_py/model_dirac_py.h +++ b/models/model_dirac_py/model_dirac_py.h @@ -536,7 +536,7 @@ class Model_model_dirac_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -544,7 +544,7 @@ class Model_model_dirac_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_dirac_py/model_dirac_py/model_dirac_py.py b/models/model_dirac_py/model_dirac_py/model_dirac_py.py index e9ed86904f..fa04165fdc 100644 --- a/models/model_dirac_py/model_dirac_py/model_dirac_py.py +++ b/models/model_dirac_py/model_dirac_py/model_dirac_py.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. @@ -14,10 +14,11 @@ from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_dirac_py{ext_suffix}' _model_dirac_py = amici._module_from_path( 'model_dirac_py._model_dirac_py' if __package__ or '.' in __name__ else '_model_dirac_py', - Path(__file__).parent / f'_model_dirac_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -86,6 +87,25 @@ class _SwigNonDynamicMeta(type): __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) +SWIG_VERSION_MAJOR = _model_dirac_py.SWIG_VERSION_MAJOR +SWIG_VERSION_MINOR = _model_dirac_py.SWIG_VERSION_MINOR +SWIG_VERSION_PATCH = _model_dirac_py.SWIG_VERSION_PATCH + +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) + # the model-package __init__.py module (will be set during import) _model_module = None diff --git a/models/model_dirac_py/setup.py b/models/model_dirac_py/setup.py index 96a986db12..4e5c9c7ad9 100644 --- a/models/model_dirac_py/setup.py +++ b/models/model_dirac_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_dirac_py/swig/model_dirac_py.i b/models/model_dirac_py/swig/model_dirac_py.i index 27869edf00..248e97e644 100644 --- a/models/model_dirac_py/swig/model_dirac_py.i +++ b/models/model_dirac_py/swig/model_dirac_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_dirac_py{ext_suffix}' _model_dirac_py = amici._module_from_path( 'model_dirac_py._model_dirac_py' if __package__ or '.' in __name__ else '_model_dirac_py', - Path(__file__).parent / f'_model_dirac_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_dirac_py",moduleimport=MODULEIMPORT) model_dirac_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_events_py/CMakeLists.txt b/models/model_events_py/CMakeLists.txt index ca942eecc5..c7706edf3c 100644 --- a/models/model_events_py/CMakeLists.txt +++ b/models/model_events_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_events_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_events_py/model_events_py.h b/models/model_events_py/model_events_py.h index f452c05132..f08055dd48 100644 --- a/models/model_events_py/model_events_py.h +++ b/models/model_events_py/model_events_py.h @@ -571,7 +571,7 @@ class Model_model_events_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -579,7 +579,7 @@ class Model_model_events_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_events_py/setup.py b/models/model_events_py/setup.py index 0b7665b708..b8bda5ee65 100644 --- a/models/model_events_py/setup.py +++ b/models/model_events_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_events_py/swig/model_events_py.i b/models/model_events_py/swig/model_events_py.i index f86cbab411..c14cdef4e2 100644 --- a/models/model_events_py/swig/model_events_py.i +++ b/models/model_events_py/swig/model_events_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_events_py{ext_suffix}' _model_events_py = amici._module_from_path( 'model_events_py._model_events_py' if __package__ or '.' in __name__ else '_model_events_py', - Path(__file__).parent / f'_model_events_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_events_py",moduleimport=MODULEIMPORT) model_events_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_jakstat_adjoint_py/CMakeLists.txt b/models/model_jakstat_adjoint_py/CMakeLists.txt index 1a55d59949..2b8bfe45bf 100644 --- a/models/model_jakstat_adjoint_py/CMakeLists.txt +++ b/models/model_jakstat_adjoint_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_jakstat_adjoint_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_jakstat_adjoint_py/model_jakstat_adjoint_py.h b/models/model_jakstat_adjoint_py/model_jakstat_adjoint_py.h index 1520bbcf02..93a57bd308 100644 --- a/models/model_jakstat_adjoint_py/model_jakstat_adjoint_py.h +++ b/models/model_jakstat_adjoint_py/model_jakstat_adjoint_py.h @@ -544,7 +544,7 @@ class Model_model_jakstat_adjoint_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -552,7 +552,7 @@ class Model_model_jakstat_adjoint_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_jakstat_adjoint_py/setup.py b/models/model_jakstat_adjoint_py/setup.py index 34f6a26701..0c29f341d5 100644 --- a/models/model_jakstat_adjoint_py/setup.py +++ b/models/model_jakstat_adjoint_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_jakstat_adjoint_py/swig/model_jakstat_adjoint_py.i b/models/model_jakstat_adjoint_py/swig/model_jakstat_adjoint_py.i index 3f05b98996..ab94d3c927 100644 --- a/models/model_jakstat_adjoint_py/swig/model_jakstat_adjoint_py.i +++ b/models/model_jakstat_adjoint_py/swig/model_jakstat_adjoint_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_jakstat_adjoint_py{ext_suffix}' _model_jakstat_adjoint_py = amici._module_from_path( 'model_jakstat_adjoint_py._model_jakstat_adjoint_py' if __package__ or '.' in __name__ else '_model_jakstat_adjoint_py', - Path(__file__).parent / f'_model_jakstat_adjoint_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_jakstat_adjoint_py",moduleimport=MODULEIMPORT) model_jakstat_adjoint_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_nested_events_py/CMakeLists.txt b/models/model_nested_events_py/CMakeLists.txt index ef0443001c..52f7dd707d 100644 --- a/models/model_nested_events_py/CMakeLists.txt +++ b/models/model_nested_events_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_nested_events_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_nested_events_py/model_nested_events_py.h b/models/model_nested_events_py/model_nested_events_py.h index b90345495f..01e0b3bf38 100644 --- a/models/model_nested_events_py/model_nested_events_py.h +++ b/models/model_nested_events_py/model_nested_events_py.h @@ -544,7 +544,7 @@ class Model_model_nested_events_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -552,7 +552,7 @@ class Model_model_nested_events_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_nested_events_py/setup.py b/models/model_nested_events_py/setup.py index a3f550259e..3f74354694 100644 --- a/models/model_nested_events_py/setup.py +++ b/models/model_nested_events_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_nested_events_py/swig/model_nested_events_py.i b/models/model_nested_events_py/swig/model_nested_events_py.i index 9f03945317..2a6453a644 100644 --- a/models/model_nested_events_py/swig/model_nested_events_py.i +++ b/models/model_nested_events_py/swig/model_nested_events_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_nested_events_py{ext_suffix}' _model_nested_events_py = amici._module_from_path( 'model_nested_events_py._model_nested_events_py' if __package__ or '.' in __name__ else '_model_nested_events_py', - Path(__file__).parent / f'_model_nested_events_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_nested_events_py",moduleimport=MODULEIMPORT) model_nested_events_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_neuron_py/CMakeLists.txt b/models/model_neuron_py/CMakeLists.txt index 759fb9bf37..52e9275e60 100644 --- a/models/model_neuron_py/CMakeLists.txt +++ b/models/model_neuron_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_neuron_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_neuron_py/model_neuron_py.h b/models/model_neuron_py/model_neuron_py.h index dbbcc5b663..97d8153cb4 100644 --- a/models/model_neuron_py/model_neuron_py.h +++ b/models/model_neuron_py/model_neuron_py.h @@ -566,7 +566,7 @@ class Model_model_neuron_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -574,7 +574,7 @@ class Model_model_neuron_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_neuron_py/setup.py b/models/model_neuron_py/setup.py index ea902ab899..3acfb24b76 100644 --- a/models/model_neuron_py/setup.py +++ b/models/model_neuron_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_neuron_py/swig/model_neuron_py.i b/models/model_neuron_py/swig/model_neuron_py.i index 949da25226..539af3b45b 100644 --- a/models/model_neuron_py/swig/model_neuron_py.i +++ b/models/model_neuron_py/swig/model_neuron_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_neuron_py{ext_suffix}' _model_neuron_py = amici._module_from_path( 'model_neuron_py._model_neuron_py' if __package__ or '.' in __name__ else '_model_neuron_py', - Path(__file__).parent / f'_model_neuron_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_neuron_py",moduleimport=MODULEIMPORT) model_neuron_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_robertson_py/CMakeLists.txt b/models/model_robertson_py/CMakeLists.txt index 1f031f29dc..3e7685365c 100644 --- a/models/model_robertson_py/CMakeLists.txt +++ b/models/model_robertson_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_robertson_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_robertson_py/model_robertson_py.h b/models/model_robertson_py/model_robertson_py.h index 174b8e9c56..0c0cfa348b 100644 --- a/models/model_robertson_py/model_robertson_py.h +++ b/models/model_robertson_py/model_robertson_py.h @@ -528,7 +528,7 @@ class Model_model_robertson_py : public amici::Model_DAE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -536,7 +536,7 @@ class Model_model_robertson_py : public amici::Model_DAE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_robertson_py/setup.py b/models/model_robertson_py/setup.py index db4c2f0b85..f741256557 100644 --- a/models/model_robertson_py/setup.py +++ b/models/model_robertson_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_robertson_py/swig/model_robertson_py.i b/models/model_robertson_py/swig/model_robertson_py.i index 99e14a1916..d62408f6c0 100644 --- a/models/model_robertson_py/swig/model_robertson_py.i +++ b/models/model_robertson_py/swig/model_robertson_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_robertson_py{ext_suffix}' _model_robertson_py = amici._module_from_path( 'model_robertson_py._model_robertson_py' if __package__ or '.' in __name__ else '_model_robertson_py', - Path(__file__).parent / f'_model_robertson_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_robertson_py",moduleimport=MODULEIMPORT) model_robertson_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/models/model_steadystate_py/CMakeLists.txt b/models/model_steadystate_py/CMakeLists.txt index 327933bc76..f1c1e1492e 100644 --- a/models/model_steadystate_py/CMakeLists.txt +++ b/models/model_steadystate_py/CMakeLists.txt @@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31) project(model_steadystate_py) +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS}) link_libraries("$ENV{AMICI_LDFLAGS}") endif() -find_package(Amici 0.34.1 REQUIRED HINTS +find_package(Amici 0.34.2 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set_target_properties(Upstream::amici PROPERTIES diff --git a/models/model_steadystate_py/model_steadystate_py.h b/models/model_steadystate_py/model_steadystate_py.h index 67b160e8fd..15c795fbcb 100644 --- a/models/model_steadystate_py/model_steadystate_py.h +++ b/models/model_steadystate_py/model_steadystate_py.h @@ -528,7 +528,7 @@ class Model_model_steadystate_py : public amici::Model_ODE { * @return AMICI version string */ std::string get_amici_version() const override { - return "0.34.1"; + return "0.34.2"; } /** @@ -536,7 +536,7 @@ class Model_model_steadystate_py : public amici::Model_ODE { * @return AMICI git commit hash */ std::string get_amici_commit() const override { - return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7"; + return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070"; } bool has_quadratic_llh() const override { diff --git a/models/model_steadystate_py/model_steadystate_py/__init__.py b/models/model_steadystate_py/model_steadystate_py/__init__.py index 6407687e8f..4c6dc60e5b 100644 --- a/models/model_steadystate_py/model_steadystate_py/__init__.py +++ b/models/model_steadystate_py/model_steadystate_py/__init__.py @@ -1,18 +1,19 @@ """AMICI-generated module for model model_steadystate_py""" import sys +import warnings from pathlib import Path + import amici -import warnings # Ensure we are binary-compatible, see #556 -if "0.34.1" != amici.__version__: +if "0.34.2" != amici.__version__: raise amici.AmiciVersionError( f"Cannot use model `model_steadystate_py` in {Path(__file__).parent}, " - "generated with amici==0.34.1, " + "generated with amici==0.34.2, " f"together with amici=={amici.__version__} " "which is currently installed. To use this model, install " - "amici==0.34.1 or re-import the model with the amici " + "amici==0.34.2 or re-import the model with the amici " "version currently installed." ) diff --git a/models/model_steadystate_py/setup.py b/models/model_steadystate_py/setup.py index 2741e047ae..1da24eeff3 100644 --- a/models/model_steadystate_py/setup.py +++ b/models/model_steadystate_py/setup.py @@ -1,5 +1,6 @@ """AMICI model package setup""" +import importlib.metadata import os import sys from pathlib import Path @@ -8,7 +9,6 @@ from amici.custom_commands import AmiciBuildCMakeExtension from cmake_build_extension import CMakeExtension from setuptools import find_namespace_packages, setup -import importlib.metadata def get_extension() -> CMakeExtension: @@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension: author_email="model-author-todo", ext_modules=[MODEL_EXT], packages=find_namespace_packages(), - install_requires=["amici==0.34.1"], + install_requires=["amici==0.34.2"], python_requires=">=3.11", package_data={}, zip_safe=False, diff --git a/models/model_steadystate_py/swig/model_steadystate_py.i b/models/model_steadystate_py/swig/model_steadystate_py.i index f9e5333fa9..cdd2483406 100644 --- a/models/model_steadystate_py/swig/model_steadystate_py.i +++ b/models/model_steadystate_py/swig/model_steadystate_py.i @@ -8,10 +8,11 @@ import sysconfig from pathlib import Path ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') +extension_path = Path(__file__).parent / f'_model_steadystate_py{ext_suffix}' _model_steadystate_py = amici._module_from_path( 'model_steadystate_py._model_steadystate_py' if __package__ or '.' in __name__ else '_model_steadystate_py', - Path(__file__).parent / f'_model_steadystate_py{ext_suffix}', + extension_path, ) def _get_import_time(): @@ -36,6 +37,28 @@ if t_imported < t_modified: %module(package="model_steadystate_py",moduleimport=MODULEIMPORT) model_steadystate_py +// store swig version +%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16); +%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff); +%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff); + +%pythoncode %{ +# SWIG version used to build the model extension as `(major, minor, patch)` +_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH) + +if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION): + import warnings + warnings.warn( + f"SWIG version mismatch between amici ({amici_swig}) and model " + f"({model_swig}). This may lead to unexpected behavior. " + "In that case, please recompile the model with swig==" + f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici " + f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.", + RuntimeWarning, + stacklevel=2, + ) +%} + %pythoncode %{ # the model-package __init__.py module (will be set during import) _model_module = None @@ -56,7 +79,7 @@ using namespace amici; // store the time a module was imported %{ #include -static std::chrono::time_point _module_import_time; +static std::chrono::time_point _module_import_time = std::chrono::system_clock::now(); static double _get_import_time() { auto epoch = _module_import_time.time_since_epoch(); @@ -67,7 +90,9 @@ static double _get_import_time() { static double _get_import_time(); %init %{ - _module_import_time = std::chrono::system_clock::now(); + // NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the + // module is executed - not only on first import + // This code ends up in `SWIG_mod_exec`. %} diff --git a/version.txt b/version.txt index cd46610fe4..3f8003cd4c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.34.1 +0.34.2