Skip to content

Commit e75c348

Browse files
authored
Regenerate test models, update version (#3032)
* update version number - missed update on `main` * regenerate test models - missed updating after recent changes to the templates
1 parent 27d4d38 commit e75c348

35 files changed

+340
-71
lines changed

models/model_calvetti_py/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31)
44

55
project(model_calvetti_py)
66

7+
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
8+
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
9+
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
10+
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
11+
message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
12+
713
set(CMAKE_CXX_STANDARD 20)
814
set(CMAKE_CXX_STANDARD_REQUIRED ON)
915
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS})
3036
link_libraries("$ENV{AMICI_LDFLAGS}")
3137
endif()
3238

33-
find_package(Amici 0.34.1 REQUIRED HINTS
39+
find_package(Amici 0.34.2 REQUIRED HINTS
3440
${CMAKE_CURRENT_LIST_DIR}/../../build)
3541
message(STATUS "Found AMICI ${Amici_DIR}")
3642
set_target_properties(Upstream::amici PROPERTIES

models/model_calvetti_py/model_calvetti_py.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,15 @@ class Model_model_calvetti_py : public amici::Model_DAE {
549549
* @return AMICI version string
550550
*/
551551
std::string get_amici_version() const override {
552-
return "0.34.1";
552+
return "0.34.2";
553553
}
554554

555555
/**
556556
* @brief returns the amici version that was used to generate the model
557557
* @return AMICI git commit hash
558558
*/
559559
std::string get_amici_commit() const override {
560-
return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7";
560+
return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070";
561561
}
562562

563563
bool has_quadratic_llh() const override {

models/model_calvetti_py/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""AMICI model package setup"""
22

3+
import importlib.metadata
34
import os
45
import sys
56
from pathlib import Path
@@ -8,7 +9,6 @@
89
from amici.custom_commands import AmiciBuildCMakeExtension
910
from cmake_build_extension import CMakeExtension
1011
from setuptools import find_namespace_packages, setup
11-
import importlib.metadata
1212

1313

1414
def get_extension() -> CMakeExtension:
@@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension:
8787
author_email="model-author-todo",
8888
ext_modules=[MODEL_EXT],
8989
packages=find_namespace_packages(),
90-
install_requires=["amici==0.34.1"],
90+
install_requires=["amici==0.34.2"],
9191
python_requires=">=3.11",
9292
package_data={},
9393
zip_safe=False,

models/model_calvetti_py/swig/model_calvetti_py.i

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import sysconfig
88
from pathlib import Path
99
1010
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
11+
extension_path = Path(__file__).parent / f'_model_calvetti_py{ext_suffix}'
1112
_model_calvetti_py = amici._module_from_path(
1213
'model_calvetti_py._model_calvetti_py' if __package__ or '.' in __name__
1314
else '_model_calvetti_py',
14-
Path(__file__).parent / f'_model_calvetti_py{ext_suffix}',
15+
extension_path,
1516
)
1617
1718
def _get_import_time():
@@ -36,6 +37,28 @@ if t_imported < t_modified:
3637

3738
%module(package="model_calvetti_py",moduleimport=MODULEIMPORT) model_calvetti_py
3839

40+
// store swig version
41+
%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16);
42+
%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff);
43+
%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff);
44+
45+
%pythoncode %{
46+
# SWIG version used to build the model extension as `(major, minor, patch)`
47+
_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)
48+
49+
if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION):
50+
import warnings
51+
warnings.warn(
52+
f"SWIG version mismatch between amici ({amici_swig}) and model "
53+
f"({model_swig}). This may lead to unexpected behavior. "
54+
"In that case, please recompile the model with swig=="
55+
f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici "
56+
f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.",
57+
RuntimeWarning,
58+
stacklevel=2,
59+
)
60+
%}
61+
3962
%pythoncode %{
4063
# the model-package __init__.py module (will be set during import)
4164
_model_module = None
@@ -56,7 +79,7 @@ using namespace amici;
5679
// store the time a module was imported
5780
%{
5881
#include <chrono>
59-
static std::chrono::time_point<std::chrono::system_clock> _module_import_time;
82+
static std::chrono::time_point<std::chrono::system_clock> _module_import_time = std::chrono::system_clock::now();
6083

6184
static double _get_import_time() {
6285
auto epoch = _module_import_time.time_since_epoch();
@@ -67,7 +90,9 @@ static double _get_import_time() {
6790
static double _get_import_time();
6891

6992
%init %{
70-
_module_import_time = std::chrono::system_clock::now();
93+
// NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the
94+
// module is executed - not only on first import
95+
// This code ends up in `SWIG_mod_exec`.
7196
%}
7297

7398

models/model_dirac_py/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31)
44

55
project(model_dirac_py)
66

7+
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
8+
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
9+
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
10+
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
11+
message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
12+
713
set(CMAKE_CXX_STANDARD 20)
814
set(CMAKE_CXX_STANDARD_REQUIRED ON)
915
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS})
3036
link_libraries("$ENV{AMICI_LDFLAGS}")
3137
endif()
3238

33-
find_package(Amici 0.34.1 REQUIRED HINTS
39+
find_package(Amici 0.34.2 REQUIRED HINTS
3440
${CMAKE_CURRENT_LIST_DIR}/../../build)
3541
message(STATUS "Found AMICI ${Amici_DIR}")
3642
set_target_properties(Upstream::amici PROPERTIES

models/model_dirac_py/model_dirac_py.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,15 @@ class Model_model_dirac_py : public amici::Model_ODE {
536536
* @return AMICI version string
537537
*/
538538
std::string get_amici_version() const override {
539-
return "0.34.1";
539+
return "0.34.2";
540540
}
541541

542542
/**
543543
* @brief returns the amici version that was used to generate the model
544544
* @return AMICI git commit hash
545545
*/
546546
std::string get_amici_commit() const override {
547-
return "f005fac9e2de7c3c90be2ac55d4ad165471ed1e7";
547+
return "b0b2684b4b67db9eadf5e47d4f87f8fe74dd9070";
548548
}
549549

550550
bool has_quadratic_llh() const override {

models/model_dirac_py/model_dirac_py/model_dirac_py.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file was automatically generated by SWIG (https://www.swig.org).
2-
# Version 4.3.1
2+
# Version 4.4.0
33
#
44
# Do not make changes to this file unless you know what you are doing - modify
55
# the SWIG interface file instead.
@@ -14,10 +14,11 @@
1414
from pathlib import Path
1515

1616
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
17+
extension_path = Path(__file__).parent / f'_model_dirac_py{ext_suffix}'
1718
_model_dirac_py = amici._module_from_path(
1819
'model_dirac_py._model_dirac_py' if __package__ or '.' in __name__
1920
else '_model_dirac_py',
20-
Path(__file__).parent / f'_model_dirac_py{ext_suffix}',
21+
extension_path,
2122
)
2223

2324
def _get_import_time():
@@ -86,6 +87,25 @@ class _SwigNonDynamicMeta(type):
8687
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
8788

8889

90+
SWIG_VERSION_MAJOR = _model_dirac_py.SWIG_VERSION_MAJOR
91+
SWIG_VERSION_MINOR = _model_dirac_py.SWIG_VERSION_MINOR
92+
SWIG_VERSION_PATCH = _model_dirac_py.SWIG_VERSION_PATCH
93+
94+
# SWIG version used to build the model extension as `(major, minor, patch)`
95+
_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)
96+
97+
if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION):
98+
import warnings
99+
warnings.warn(
100+
f"SWIG version mismatch between amici ({amici_swig}) and model "
101+
f"({model_swig}). This may lead to unexpected behavior. "
102+
"In that case, please recompile the model with swig=="
103+
f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici "
104+
f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.",
105+
RuntimeWarning,
106+
stacklevel=2,
107+
)
108+
89109

90110
# the model-package __init__.py module (will be set during import)
91111
_model_module = None

models/model_dirac_py/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""AMICI model package setup"""
22

3+
import importlib.metadata
34
import os
45
import sys
56
from pathlib import Path
@@ -8,7 +9,6 @@
89
from amici.custom_commands import AmiciBuildCMakeExtension
910
from cmake_build_extension import CMakeExtension
1011
from setuptools import find_namespace_packages, setup
11-
import importlib.metadata
1212

1313

1414
def get_extension() -> CMakeExtension:
@@ -87,7 +87,7 @@ def get_extension() -> CMakeExtension:
8787
author_email="model-author-todo",
8888
ext_modules=[MODEL_EXT],
8989
packages=find_namespace_packages(),
90-
install_requires=["amici==0.34.1"],
90+
install_requires=["amici==0.34.2"],
9191
python_requires=">=3.11",
9292
package_data={},
9393
zip_safe=False,

models/model_dirac_py/swig/model_dirac_py.i

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import sysconfig
88
from pathlib import Path
99
1010
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
11+
extension_path = Path(__file__).parent / f'_model_dirac_py{ext_suffix}'
1112
_model_dirac_py = amici._module_from_path(
1213
'model_dirac_py._model_dirac_py' if __package__ or '.' in __name__
1314
else '_model_dirac_py',
14-
Path(__file__).parent / f'_model_dirac_py{ext_suffix}',
15+
extension_path,
1516
)
1617
1718
def _get_import_time():
@@ -36,6 +37,28 @@ if t_imported < t_modified:
3637

3738
%module(package="model_dirac_py",moduleimport=MODULEIMPORT) model_dirac_py
3839

40+
// store swig version
41+
%constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16);
42+
%constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8) & 0xff);
43+
%constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff);
44+
45+
%pythoncode %{
46+
# SWIG version used to build the model extension as `(major, minor, patch)`
47+
_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)
48+
49+
if (amici_swig := amici.amici._SWIG_VERSION) != (model_swig := _SWIG_VERSION):
50+
import warnings
51+
warnings.warn(
52+
f"SWIG version mismatch between amici ({amici_swig}) and model "
53+
f"({model_swig}). This may lead to unexpected behavior. "
54+
"In that case, please recompile the model with swig=="
55+
f"{amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici "
56+
f"with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}.",
57+
RuntimeWarning,
58+
stacklevel=2,
59+
)
60+
%}
61+
3962
%pythoncode %{
4063
# the model-package __init__.py module (will be set during import)
4164
_model_module = None
@@ -56,7 +79,7 @@ using namespace amici;
5679
// store the time a module was imported
5780
%{
5881
#include <chrono>
59-
static std::chrono::time_point<std::chrono::system_clock> _module_import_time;
82+
static std::chrono::time_point<std::chrono::system_clock> _module_import_time = std::chrono::system_clock::now();
6083

6184
static double _get_import_time() {
6285
auto epoch = _module_import_time.time_since_epoch();
@@ -67,7 +90,9 @@ static double _get_import_time() {
6790
static double _get_import_time();
6891

6992
%init %{
70-
_module_import_time = std::chrono::system_clock::now();
93+
// NOTE: from SWIG 4.4.0 onwards, %init code is executed every time the
94+
// module is executed - not only on first import
95+
// This code ends up in `SWIG_mod_exec`.
7196
%}
7297

7398

models/model_events_py/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ cmake_policy(VERSION 3.22...3.31)
44

55
project(model_events_py)
66

7+
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
8+
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
9+
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
10+
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
11+
message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
12+
713
set(CMAKE_CXX_STANDARD 20)
814
set(CMAKE_CXX_STANDARD_REQUIRED ON)
915
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -30,7 +36,7 @@ if(DEFINED ENV{AMICI_LDFLAGS})
3036
link_libraries("$ENV{AMICI_LDFLAGS}")
3137
endif()
3238

33-
find_package(Amici 0.34.1 REQUIRED HINTS
39+
find_package(Amici 0.34.2 REQUIRED HINTS
3440
${CMAKE_CURRENT_LIST_DIR}/../../build)
3541
message(STATUS "Found AMICI ${Amici_DIR}")
3642
set_target_properties(Upstream::amici PROPERTIES

0 commit comments

Comments
 (0)