Skip to content

Commit

Permalink
Test against latest upstream versions (#168)
Browse files Browse the repository at this point in the history
* Test against latest upstream versions

* set CC & CXX env vars

* Add suitesparse to CPATH

* forgot CPATH

* another PulpSolverError

* PulpSolverError from pulp

* python -> python3
  • Loading branch information
bjodah committed May 29, 2020
1 parent c4aa837 commit 379e140
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
35 changes: 19 additions & 16 deletions .drone.yml
Expand Up @@ -3,7 +3,6 @@ pipeline:
image: drillster/drone-volume-cache
restore: true
mount:
# - ./ci-cache/sund-3.2.1
- ./ci-cache/pyusrb
- ./ci-cache/conda_packages
- ./ci-cache/pip_cache
Expand All @@ -12,16 +11,17 @@ pipeline:
ttl: 90 # liftetime in days

install:
image: bjodah/bjodahimg18dev:v4.0.1
image: bjodah/bjodahimg20dev:v1.2.0
environment:
- CPLUS_INCLUDE_PATH=/opt/boost_1_72_p/include
- SUNDBASE=/opt/sundials-5.1.0-klu-lapack
- CC=gcc-10
- CXX=g++-10
- CPLUS_INCLUDE_PATH=/opt/boost_1_73_p/include
- SUNDBASE=/opt/sundials-5.3.0-klu-lapack
- CPATH=/usr/include/suitesparse # sunlinsol_klu.h includes "klu.h"
commands:
# - export SUNDBASE=$(pwd)/ci-cache/sund-3.2.1
- export PYTHONUSERBASE=$(pwd)/ci-cache/pyusrb
# - if [ ! -d $SUNDBASE ]; then .ci/get_sundials.sh 3.2.1 $SUNDBASE -DLAPACK_ENABLE:BOOL=ON -DSUNDIALS_INDEX_SIZE=32 $SUNDBASE; fi
- if [ ! -d $PYTHONUSERBASE ]; then mkdir -p $PYTHONUSERBASE; fi
- export CPATH=$SUNDBASE/include
- export CPATH=$SUNDBASE/include:$CPATH
- export LIBRARY_PATH=$SUNDBASE/lib
- export LD_LIBRARY_PATH=$SUNDBASE/lib
- python3 -m pip install --cache-dir ./ci-cache/pip_cache --user -e .[all]
Expand All @@ -33,14 +33,17 @@ pipeline:
- cp dist/chempy-* deploy/public_html/branches/${DRONE_BRANCH}/

test-suite:
image: bjodah/bjodahimg18dev:v4.0.1
image: bjodah/bjodahimg20dev:v1.2.0
group: testing
environment:
- CPLUS_INCLUDE_PATH=/opt/boost_1_72_p/include
- SUNDBASE=/opt/sundials-5.1.0-klu-lapack
- CC=gcc-10
- CXX=g++-10
- CPLUS_INCLUDE_PATH=/opt/boost_1_73_p/include
- SUNDBASE=/opt/sundials-5.3.0-klu-lapack
- CPATH=/usr/include/suitesparse # sunlinsol_klu.h includes "klu.h"
commands:
- export PYTHONUSERBASE=$(pwd)/ci-cache/pyusrb
- export CPATH=$SUNDBASE/include
- export CPATH=$SUNDBASE/include:$CPATH
- export LIBRARY_PATH=$SUNDBASE/lib
- export LD_LIBRARY_PATH=$SUNDBASE/lib
- bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]'
Expand All @@ -56,11 +59,11 @@ pipeline:
- bash -c "source /tmp/test_git_archive/bin/activate; pip install --cache-dir ./ci-cache/pip_cache chempy-head.zip pytest; pytest --pyargs chempy"

render-notebooks:
image: bjodah/bjodahimg18dev:v4.0.1
image: bjodah/bjodahimg20dev:v1.2.0
group: testing
environment:
- CHEMPY_DEPRECATION_FILTER=ignore
- SUNDBASE=/opt/sundials-5.1.0-klu-lapack
- SUNDBASE=/opt/sundials-5.3.0-klu-lapack
commands:
- export PYTHONUSERBASE=$(pwd)/ci-cache/pyusrb
- export CPATH=$SUNDBASE/include
Expand All @@ -73,7 +76,7 @@ pipeline:
- cp -r index.* examples/ "deploy/public_html/branches/${DRONE_BRANCH}"

# conda-recipe:
# image: bjodah/bjodahimg18dev:v4.0.1
# image: bjodah/bjodahimg20dev:v1.2.0
# group: testing
# commands:
# - export CONDA_PKGS_DIRS=$(pwd)/ci-cache/conda_packages
Expand All @@ -83,10 +86,10 @@ pipeline:
# - (cd $CONDA_PKGS_DIRS; find . -maxdepth 1 -type d -not -path . -not -path .. | xargs rm -r)

