Skip to content

Commit

Permalink
Merge pull request #101 from cropsinsilico/minor
Browse files Browse the repository at this point in the history
Minor
  • Loading branch information
langmm authored Oct 12, 2023
2 parents 70ad737 + e4a5540 commit bc23d79
Show file tree
Hide file tree
Showing 24 changed files with 426 additions and 251 deletions.
90 changes: 55 additions & 35 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,17 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- if: runner.os == 'Windows'
name: Run cmake test in command prompt
run: 'cmake -h
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
'
- if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method
== 'mamba')
name: Run cmake test in command prompt (CONDA)
run: conda activate test && pytest --import-mode=importlib --ci --cov-append
--nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method
!= 'mamba'
name: Run cmake test in command prompt (PIP)
run: pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- continue-on-error: true
Expand Down Expand Up @@ -779,13 +783,17 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- if: runner.os == 'Windows'
name: Run cmake test in command prompt
run: 'cmake -h
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
'
- if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method
== 'mamba')
name: Run cmake test in command prompt (CONDA)
run: conda activate test && pytest --import-mode=importlib --ci --cov-append
--nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method
!= 'mamba'
name: Run cmake test in command prompt (PIP)
run: pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- continue-on-error: true
Expand Down Expand Up @@ -1118,13 +1126,17 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- if: runner.os == 'Windows'
name: Run cmake test in command prompt
run: 'cmake -h
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
'
- if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method
== 'mamba')
name: Run cmake test in command prompt (CONDA)
run: conda activate test && pytest --import-mode=importlib --ci --cov-append
--nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method
!= 'mamba'
name: Run cmake test in command prompt (PIP)
run: pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- continue-on-error: true
Expand Down Expand Up @@ -1440,13 +1452,17 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- if: runner.os == 'Windows'
name: Run cmake test in command prompt
run: 'cmake -h
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
'
- if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method
== 'mamba')
name: Run cmake test in command prompt (CONDA)
run: conda activate test && pytest --import-mode=importlib --ci --cov-append
--nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method
!= 'mamba'
name: Run cmake test in command prompt (PIP)
run: pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- continue-on-error: true
Expand Down Expand Up @@ -1761,13 +1777,17 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- if: runner.os == 'Windows'
name: Run cmake test in command prompt
run: 'cmake -h
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
'
- if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method
== 'mamba')
name: Run cmake test in command prompt (CONDA)
run: conda activate test && pytest --import-mode=importlib --ci --cov-append
--nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method
!= 'mamba'
name: Run cmake test in command prompt (PIP)
run: pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
shell: cmd /C CALL {0}
timeout-minutes: 180
- continue-on-error: true
Expand Down
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
History
=======

1.10.2 (2023-10-12) Minor bug fixes and dependency updates
-------------------

* Updated rapidjson version to include normalization of units in human readable strings
* Fix CI R dependency installation bug by pinning vdiffr to 1.0.5
* Fix bug in types test that assumed different directory structure

1.10.1 (2023-06-27) New map transformation, composite function wrapping example, and various refactoring of internal methods
-------------------

Expand Down
12 changes: 12 additions & 0 deletions _vendor/python_rapidjson/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,18 @@ static PyObject* quantity_array__array_ufunc__(PyObject* self, PyObject* args, P
goto cleanup;
}
}
} else if (ufunc_name == "exp") {
if (_has_units(i0)) {
tmp2 = _get_units(i0);
if (((UnitsObject*)tmp2)->units->is_null()) {
Py_DECREF(tmp2);
convert_units = get_empty_units();
} else {
// Allow radians here?
Py_DECREF(tmp2);
goto cleanup;
}
}
} else if (ufunc_name == "sin" ||
ufunc_name == "cos" ||
ufunc_name == "tan" ||
Expand Down
1 change: 1 addition & 0 deletions docs/source/development/todo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Documentation
* Expand development section into contributing guide
* Go through and update/prune interface documentation
* Docs on default_file/default_value
* Docs on use of YggInterface.h vs YggLibrary.h in main source vs. other source files when a module has more than one

Refactor
--------
Expand Down
4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "yggdrasil" %}
{% set version = "1.10.1" %}
{% set version = "1.10.2" %}
{% set PY_VER_MAJOR = PY_VER.split('.')[0] %}
{% set PY_VER_MINOR = PY_VER.split('.')[1] %}

