Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename .drone.yml to .woodpecker.yaml #227

Merged
merged 15 commits into from
Apr 10, 2024
1 change: 1 addition & 0 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- run: flake8 . --count --exit-zero --max-complexity=66 --max-line-length=118
--show-source --statistics
- run: isort --check-only --profile black . || true
- run: pip install setuptools
- run: pip install --editable . || pip install .
- run: mkdir --parents --verbose .mypy_cache
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true
Expand Down
107 changes: 54 additions & 53 deletions .drone.yml → .woodpecker.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
pipeline:
restore-cache:
image: drillster/drone-volume-cache
restore: true
mount:
- ./cache-ci/pyusrb
- ./cache-ci/conda_packages
- ./cache-ci/pip_cache
volumes:
- /tmp/cache:/cache
ttl: 90 # liftetime in days
when:
- event: [pull_request, tag, cron, push]

install:
steps:

- name: restore-cache
image: bjodah/bjodahimg20dot:21.8.a
commands:
- curl ftp://chempy:$${ARTIFACTS_PASS}@$${FTP_SERVER}/cache/cache-ci.tar | tar x
secrets: [ ARTIFACTS_PASS, FTP_SERVER ]
when:
- event: push
repo: bjodah/chempy

- name: install
image: bjodah/bjodahimg20dot:21.8.a
environment:
- CC=gcc-11
Expand All @@ -30,12 +32,11 @@ pipeline:
- git fetch -tq
- python3 setup.py sdist # test pip installable sdist (checks MANIFEST.in)
- git archive -o dist/chempy-head.zip HEAD # test pip installable zip (symlinks break)
- mkdir -p deploy/public_html/branches/${DRONE_BRANCH}
- cp dist/chempy-* deploy/public_html/branches/${DRONE_BRANCH}/
- mkdir -p deploy/public_html/branches/${CI_COMMIT_BRANCH}
- cp dist/chempy-* deploy/public_html/branches/${CI_COMMIT_BRANCH}/

test-suite:
- name: test-suite
image: bjodah/bjodahimg20dot:21.8.a
group: testing
environment:
- CC=gcc-11
- CXX=g++-11
Expand All @@ -52,19 +53,20 @@ pipeline:
- bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]'
- ./scripts/run_tests.sh --cov chempy --cov-report html
- ./scripts/coverage_badge.py htmlcov/ htmlcov/coverage.svg
- cp -r htmlcov/ deploy/public_html/branches/${DRONE_BRANCH}/
- cp -r htmlcov/ deploy/public_html/branches/${CI_COMMIT_BRANCH}/
- ./.ci/grep-for-merge-blocking-token.sh
- export CHEMPY_DEPRECATION_FILTER=ignore
- python3 -m virtualenv /tmp/test_sdist
- python3 -m virtualenv /tmp/test_git_archive
- cd deploy/public_html/branches/${DRONE_BRANCH}
- cd deploy/public_html/branches/${CI_COMMIT_BRANCH}
- unset CHEMPY_SKIP_NO_TESTS # I can't get pip to install extras when using local file...
- bash -c "source /tmp/test_sdist/bin/activate; pip install --cache-dir $CACHE_ROOT/pip_cache file://$(realpath $(eval ls chempy-*.tar.gz))#chempy[all] pytest; pytest --pyargs chempy"
- bash -c "source /tmp/test_git_archive/bin/activate; pip install --cache-dir $CACHE_ROOT/pip_cache file://$(realpath chempy-head.zip)#chempy[all] pytest; pytest --pyargs chempy"
depends_on:
- install

render-notebooks:
- name: render-notebooks
image: bjodah/bjodahimg20dot:21.8.a
group: testing
environment:
- CHEMPY_DEPRECATION_FILTER=ignore
- SUNDBASE=/opt/sundials-5.7.0-release
Expand All @@ -79,20 +81,11 @@ pipeline:
- ./scripts/render_notebooks.sh
- ./.ci/grep-for-binary-data.sh
- mv index.html index.ipynb.html
# - (cd examples/; for f in bokeh_*.py; do python3 -m bokeh html $f; done)
- cp -r index.* examples/ "deploy/public_html/branches/${DRONE_BRANCH}"

