diff --git a/.ci/run_ci.sh b/.ci/run_ci.sh index e893f73..8533c95 100755 --- a/.ci/run_ci.sh +++ b/.ci/run_ci.sh @@ -1,6 +1,6 @@ -#!/bin/bash -xe +#!/bin/bash -set -u +set -eux export PKG_NAME=$1 SUNDBASE=$2 set +u @@ -10,19 +10,20 @@ if [ ! -e "$SUNDBASE/include/sundials/sundials_config.h" ]; then exit 1 fi +# REPO_TEMP_DIR="$(mktemp -d)" +# trap 'rm -rf -- "$REPO_TEMP_DIR"' EXIT +# cp -ra . "$REPO_TEMP_DIR/." +# cd "$REPO_TEMP_DIR" + mkdir -p $HOME/.config/pip/ -echo -e "[global]\nno-cache-dir = false\ndownload-cache = $(pwd)/ci_cache/pip_cache" >$HOME/.config/pip/pip.conf +echo -e "[global]\nno-cache-dir = false\ndownload-cache = $CI_WORKSPACE/cache-ci/pip_cache" >$HOME/.config/pip/pip.conf python3 -m pip install symcxx pysym # unofficial backends, symengine is tested in the conda build # (cd ./tmp/pycvodes; SUND_CFLAGS="-isystem $SUNDBASE/include $CFLAGS" SUND_LDFLAGS="-Wl,--disable-new-dtags -Wl,-rpath,$SUNDBASE/lib -L$SUNDBASE/lib $LDFLAGS" CFLAGS=$SUND_CFLAGS LDFLAGS=$SUND_LDFLAGS python3 -m pip install pycvodes -git clean -xfd # -e tmp/ -# export CPATH=$SUNDBASE/include -# export LIBRARY_PATH=$SUNDBASE/lib -# export LD_LIBRARY_PATH=$SUNDBASE/lib python3 setup.py sdist PKG_VERSION=$(python3 setup.py --version) diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 7630194..0000000 --- a/.drone.yml +++ /dev/null @@ -1,98 +0,0 @@ -clone: - default: - image: plugins/git - recursive: true - submodule_override: - external/anyode: git://github.com/bjodah/anyode.git - -pipeline: - restore-cache: - image: drillster/drone-volume-cache - restore: true - mount: - - ./ci_cache/conda_packages - - ./ci_cache/pip_cache - volumes: - - /tmp/cache:/cache - ttl: 90 # liftetime in days - - # get-pre-reqs: - # image: bjodah/bjodahimg20dev:21.8.a - # commands: - # - mkdir ./tmp - # - git clone --recurse-submodules https://github.com/bjodah/pycvodes.git ./tmp/pycvodes - - # test-py2: - # image: bjodah/bjodahimg20dev:21.8.a - # environment: - # - CC=gcc-11 - # - CXX=g++-11 - # - OMP_NUM_THREADS=1 - # - ANYODE_NUM_THREADS=2 - # - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost-1.77.0/include - # - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - # - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - # - SUNDBASE=/opt/sundials-5.7.0-release - # commands: - # - apt-get update && apt-get --assume-yes install python2-dev - # - bash -c "ulimit -v 2048000; .ci/test_py2.sh pyodesys $SUNDBASE" - - test-sund-5.7.0-rel: - group: testing - image: bjodah/bjodahimg20dot:21.8.a - environment: - - CC=gcc-11 - - CXX=g++-11 - - OMP_NUM_THREADS=1 - - ANYODE_NUM_THREADS=2 - - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost-1.77.0/include - - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - SUNDBASE=/opt/sundials-5.7.0-release - commands: - - python3 -m pip install https://github.com/bjodah/pycompilation/archive/master.tar.gz - - bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE" - - ./scripts/prepare_deploy.sh - - bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]' - - test-sund-5.7.0-extended: - group: testing - image: bjodah/bjodahimg20dot:21.8.a - environment: - - CC=gcc-11 - - CXX=g++-11 - - OMP_NUM_THREADS=1 - - ANYODE_NUM_THREADS=2 - - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost-1.77.0/include - - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - SUNDBASE=/opt/sundials-5.7.0-extended - - PYCVODES_NO_LAPACK=1 - - PYCVODES_NO_KLU=1 - commands: - - bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE" - - git clean -xfd - - ./scripts/grep-for-merge-blocking-token.sh - - ./scripts/grep-for-binary-data.sh - -deploy: - - rebuild-cache: - image: drillster/drone-volume-cache - rebuild: true - mount: - - ./ci_cache/conda_packages - - ./ci_cache/pip_cache - volumes: - - /tmp/cache:/cache - - deploy: - image: drillster/drone-rsync - when: - event: [push] - hosts: [ "hera.physchem.kth.se" ] - port: 22 - user: pyodesys - secrets: [ rsync_key ] # secret only set from event "push" not "pull_request" - source: ./deploy/public_html - target: ~/ diff --git a/.gitmodules b/.gitmodules index ce06ee9..9c37aa0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "external/anyode"] path = external/anyode - url = git://github.com/bjodah/anyode + url = https://github.com/bjodah/anyode diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..6a96b60 --- /dev/null +++ b/.woodpecker.yaml @@ -0,0 +1,76 @@ +when: + - event: [push] + +steps: + + - name: restore-cache + image: bjodah/bjodahimg20dot:21.8.a + commands: + - curl ftp://${CI_REPO_NAME}:$${ARTIFACTS_PASS}@$${FTP_SERVER}/cache/cache-ci.tar | tar -C / x || mkdir -p $CI_WORKSPACE/cache-ci/pip_cache + secrets: [ ARTIFACTS_PASS, FTP_SERVER ] + when: + - event: push + repo: bjodah/pyodesys + + - name: test-sund-5.7.0-rel + depends_on: restore-cache + image: bjodah/bjodahimg20dot:21.8.a + environment: + - CC=gcc-11 + - CXX=g++-11 + - OMP_NUM_THREADS=1 + - ANYODE_NUM_THREADS=2 + - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost-1.77.0/include + - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu + - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu + - SUNDBASE=/opt/sundials-5.7.0-release + commands: + - cp -ra $CI_WORKSPACE /tmp/test-sund-5.7.0-rel + - cd /tmp/test-sund-5.7.0-rel + - python3 -m pip install --cache-dir $CI_WORKSPACE/cache-ci/pip_cache --upgrade-strategy=eager --upgrade cython https://github.com/bjodah/pycompilation/archive/master.tar.gz + - bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE" + - ./scripts/prepare_deploy.sh + - bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]' + - cp -ra /tmp/test-sund-5.7.0-rel/deploy $CI_WORKSPACE/ + + - name: test-sund-5.7.0-extended + depends_on: restore-cache + image: bjodah/bjodahimg20dot:21.8.a + environment: + - CC=gcc-11 + - CXX=g++-11 + - OMP_NUM_THREADS=1 + - ANYODE_NUM_THREADS=2 + - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost-1.77.0/include + - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu + - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu + - SUNDBASE=/opt/sundials-5.7.0-extended + - PYCVODES_NO_LAPACK=1 + - PYCVODES_NO_KLU=1 + commands: + - cp -ra $CI_WORKSPACE/ /tmp/test-sund-5.7.0-extended + - cd /tmp/test-sund-5.7.0-extended + - python3 -m pip install --cache-dir $CI_WORKSPACE/cache-ci/pip_cache --upgrade-strategy=eager --upgrade cython + - bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE" + - ./scripts/grep-for-merge-blocking-token.sh + - ./scripts/grep-for-binary-data.sh + + - name: rebuild-cache + image: bjodah/bjodahimg20dot:21.8.a + commands: + - find $CI_WORKSPACE/cache-ci/ -type f -mtime +90 -exec rm {} \; + - tar cf cache-ci.tar $CI_WORKSPACE/cache-ci/ + - curl -T cache-ci.tar ftp://${CI_REPO_NAME}:$${ARTIFACTS_PASS}@$${FTP_SERVER}/cache/ + secrets: [ ARTIFACTS_PASS, FTP_SERVER ] + depends_on: + - test-sund-5.7.0-rel + + - name: deploy-public-html + image: bjodah/bjodahimg20dot:21.8.a + commands: + - tar -C deploy/public_html -czf ${CI_REPO_NAME}-${CI_COMMIT_BRANCH}.tar.gz . + - curl -T ${CI_REPO_NAME}-${CI_COMMIT_BRANCH}.tar.gz ftp://${CI_REPO_NAME}:$${ARTIFACTS_PASS}@$${FTP_SERVER}/public_html/ + secrets: [ ARTIFACTS_PASS, FTP_SERVER ] + depends_on: + - test-sund-5.7.0-rel + diff --git a/README.rst b/README.rst index 28e78f8..40c023e 100644 --- a/README.rst +++ b/README.rst @@ -1,26 +1,17 @@ pyodesys ======== -.. image:: http://hera.physchem.kth.se:8090/api/badges/bjodah/pyodesys/status.svg - :target: http://hera.physchem.kth.se:8090/bjodah/pyodesys - :alt: Build status on Drone -.. image:: https://circleci.com/gh/bjodah/pyodesys.svg?style=svg - :target: https://circleci.com/gh/bjodah/pyodesys - :alt: Build status on CircleCI +.. image:: http://hackspett.bjodah.se/api/badges/8/status.svg + :target: http://hackspett.bjodah.se/repos/8 + :alt: Build status on Woodpecker CI .. image:: https://img.shields.io/pypi/v/pyodesys.svg :target: https://pypi.python.org/pypi/pyodesys :alt: PyPI version -.. 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/pyodesys.svg :target: https://github.com/bjodah/pyodesys/blob/master/LICENSE :alt: License -.. image:: http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat - :target: http://hera.physchem.kth.se/~pyodesys/benchmarks - :alt: airspeedvelocity -.. image:: http://hera.physchem.kth.se/~pyodesys/branches/master/htmlcov/coverage.svg - :target: http://hera.physchem.kth.se/~pyodesys/branches/master/htmlcov +.. image:: http://artifacts.bjodah.se/pyodesys/branches/master/htmlcov/coverage.svg + :target: http://artifacts.bjodah.se/pyodesys/branches/master/htmlcov :alt: coverage .. image:: http://joss.theoj.org/papers/10.21105/joss.00490/status.svg :target: https://doi.org/10.21105/joss.00490 @@ -63,7 +54,7 @@ Documentation Auto-generated API documentation for latest stable release is found here: ``_ (and the development version for the current master branch is found here: -``_). +``_). Installation @@ -227,7 +218,7 @@ further reduced by a factor equal to the number of cores of your CPU (number of the environment variable ``ANYODE_NUM_THREADS``). For further examples, see `examples/ `_, and rendered -jupyter notebooks here: ``_ +jupyter notebooks here: ``_ Run notebooks using binder ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/pyodesys/symbolic.py b/pyodesys/symbolic.py index 895ac61..105d69d 100644 --- a/pyodesys/symbolic.py +++ b/pyodesys/symbolic.py @@ -67,7 +67,7 @@ def _get_ny_nparams_from_kw(ny, nparams, kwargs): def _get_lin_invar_mtx(lin_invar, be, ny, names=None): - if lin_invar is None or lin_invar == []: + if lin_invar is None or len(lin_invar) == 0: return None else: if isinstance(lin_invar[0], dict) and names: