Skip to content

Commit f82aa80

Browse files
committed
Merge branch 'main' into fixed_parameters
2 parents a5c05e6 + e75c348 commit f82aa80

File tree

36 files changed

+188
-118
lines changed

36 files changed

+188
-118
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Conda installation
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '48 4 * * *'
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
conda:
12+
name: Conda installation
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-24.04, macos-latest]
17+
python-version: ['3.11', '3.12', '3.13']
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Miniconda
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
auto-update-conda: true
26+
activate-environment: amici
27+
- name: Install requirements
28+
shell: bash -l {0}
29+
run: |
30+
conda install -c conda-forge compilers cmake
31+
- name: Install AMICI
32+
shell: bash -l {0}
33+
run: |
34+
pip3 install -v ./python/sdist
35+
- name: Show environment
36+
shell: bash -l {0}
37+
run: |
38+
python -c "import os; import pprint; pprint.pprint(dict(os.environ))"
39+
which cmake
40+
which ninja
41+
ls -l /Users/runner/miniconda3/envs/amici/bin || true
42+
- name: Install test dependencies
43+
shell: bash -l {0}
44+
run: |
45+
# Install test extras (pytest, scipy, etc.)
46+
pip3 install pytest pytest-cov scipy h5py antimony
47+
- name: Test import
48+
shell: bash -l {0}
49+
run: |
50+
python -c "from amici import _amici; print(_amici)"
51+
python -m amici
52+
- name: Run SBML import test
53+
shell: bash -l {0}
54+
# FIXME
55+
continue-on-error: true
56+
run: |
57+
cd python/tests
58+
pytest test_sbml_import.py::test_steadystate_simulation -sv

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.22)
66
# src/CMakeLists.template.cmake
77
cmake_policy(VERSION 3.22...3.31)
88

9+
# We aren't using C++20 modules, so disable scanning for them to avoid
10+
# clang-scan-deps-notfound errors.
11+
# See also https://discourse.cmake.org/t/cmake-3-28-cmake-cxx-compiler-clang-scan-deps-notfound-not-found/9244/3
12+
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
13+
914
project(amici)
1015

1116
# misc options
@@ -27,6 +32,7 @@ message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
2732
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
2833
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
2934
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
35+
message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
3036

3137
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
3238

cmake/AmiciFindBLAS.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ if(DEFINED ENV{AMICI_BLAS_USE_SCIPY_OPENBLAS})
1515
"Using AMICI_BLAS_USE_SCIPY_OPENBLAS=${AMICI_BLAS_USE_SCIPY_OPENBLAS} from environment variable."
1616
)
1717
set(AMICI_BLAS_USE_SCIPY_OPENBLAS $ENV{AMICI_BLAS_USE_SCIPY_OPENBLAS})
18+
elseif(NOT DEFINED AMICI_BLAS_USE_SCIPY_OPENBLAS
19+
AND NOT AMICI_PYTHON_BUILD_EXT_ONLY)
20+
# If were are not building the Python extension, it's unlikely that we want to
21+
# use scipy-openblas
22+
set(AMICI_BLAS_USE_SCIPY_OPENBLAS FALSE)
1823
endif()
1924

2025
if((${BLAS} STREQUAL "MKL" OR DEFINED ENV{MKLROOT})

doc/conf.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -441,59 +441,6 @@ def process_docstring(app, what, name, obj, options, lines):
441441
)
442442

443443

444-
def fix_typehints(sig: str) -> str:
445-
# cleanup types
446-
if not isinstance(sig, str):
447-
return sig
448-
449-
for old, new in typemaps.items():
450-
sig = sig.replace(old, new)
451-
sig = sig.replace("void", "None")
452-
sig = sig.replace("amici::realtype", "float")
453-
sig = sig.replace("std::string", "str")
454-
sig = sig.replace("double", "float")
455-
sig = sig.replace("long", "int")
456-
sig = sig.replace("char const *", "str")
457-
sig = sig.replace("amici::", "")
458-
sig = sig.replace("sunindextype", "int")
459-
sig = sig.replace("H5::H5File", "object")
460-
461-
# remove const / const&
462-
sig = sig.replace(" const&? ", r" ")
463-
sig = re.sub(r" const&?$", r"", sig)
464-
465-
# remove pass by reference
466-
sig = re.sub(r" &(,|\))", r"\1", sig)
467-
sig = re.sub(r" &$", r"", sig)
468-
469-
# turn gsl_spans and pointers into Iterables
470-
sig = re.sub(r"([\w.]+) \*", r"Iterable[\1]", sig)
471-
sig = re.sub(r"gsl::span< ([\w.]+) >", r"Iterable[\1]", sig)
472-
473-
# fix garbled output
474-
sig = sig.replace(" >", "")
475-
return sig
476-
477-
478-
def process_signature(
479-
app, what: str, name: str, obj, options, signature, return_annotation
480-
):
481-
if signature is None:
482-
return
483-
484-
# only apply in the amici.amici module
485-
split_name = name.split(".")
486-
if len(split_name) < 2 or split_name[1] != "amici":
487-
return
488-
489-
signature = fix_typehints(signature)
490-
if hasattr(obj, "__annotations__"):
491-
for ann in obj.__annotations__:
492-
obj.__annotations__[ann] = fix_typehints(obj.__annotations__[ann])
493-
494-
return signature, return_annotation
495-
496-
497444
# this code fixes references in symlinked md files in documentation folder
498445
# link replacements must be in env.domains['std'].labels
499446
doclinks = {
@@ -600,7 +547,6 @@ def skip_member(app, what, name, obj, skip, options):
600547

601548
def setup(app: "sphinx.application.Sphinx"):
602549
app.connect("autodoc-process-docstring", process_docstring, priority=0)
603-
app.connect("autodoc-process-signature", process_signature, priority=0)
604550
app.connect("missing-reference", process_missing_ref, priority=0)
605551
app.connect("autodoc-skip-member", skip_member, priority=0)
606552
app.config.intersphinx_mapping = intersphinx_mapping

doc/python_installation.rst

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,6 @@ Installation under conda
249249
There is no amici conda recipe available yet. However, you can install AMICI
250250
using pip in a conda environment.
251251

252-
.. note::
253-
254-
It is possible, but we currently don't recommend using conda for installing
255-
AMICI, as it commonly leads to conflicts with system installations of
256-
libraries and compilers.
257-
258252
Create a minimal conda environment via:
259253

260254
.. code-block:: bash
@@ -286,25 +280,13 @@ Now, you are ready to use AMICI in the virtual environment.
286280

287281
**conda on Mac**
288282

289-
If the above installation does not work for you, try installing AMICI via:
283+
If the above installation does not work for you, try installing AMICI
284+
using clang compilers provided by conda:
290285

291286
.. code-block:: bash
292287
293-
CFLAGS="-stdlib=libc++" CC=clang CXX=clang pip3 install --verbose amici
294-
295-
This will use the ``clang`` compiler.
296-
297-
You will have to pass the same options when compiling any model later
298-
on. This can be done by inserting the following code before model import:
299-
300-
.. code-block:: python
301-
302-
import os
303-
os.environ['CC'] = 'clang'
304-
os.environ['CXX'] = 'clang'
305-
os.environ['CFLAGS'] = '-stdlib=libc++'
306-
307-
(For further discussion see https://github.com/AMICI-dev/AMICI/issues/357)
288+
conda install -c conda-forge compilers
289+
pip install amici --no-cache
308290
309291
Known issues:
310292

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ 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
/**

models/model_calvetti_py/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ 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
/**

0 commit comments

Comments
 (0)