# conda-recipe:
# image: bjodah/bjodahimg20dot:21.8.a
# group: testing
# commands:
# - export CONDA_PKGS_DIRS=$(pwd)/cache-ci/conda_packages
# - git fetch -tq
# - PATH=/opt/miniconda3/bin:$PATH conda config --add channels bjodah # sym, pyodesys, pyneqsys
# - PATH=/opt/miniconda3/bin:$PATH conda build --output-folder "deploy/public_html/branches/${DRONE_BRANCH}" conda-recipe
# - (cd $CONDA_PKGS_DIRS; find . -maxdepth 1 -type d -not -path . -not -path .. | xargs rm -r)
- cp -r index.* examples/ "deploy/public_html/branches/${CI_COMMIT_BRANCH}"
depends_on:
- install

compile-documentation:
- name: compile-documentation
image: bjodah/bjodahimg20dot:21.8.a
environment:
- CHEMPY_DEPRECATION_FILTER=ignore
Expand All @@ -104,26 +97,34 @@ pipeline:
- export LD_LIBRARY_PATH=$SUNDBASE/lib
- ./scripts/generate_docs.sh
- cp LICENSE doc/_build/html/
- cp -r doc/_build/html/ deploy/public_html/branches/${DRONE_BRANCH}
- cp -r doc/_build/html/ deploy/public_html/branches/${CI_COMMIT_BRANCH}
depends_on:
- test-suite
- render-notebooks

rebuild-cache:
image: drillster/drone-volume-cache
rebuild: true
mount:
# - ./cache-ci/sund-3.2.1
- ./cache-ci/pyusrb
- ./cache-ci/conda_packages
- ./cache-ci/pip_cache
volumes:
- /tmp/cache:/cache
- name: rebuild-cache
image: bjodah/bjodahimg20dot:21.8.a
commands:
- find ./cache-ci/ -type f -mtime +90 -exec rm {} \;
- tar cf cache-ci.tar ./cache-ci/
- curl -T cache-ci.tar ftp://chempy:$${ARTIFACTS_PASS}@$${FTP_SERVER}/cache/
secrets: [ ARTIFACTS_PASS, FTP_SERVER ]
when:
- event: push
repo: bjodah/chempy
depends_on:
- compile-documentation

deploy:
image: drillster/drone-rsync
- name: deploy-public-html
image: bjodah/bjodahimg20dot:21.8.a
commands:
- tar czf chempy-${CI_COMMIT_BRANCH}.tar.gz ./deploy/public_html
- curl -T chempy-${CI_COMMIT_BRANCH}.tar.gz ftp://chempy:$${ARTIFACTS_PASS}@$${FTP_SERVER}/public_html/
secrets: [ ARTIFACTS_PASS, FTP_SERVER ]
when:
event: [push]
hosts: [ "hera.physchem.kth.se" ]
port: 22
user: chempy
secrets: [ rsync_key ] # secret only set fro event "push" not "pull_request"
source: ./deploy/public_html
target: ~/
- event: push
repo: bjodah/chempy
depends_on:
- compile-documentation


12 changes: 5 additions & 7 deletions chempy/chemistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,8 @@ def _init_stoich(container):
if isinstance(container, set):
container = {k: 1 for k in container}
container = container or {}
if (
type(container) == dict
): # we don't want isinstance here in case of OrderedDict
if type(container) == dict: # noqa
# we don't want isinstance here in case of OrderedDict
container = OrderedDict(sorted(container.items(), key=lambda kv: kv[0]))
return container

Expand Down Expand Up @@ -1456,11 +1455,10 @@ def balance_stoichiometry(
substances = OrderedDict(
[(k, substance_factory(k)) for k in substances.split()]
)
if (
type(reactants) == set
): # we don't want isinstance since it might be "OrderedSet"
if type(reactants) == set: # noqa
# we don't want isinstance since it might be "OrderedSet"
reactants = sorted(reactants)
if type(products) == set:
if type(products) == set: # noqa
products = sorted(products)
subst_keys = list(reactants) + list(products)

Expand Down
2 changes: 1 addition & 1 deletion examples/protein_binding_unfolding_4state_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
"source": [
"Try hovering over the names to have them highlighted (this is particularly useful when working with large reaction sets).\n",
"\n",
"We ca also generate tables representing the unimolecular reactions involing each substance, or the matrix showing the bimolecular reactions:"
"We ca also generate tables representing the unimolecular reactions involving each substance, or the matrix showing the bimolecular reactions:"
]
},
{
Expand Down
Loading