Skip to content

Commit

Permalink
Merge pull request #186 from pyiron/main
Browse files Browse the repository at this point in the history
Merge main
  • Loading branch information
jan-janssen authored Apr 15, 2024
2 parents d8c1485 + 2a5adbf commit 602c851
Show file tree
Hide file tree
Showing 31 changed files with 316 additions and 2,427 deletions.
16 changes: 8 additions & 8 deletions .ci_support/environment-docs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
channels:
- conda-forge
dependencies:
- nbsphinx
- sphinx
- myst-parser
- numpy
- mpi4py
- pympipool
- ase
- scipy
- nbsphinx
- sphinx
- myst-parser
- numpy
- mpi4py
- pympipool
- ase
- scipy
18 changes: 9 additions & 9 deletions .ci_support/environment-mpich.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
channels:
- conda-forge
- conda-forge
dependencies:
- coverage
- lammps =2023.08.02
- mpich
- numpy =1.26.0
- mpi4py =3.1.4
- pympipool =0.7.1
- ase =3.22.1
- scipy =1.11.3
- coverage
- lammps =2024.02.07
- mpich
- numpy =1.26.4
- mpi4py =3.1.5
- pympipool =0.7.17
- ase =3.22.1
- scipy =1.13.0
10 changes: 10 additions & 0 deletions .ci_support/environment-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
channels:
- conda-forge
dependencies:
- lammps =2022.06.23
- openmpi
- numpy =1.23.5
- mpi4py =3.1.4
- pympipool =0.7.0
- ase =3.20.1
- scipy =1.9.3
18 changes: 9 additions & 9 deletions .ci_support/environment-openmpi.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
channels:
- conda-forge
- conda-forge
dependencies:
- coverage
- lammps =2023.08.02
- openmpi
- numpy =1.26.0
- mpi4py =3.1.4
- pympipool =0.7.1
- ase =3.22.1
- scipy =1.11.3
- coverage
- lammps =2024.02.07
- openmpi
- numpy =1.26.4
- mpi4py =3.1.5
- pympipool =0.7.17
- ase =3.22.1
- scipy =1.13.0
61 changes: 61 additions & 0 deletions .ci_support/release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
def get_setup_version_and_pattern(setup_content):
depend_lst, version_lst = [], []
for l in setup_content:
if '==' in l:
lst = l.split('[')[-1].split(']')[0].replace(' ', '').replace('"', '').replace("'", '').split(',')
for dep in lst:
if dep != '\n':
version_lst.append(dep.split('==')[1])
depend_lst.append(dep.split('==')[0])

version_high_dict = {d: v for d, v in zip(depend_lst, version_lst)}
return version_high_dict


def get_env_version(env_content):
read_flag = False
depend_lst, version_lst = [], []
for l in env_content:
if 'dependencies:' in l:
read_flag = True
elif read_flag:
lst = l.replace('-', '').replace(' ', '').replace('\n', '').split("=")
if len(lst) == 2:
depend_lst.append(lst[0])
version_lst.append(lst[1])
return {d:v for d, v in zip(depend_lst, version_lst)}


def update_dependencies(setup_content, version_low_dict, version_high_dict):
version_combo_dict = {}
for dep, ver in version_high_dict.items():
if dep in version_low_dict.keys() and version_low_dict[dep] != ver:
version_combo_dict[dep] = dep + ">=" + version_low_dict[dep] + ",<=" + ver
else:
version_combo_dict[dep] = dep + "==" + ver

setup_content_new = ""
pattern_dict = {d:d + "==" + v for d, v in version_high_dict.items()}
for l in setup_content:
for k, v in pattern_dict.items():
if v in l:
l = l.replace(v, version_combo_dict[k])
setup_content_new +=l
return setup_content_new


if __name__ == "__main__":
with open('pyproject.toml', "r") as f:
setup_content = f.readlines()

with open('environment.yml', "r") as f:
env_content = f.readlines()

setup_content_new = update_dependencies(
setup_content=setup_content[2:],
version_low_dict=get_env_version(env_content=env_content),
version_high_dict=get_setup_version_and_pattern(setup_content=setup_content[2:]),
)

with open('pyproject.toml', "w") as f:
f.writelines("".join(setup_content[:2]) + setup_content_new)
5 changes: 0 additions & 5 deletions .coveragerc

This file was deleted.

3 changes: 0 additions & 3 deletions .github/delete-merged-branch-config.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: monday
interval: "daily"
open-pull-requests-limit: 10
7 changes: 3 additions & 4 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow is used to check the differences and find conflict markers or whitespace errors

name: Black

Expand All @@ -13,8 +12,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --diff"
src: "./pylammpsmpi"
src: ./${{ github.event.repository.name }}
11 changes: 4 additions & 7 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.11"
Expand All @@ -23,14 +23,11 @@ jobs:
channel-priority: strict
use-mamba: true
environment-file: .ci_support/environment-openmpi.yml
- name: Setup
shell: bash -l {0}
run: |
pip install --no-deps .
- name: Test
shell: bash -l {0}
run: |
coverage run --omit pylammpsmpi/_version.py -m unittest discover tests
coverage combine
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
coverage run --omit="pylammpsmpi/_version.py,tests/*" -m unittest discover tests
- name: Coveralls
uses: coverallsapp/github-action@v2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UpdateDependabotPR
name: Update DependabotPR

on:
pull_request_target:
Expand All @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
if: (github.actor == 'dependabot[bot]')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
Expand All @@ -24,6 +24,7 @@ jobs:
to=$(echo "$PR_TITLE" | awk '{print $6}')
sed -i "/${package}/s/${from}/${to}/g" .ci_support/environment-openmpi.yml
sed -i "/${package}/s/${from}/${to}/g" .ci_support/environment-mpich.yml
sed -i "/${package}/s/${from}/${to}/g" binder/environment.yml
- name: UpdateDependabotPR commit
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down
43 changes: 26 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
# This workflow is used to upload and deploy a new release to PyPi
# Based on https://github.com/pypa/gh-action-pypi-publish

name: PyPi Release

on:
push:
pull_request:
workflow_dispatch:

# based on https://github.com/pypa/gh-action-pypi-publish
jobs:
build:
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/${{ github.event.repository.name }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2.2.0
with:
python-version: "3.11"

- name: Install dependencies
run: >-
python -m pip install --user --upgrade setuptools wheel
python-version: 3.11
mamba-version: "*"
channels: conda-forge
miniforge-variant: Mambaforge
channel-priority: strict
auto-update-conda: true
environment-file: .ci_support/environment-openmpi.yml
- name: Convert dependencies
run: >-
sed -i 's/==/>=/g' setup.py; cat setup.py
run: |
cp .ci_support/environment-old.yml environment.yml
python .ci_support/release.py; cat pyproject.toml
- name: Build
run: >-
shell: bash -l {0}
run: |
pip install versioneer[toml]==0.29
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/format_black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pypicheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.11"
Expand All @@ -22,5 +22,6 @@ jobs:
- name: Setup
shell: bash -l {0}
run: |
pip install --no-deps .
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
pip check
11 changes: 5 additions & 6 deletions .github/workflows/unittests-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -27,11 +27,10 @@ jobs:
channel-priority: strict
use-mamba: true
environment-file: .ci_support/environment-mpich.yml
- name: Setup
shell: bash -l {0}
run: |
pip install --no-deps .
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: coverage run --omit pylammpsmpi/_version.py -m unittest discover tests
run: |
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
python -m unittest discover tests
32 changes: 32 additions & 0 deletions .github/workflows/unittests-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unittest Lower Bound

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: strict
use-mamba: true
environment-file: .ci_support/environment-old.yml
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: |
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
python -m unittest discover tests
11 changes: 5 additions & 6 deletions .github/workflows/unittests-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -27,11 +27,10 @@ jobs:
channel-priority: strict
use-mamba: true
environment-file: .ci_support/environment-openmpi.yml
- name: Setup
shell: bash -l {0}
run: |
pip install --no-deps .
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: coverage run --omit pylammpsmpi/_version.py -m unittest discover tests
run: |
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
python -m unittest discover tests
Loading

0 comments on commit 602c851

Please sign in to comment.