compile-documentation:
image: bjodah/bjodahimg18dev:v4.0.1
image: bjodah/bjodahimg20dev:v1.2.0
environment:
- CHEMPY_DEPRECATION_FILTER=ignore
- SUNDBASE=/opt/sundials-5.1.0-klu-lapack
- SUNDBASE=/opt/sundials-5.3.0-klu-lapack
commands:
- export PYTHONUSERBASE=$(pwd)/ci-cache/pyusrb
- export CPATH=$SUNDBASE/include
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Expand Up @@ -7,7 +7,7 @@ ChemPy
.. image:: https://img.shields.io/pypi/v/chempy.svg
:target: https://pypi.python.org/pypi/chempy
:alt: PyPI version
.. image:: https://img.shields.io/badge/python-3.6,3.7-blue.svg
.. image:: https://img.shields.io/badge/python-3.7,3.8-blue.svg
:target: https://www.python.org/
:alt: Python version
.. image:: https://img.shields.io/pypi/l/chempy.svg
Expand Down Expand Up @@ -102,8 +102,8 @@ Note that this option will install the following libraries

- `pygslodeiv2 <https://github.com/bjodah/pygslodeiv2>`_: solving initial value problems, requires GSL_. (>=1.16).
- `pyodeint <https://github.com/bjodah/pyodeint>`_: solving initial value problems, requires boost_ (>=1.65.0).
- `pycvodes <https://github.com/bjodah/pycvodes>`_: solving initial value problems, requires SUNDIALS_ (>=2.7.0).
- `pykinsol <https://github.com/bjodah/pykinsol>`_: solving non-linear root-finding, requires SUNDIALS_ (>=2.7.0).
- `pycvodes <https://github.com/bjodah/pycvodes>`_: solving initial value problems, requires SUNDIALS_ (>=5.3.0).
- `pykinsol <https://github.com/bjodah/pykinsol>`_: solving non-linear root-finding, requires SUNDIALS_ (>=5.3.0).
- `pycompilation <https://github.com/bjodah/pycompilation>`_: python front-end for calling compilers, requires gcc/clang/icpc.
- `pycodeexport <https://github.com/bjodah/pycodeexport>`_: package for code-generation, used when generating C++ code.

Expand Down
12 changes: 9 additions & 3 deletions chempy/tests/test_chemistry.py
Expand Up @@ -340,17 +340,23 @@ def test_balance_stoichiometry__simple():
assert p2 == {'Na2O': 1, 'CO2': 1}


@requires('sympy')
@requires('sympy', 'pulp')
@pytest.mark.parametrize('underdet', [False, None, True])
def test_balance_stoichiometry__impossible(underdet):
from pulp.solvers import PulpSolverError
try:
from pulp import PulpSolverError
except ModuleNotFoundError:
from pulp.solvers import PulpSolverError # older version of PuLP
with pytest.raises((ValueError, PulpSolverError)):
r1, p1 = balance_stoichiometry({'CO'}, {'CO2'}, underdetermined=underdet)


@requires('sympy', 'pulp')
def test_balance_stoichiometry__underdetermined():
from pulp.solvers import PulpSolverError
try:
from pulp import PulpSolverError
except ModuleNotFoundError:
from pulp.solvers import PulpSolverError # older version of PuLP

with pytest.raises(ValueError):
balance_stoichiometry({'C2H6', 'O2'}, {'H2O', 'CO2', 'CO'}, underdetermined=False)
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage_badge.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Expand Down
13 changes: 6 additions & 7 deletions setup.py
Expand Up @@ -73,9 +73,8 @@ def _path_under_setup(*args):
'Topic :: Scientific/Engineering :: Chemistry',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
]

with io.open(_path_under_setup(pkg_name, '__init__.py'), 'rt', encoding='utf-8') as f:
Expand All @@ -88,9 +87,9 @@ def _path_under_setup(*args):
_author, _author_email = open(_path_under_setup('AUTHORS'), 'rt').readline().split('<')

extras_req = {
'integrators': ['pyodeint>=0.10.1', 'pycvodes>=0.11.9', 'pygslodeiv2>=0.9.1'],
'solvers': ['pykinsol>=0.1.3'],
'native': ['pycompilation>=0.4.3', 'pycodeexport>=0.1.2', 'appdirs'],
'integrators': ['pyodeint>=0.10.4', 'pycvodes>=0.13.1', 'pygslodeiv2>=0.9.4'],
'solvers': ['pykinsol>=0.1.5'],
'native': ['pycompilation>=0.4.9', 'pycodeexport>=0.1.2', 'appdirs'],
'docs': ['Sphinx', 'sphinx_rtd_theme', 'numpydoc'],
'plotting': ['bokeh>=0.13.0', 'ipywidgets'],
'testing': ['pytest>=3.9', 'pytest-cov', 'pytest-flakes', 'pytest-pep8', 'rstcheck']
Expand All @@ -112,12 +111,12 @@ def _path_under_setup(*args):
install_requires=[
'numpy>1.11.3', 'scipy>=1.0.1', 'matplotlib>=2.2.3',
'sympy>=1.1.1,!=1.2', 'quantities>=0.12.1', 'pyneqsys>=0.5.5',
'pyodesys>=0.12.5' if sys.version_info[0] >= 3 else 'pyodesys<0.12',
'pyodesys>=0.13.1' if sys.version_info[0] >= 3 else 'pyodesys<0.12',
'pyparsing>=2.0.3', 'sym>=0.3.4', 'jupyter', 'pulp>=1.6.8',
'dot2tex>=2.11.3'
],
extras_require=extras_req,
python_requires='>=3.6'
python_requires='>=3.7'
)

if __name__ == '__main__':
Expand Down

0 comments on commit 379e140

Please sign in to comment.