Expand Down Expand Up @@ -122,6 +122,7 @@ outputs:
- python
- r-base
- r-bit64
- r-devtools # [not win]
- r-r6
- r-reticulate
- r-units
Expand All @@ -130,6 +131,7 @@ outputs:
- {{ pin_subpackage('yggdrasil', exact=True) }}
- r-base
- r-bit64
- r-devtools # [not win]
- r-r6
- r-reticulate
- r-units
Expand Down
2 changes: 1 addition & 1 deletion tests/drivers/test_CompiledModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_get_flags(self, python_class):
from yggdrasil import __version__ as yggver
yggver = yggver.split('+')[0].split('v')[-1].split('.')
assert (python_class.get_flags(flags='hello', libtype='object')
== ['hello', '-DWITH_YGGDRASIL',
== ['hello', '-DWITH_YGGDRASIL', '-D_USE_MATH_DEFINES',
f'-DYGGVER_MAJOR={yggver[0]}'])

def test_get_executable_command(self, python_class):
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/types/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import argparse
from yggdrasil.examples.tests.test_types import TestExampleTypes
from tests.examples.test_types import TestExampleTypes
from yggdrasil.languages import get_language_ext
from yggdrasil.runner import run
_this_dir = os.path.dirname(__file__)
Expand Down
47 changes: 47 additions & 0 deletions utils/requirements/requirements.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,53 @@
]
}
},
{
"r-devtools": {
"options": [
{
"method": "conda",
"host": true,
"os": "unix"
},
{
"method": "cran"
},
{
"method": "skip",
"os": "win"
}
]
}
},
{
"harfbuzz": {
"options": [
{
"name": "libharfbuzz-dev",
"method": "apt",
"add": [
"libfribidi-dev",
"r-cran-devtools"
]
},
{
"name": "harfbuzz",
"add": [
"fribidi",
"libgit2"
],
"method": "brew"
},
{
"method": "skip",
"os": "win"
},
{
"method": "conda_skip"
}
]
}
},
{
"r-bit64": [
{
Expand Down
19 changes: 19 additions & 0 deletions utils/requirements/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,25 @@ extras:
add: [r-base-dev]
- name: r
method: brew
- r-devtools:
options:
- method: conda
host: True
os: unix
- method: cran
- method: skip
os: win
- harfbuzz:
options:
- name: libharfbuzz-dev
method: apt
add: [libfribidi-dev, r-cran-devtools]
- name: harfbuzz
add: [fribidi, libgit2]
method: brew
- method: skip
os: win
- method: conda_skip
- r-bit64:
- method: conda
host: True
Expand Down
1 change: 1 addition & 0 deletions utils/requirements/requirements_condaonly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ msmpi; platform_system == 'Windows' # [conda,mpi]
openmpi; platform_system == 'Darwin' # [conda,mpi]
r-base # [conda,r]
r-bit64 # [conda,r]
r-devtools; platform_system != 'Windows' # [conda,r]
r-r6 # [conda,r]
r-reticulate # [conda,r]
r-units # [conda,r]
Expand Down
27 changes: 17 additions & 10 deletions utils/setup_test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,17 +522,24 @@ def add_argument(*a_args, **a_kwargs):


def prune_windows_path():
to_remove = [
'C:\\Program Files\\Microsoft SQL Server\\140\\DTS\\Binn',
'C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn',
'C:\\Program Files\\Microsoft SQL Server\\160\\DTS\\Binn']
print(f"PRUNING PATH: {os.environ['PATH']}")
path_list = os.environ['PATH'].split(os.pathsep)
for x in to_remove:
if x in path_list:
path_list.remove(x)
to_remove = (
'C:\\Program Files\\Microsoft SQL Server', )
# to_remove = [
# 'C:\\Program Files\\Microsoft SQL Server\\140\\DTS\\Binn',
# 'C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn',
# 'C:\\Program Files\\Microsoft SQL Server\\160\\DTS\\Binn']
print(f"PRUNING PATH ({len(os.environ['PATH'])}): "
f"{os.environ['PATH']}")
old_path_list = os.environ['PATH'].split(os.pathsep)
path_list = []
for x in old_path_list:
if not x.startswith(to_remove):
path_list.append(x)
# for x in to_remove:
# if x in path_list:
# path_list.remove(x)
new_path = os.pathsep.join(path_list)
print(f"PRUNED PATH: {new_path}")
print(f"PRUNED PATH ({len(os.environ['PATH'])}): {new_path}")
cmds = [f"set \"PATH={new_path}\""]
return cmds

Expand Down
14 changes: 9 additions & 5 deletions utils/test-install-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,18 @@ jobs:
run: python utils/setup_test_env.py verify
- name: Compile libraries
run: yggcompile
- name: Run cmake test in command prompt
- name: Run cmake test in command prompt (CONDA)
timeout-minutes: 180
if: runner.os == 'Windows'
if: runner.os == 'Windows' && (matrix.install-method == 'conda' || matrix.install-method == 'mamba')
shell: cmd /C CALL {0}
run: |
cmake -h
run: >-
conda activate test && pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
- name: Run cmake test in command prompt (PIP)
timeout-minutes: 180
if: runner.os == 'Windows' && matrix.install-method != 'conda' && matrix.install-method != 'mamba'
shell: cmd /C CALL {0}
run: >-
pytest --import-mode=importlib --ci --cov-append --nocapture tests/drivers/test_CMakeModelDriver.py
- name: Run tests (1st)
timeout-minutes: 180
id: test1
Expand Down
12 changes: 7 additions & 5 deletions yggdrasil/drivers/CModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,13 @@ class MSVCArchiver(ArchiverBase):
libtype_order = ['static', 'shared']
else:
libtype_order = ['shared', 'static']
_python_lib = ygg_cfg.get('c', 'python_%s' % libtype_order[0],
ygg_cfg.get('c', 'python_%s' % libtype_order[1], None))
if (_python_lib is None) or (not os.path.isfile(_python_lib)): # pragma: no cover
_python_lib = tools.get_python_c_library(
allow_failure=True, libtype=libtype_order[0])
_python_lib = ygg_cfg.get('c', f'python_{libtype_order[0]}',
ygg_cfg.get('c', f'python_{libtype_order[1]}', None))
for _python_libtype in libtype_order:
if (_python_lib is not None) and os.path.isfile(_python_lib):
break
_python_lib = tools.get_python_c_library( # pragma: no cover
allow_failure=True, libtype=_python_libtype)
except BaseException as e: # pragma: debug
warnings.warn("ERROR LOCATING PYTHON LIBRARY: %s" % e)
_python_lib = None
Expand Down
1 change: 1 addition & 0 deletions yggdrasil/drivers/CompiledModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,7 @@ def get_flags(cls, dont_link=None, add_linker_switch=False,
from yggdrasil import __version__
kwargs.setdefault('definitions', [])
kwargs['definitions'].append('WITH_YGGDRASIL')
kwargs['definitions'].append('_USE_MATH_DEFINES')
yggver = __version__.split('+')[0].split('v')[-1].split('.')
if len(yggver) > 0:
kwargs['definitions'] += [f'YGGVER_MAJOR={yggver[0]}']
Expand Down
Loading

0 comments on commit bc23d79

Please sign in to comment.