Skip to content

Commit 270e65a

Browse files
authored
Merge pull request #97 from cropsinsilico/language/julia
Language/julia
2 parents 5d67eab + b9607b3 commit 270e65a

195 files changed

Lines changed: 4315 additions & 174 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-install.yml

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ env:
55
BUILDDOCS: 0
66
INSTALLC: 1
77
INSTALLFORTRAN: 1
8+
INSTALLJULIA: 1
89
INSTALLLPY: 0
910
INSTALLMATLAB: 0
1011
INSTALLMPI: 1
@@ -21,7 +22,15 @@ env:
2122
YGG_GHA_JOB_ID_SUFFIX: null
2223
jobs:
2324
build_sdist:
25+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
2426
name: Build source distribution
27+
needs:
28+
- test_pip
29+
- test_conda
30+
- test_rmq_pip
31+
- test_rmq_conda
32+
- test_stripped
33+
- docs
2534
runs-on: ubuntu-latest
2635
steps:
2736
- name: Checkout sources
@@ -54,7 +63,15 @@ jobs:
5463
name: sdist
5564
path: ./dist/*
5665
build_wheels:
66+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
5767
name: Build wheels on ${{ matrix.os }}
68+
needs:
69+
- test_pip
70+
- test_conda
71+
- test_rmq_pip
72+
- test_rmq_conda
73+
- test_stripped
74+
- docs
5875
runs-on: ${{ matrix.os }}
5976
steps:
6077
- name: Checkout sources
@@ -76,16 +93,9 @@ jobs:
7693
7794
'
7895
- env:
79-
CIBW_ARCHS_LINUX: auto aarch64 ppc64le
80-
CIBW_ARCHS_MACOS: x86_64 arm64
96+
CIBW_ARCHS_LINUX: ${{ matrix.linux_arch }}
97+
CIBW_ARCHS_MACOS: ${{ matrix.mac_arch }}
8198
CIBW_ARCHS_WINDOWS: ${{ matrix.windows_arch }}
82-
CIBW_BEFORE_ALL_LINUX: yum install -y blas-devel lapack-devel
83-
CIBW_ENVIRONMENT: PIP_ONLY_BINARY=numpy
84-
CIBW_SKIP: cp2* cp33* cp34* cp35* cp36* pp* cp310-manylinux_i686 cp311-manylinux_i686
85-
*-musllinux_*
86-
CIBW_TEST_COMMAND: ygginfo && pytest -m subset_rapidjson --import-mode=importlib
87-
{project}/tests
88-
CIBW_TEST_REQUIRES: pytest flaky
8999
name: Build wheels
90100
uses: pypa/cibuildwheel@v2.12.1
91101
- name: Upload artifacts
@@ -98,6 +108,14 @@ jobs:
98108
include:
99109
- os: windows-2019
100110
windows_arch: x86
111+
- linux_arch: aarch64
112+
os: ubuntu-20.04
113+
- linux_arch: ppc64le
114+
os: ubuntu-20.04
115+
linux_arch:
116+
- auto
117+
mac_arch:
118+
- x86_64 arm64
101119
os:
102120
- ubuntu-20.04
103121
- macOS-11
@@ -290,6 +308,9 @@ jobs:
290308
uses: actions/setup-python@v4
291309
with:
292310
python-version: ${{ matrix.python-version }}
311+
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
312+
name: (PIP) Set up Julia
313+
uses: julia-actions/setup-julia@v1
293314
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
294315
name: Set up Matlab
295316
uses: matlab-actions/setup-matlab@v1
@@ -324,7 +345,7 @@ jobs:
324345
name: (MACOS,PIP) Set C compiler to llvm clang
325346
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
326347
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
327-
name: (WINDOWS,CONDA) Set up miniconda base environment
348+
name: (CONDA) Set up miniconda base environment
328349
uses: conda-incubator/setup-miniconda@v2
329350
with:
330351
auto-update-conda: true
@@ -381,8 +402,8 @@ jobs:
381402
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
382403
runner.os == 'macOS'
383404
name: (MACOS,CONDA) Set allow_multiple_omp config
384-
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
385-
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
405+
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
406+
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
386407
387408
yggconfig --allow-multiple-omp
388409
@@ -618,6 +639,9 @@ jobs:
618639
uses: actions/setup-python@v4
619640
with:
620641
python-version: ${{ matrix.python-version }}
642+
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
643+
name: (PIP) Set up Julia
644+
uses: julia-actions/setup-julia@v1
621645
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
622646
name: Set up Matlab
623647
uses: matlab-actions/setup-matlab@v1
@@ -652,7 +676,7 @@ jobs:
652676
name: (MACOS,PIP) Set C compiler to llvm clang
653677
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
654678
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
655-
name: (WINDOWS,CONDA) Set up miniconda base environment
679+
name: (CONDA) Set up miniconda base environment
656680
uses: conda-incubator/setup-miniconda@v2
657681
with:
658682
auto-update-conda: true
@@ -709,8 +733,8 @@ jobs:
709733
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
710734
runner.os == 'macOS'
711735
name: (MACOS,CONDA) Set allow_multiple_omp config
712-
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
713-
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
736+
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
737+
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
714738
715739
yggconfig --allow-multiple-omp
716740
@@ -938,6 +962,9 @@ jobs:
938962
uses: actions/setup-python@v4
939963
with:
940964
python-version: ${{ matrix.python-version }}
965+
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
966+
name: (PIP) Set up Julia
967+
uses: julia-actions/setup-julia@v1
941968
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
942969
name: Set up Matlab
943970
uses: matlab-actions/setup-matlab@v1
@@ -972,7 +999,7 @@ jobs:
972999
name: (MACOS,PIP) Set C compiler to llvm clang
9731000
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
9741001
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
975-
name: (WINDOWS,CONDA) Set up miniconda base environment
1002+
name: (CONDA) Set up miniconda base environment
9761003
uses: conda-incubator/setup-miniconda@v2
9771004
with:
9781005
auto-update-conda: true
@@ -1029,8 +1056,8 @@ jobs:
10291056
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
10301057
runner.os == 'macOS'
10311058
name: (MACOS,CONDA) Set allow_multiple_omp config
1032-
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
1033-
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
1059+
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
1060+
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
10341061
10351062
yggconfig --allow-multiple-omp
10361063
@@ -1241,6 +1268,9 @@ jobs:
12411268
uses: actions/setup-python@v4
12421269
with:
12431270
python-version: ${{ matrix.python-version }}
1271+
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
1272+
name: (PIP) Set up Julia
1273+
uses: julia-actions/setup-julia@v1
12441274
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
12451275
name: Set up Matlab
12461276
uses: matlab-actions/setup-matlab@v1
@@ -1275,7 +1305,7 @@ jobs:
12751305
name: (MACOS,PIP) Set C compiler to llvm clang
12761306
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
12771307
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
1278-
name: (WINDOWS,CONDA) Set up miniconda base environment
1308+
name: (CONDA) Set up miniconda base environment
12791309
uses: conda-incubator/setup-miniconda@v2
12801310
with:
12811311
auto-update-conda: true
@@ -1332,8 +1362,8 @@ jobs:
13321362
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
13331363
runner.os == 'macOS'
13341364
name: (MACOS,CONDA) Set allow_multiple_omp config
1335-
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
1336-
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
1365+
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
1366+
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
13371367
13381368
yggconfig --allow-multiple-omp
13391369
@@ -1543,6 +1573,9 @@ jobs:
15431573
uses: actions/setup-python@v4
15441574
with:
15451575
python-version: ${{ matrix.python-version }}
1576+
- if: matrix.install-method == 'pip' && env.INSTALLJULIA == 1
1577+
name: (PIP) Set up Julia
1578+
uses: julia-actions/setup-julia@v1
15461579
- if: env.INSTALLMATLAB == 1 && runner.os != 'Windows'
15471580
name: Set up Matlab
15481581
uses: matlab-actions/setup-matlab@v1
@@ -1577,7 +1610,7 @@ jobs:
15771610
name: (MACOS,PIP) Set C compiler to llvm clang
15781611
run: yggconfig --c-compiler=/usr/local/opt/llvm/bin/clang --c++-compiler=/usr/local/opt/llvm/bin/clang++
15791612
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
1580-
name: (WINDOWS,CONDA) Set up miniconda base environment
1613+
name: (CONDA) Set up miniconda base environment
15811614
uses: conda-incubator/setup-miniconda@v2
15821615
with:
15831616
auto-update-conda: true
@@ -1634,8 +1667,8 @@ jobs:
16341667
- if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') &&
16351668
runner.os == 'macOS'
16361669
name: (MACOS,CONDA) Set allow_multiple_omp config
1637-
run: 'install_name_tool -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.1.dylib"
1638-
$CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
1670+
run: '[[ -d $CONDA_PREFIX/lib/clang/9.0.1 ]] && install_name_tool -change "@rpath/libc++abi.1.dylib"
1671+
"/usr/lib/libc++abi.1.dylib" $CONDA_PREFIX/lib/clang/9.0.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
16391672
16401673
yggconfig --allow-multiple-omp
16411674

HISTORY.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
History
33
=======
44

5-
1.9.0 (2023-04-11) Migrate to using extended version of rapidjson/python-rapidjson for serialization
5+
1.9.0 (2023-04-14) Migrate to using extended version of rapidjson/python-rapidjson for serialization and add support for models written in Julia
66
------------------
77

8+
* Added Julia interface with units implemented via Unitful
9+
* Added Julia versions of examples
810
* Dropped support for Python 3.5
911
* Changed rapidjson submodule to extended version
1012
* Vendor python-rapidjson extension

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ recursive-include yggdrasil *.txt
1919
recursive-include yggdrasil *.json
2020
recursive-include yggdrasil *.f90
2121
recursive-include yggdrasil *.xml
22+
recursive-include yggdrasil *.jl
2223
recursive-include yggdrasil/examples *.py
2324
recursive-include yggdrasil/examples *.rst
2425
recursive-include yggdrasil/demos *.py
@@ -34,6 +35,8 @@ include yggdrasil/languages/LPy/lpy_model.py
3435
include yggdrasil/languages/R/DESCRIPTION
3536
include yggdrasil/languages/R/NAMESPACE
3637
include yggdrasil/languages/R/R/*.R
38+
include yggdrasil/languages/Julia/Yggdrasil/*.toml
39+
include yggdrasil/languages/Julia/Yggdrasil/src/*.jl
3740
include yggdrasil/languages/fortran/*.f90
3841
include yggdrasil/languages/fortran/*.c
3942
include yggdrasil/languages/fortran/*.h

docs/source/examples/make_example_rst.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'r': 'R',
1313
'R': 'R',
1414
'c': 'C',
15+
'julia': 'Julia',
1516
'cpp': 'C++',
1617
'all': 'Mixed',
1718
'all_nomatlab': 'Mixed w/o Matlab',
@@ -90,15 +91,15 @@ def get_default_lang(k):
9091

9192
def write_src_ref(fd, k):
9293
default = get_default_lang(k)
93-
assert(default)
94+
assert default
9495
write_src(fd, k, default, upone=True)
9596
fd.write('\n')
9697
write_ref_link(fd, k)
9798

9899

99100
def write_yml_ref(fd, k):
100101
default = get_default_lang(k)
101-
assert(default)
102+
assert default
102103
write_yml(fd, k, default, upone=True)
103104
fd.write('\n')
104105
write_ref_link(fd, k)

docs/source/install.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,12 @@ If you would like to use OpenSimRoot, you will need to install GNU make. If you
404404
* ``brew install make`` on Mac
405405
* ``apt-get install make`` on Linux
406406
* ``choco install make`` on Windows
407+
408+
Additional Steps for Julia Models
409+
---------------------------------
410+
411+
If you do not use conda/mamba to install ``julia``, or you are installing |yggdrasil| on a Windows machine or an M1/M2 Mac (there are not currently ``julia`` conda packages for these systems as of 2023/04/07, but this may change), you will need to install it yourself. Julia downloads can be found `here <https://julialang.org/downloads/>`_.
412+
413+
Once julia is installed, you can complete the installation of the |yggdrasil| Julia interface via::
414+
415+
$ ygginstall julia

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ requires = [
77
]
88
build-backend = "setuptools.build_meta"
99

10+
[tool.cibuildwheel]
11+
skip = "pp* cp2* cp33* cp34* cp35* cp36* *musllinux* cp310-manylinux_ppc64le cp311-manylinux_ppc64le"
12+
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686 *ppc64le"
13+
test-requires = ["pytest", "flaky"]
14+
test-command = "ygginfo && pytest -m subset_rapidjson --import-mode=importlib {project}/tests"
15+
before-test = "pip install --only-binary=numpy,scipy numpy scipy"
16+
17+
# [tool.cibuildwheel.linux]
18+
# before-all = "yum install -y openblas-devel"
19+
20+
# [[tool.cibuildwheel.overrides]]
21+
# select = "cp3{7,8,9,10,11}-manylinux_i686"
22+
# before-all = ""
23+
24+
# [[tool.cibuildwheel.overrides]]
25+
# select = "cp3{7,8,9,10,11}-manylinux_ppc64le"
26+
# before-test = "pip install --only-binary=numpy numpy"
27+
# before-all = "yum install -y openblas-devel"
28+
1029
[tool.black]
1130
line-length = 88
1231
target-version = ['py27', 'py36', 'py37', 'py38']

recipe/meta.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set name = "yggdrasil" %}
2-
{% set version = "1.9.0" %}
2+
{% set version = "1.9.1" %}
33
{% set PY_VER_MAJOR = PY_VER.split('.')[0] %}
44
{% set PY_VER_MINOR = PY_VER.split('.')[1] %}
55

@@ -73,6 +73,7 @@ requirements:
7373
- scipy
7474
- six
7575
- sysv_ipc # [not win]
76+
- toml
7677
- unyt
7778

7879
test:
@@ -149,6 +150,18 @@ outputs:
149150
- czmq
150151
- lz4
151152
- zeromq
153+
- name: yggdrasil.julia
154+
build:
155+
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
156+
run_exports:
157+
- {{ pin_subpackage('yggdrasil.julia') }}
158+
requirements:
159+
host:
160+
- juliaup
161+
- python
162+
run:
163+
- {{ pin_subpackage('yggdrasil', exact=True) }}
164+
- juliaup
152165
- name: yggdrasil.mpi
153166
build:
154167
string: py{{ PY_VER_MAJOR }}{{ PY_VER_MINOR }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ requests
1313
scipy
1414
six
1515
sysv_ipc; platform_system != 'Windows'
16+
toml
1617
unyt

requirements_condaonly.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cmake; platform_system != 'Windows' # [conda,c]
2+
czmq # [conda,zmq,c]
3+
julia>=1.1.1 # [conda,julia]
4+
matplotlib # [conda]
5+
r-rcpp<=1.0.3; platform_system == 'Darwin' # [conda,R]
6+
r-base # [conda,R]
7+
r-bit64 # [conda,R]
8+
r-r6 # [conda,R]
9+
r-reticulate # [conda,R]
10+
r-zeallot # [conda,R]
11+
r-units # [conda,R]
12+
zeromq # [conda,zmq,c]
13+
# c-compiler; platform_system == 'Windows' # [conda,c]
14+
# cxx-compiler; platform_system == 'Windows' # [conda,c]
15+
m2w64-gcc-fortran; platform_system == 'Windows' # [conda,fortran]
16+
m2w64-toolchain_win-64; platform_system == 'Windows' # [conda,fortran]
17+
fortran-compiler; platform_system != 'Windows' # [conda,fortran]

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ def scripts():
638638
('r', 'r_model.R'),
639639
('fortran', ['hellofunc.f90', 'fortran_model.f90']),
640640
('sbml', 'sbml_model.xml'),
641-
('osr', 'osr_model.xml')]
641+
('osr', 'osr_model.xml'),
642+
('julia', 'julia_model.jl')]
642643
scripts = {}
643644
for k, v in script_list:
644645
if isinstance(v, list):

0 commit comments

Comments
 (0)