WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit dfd8a86

Browse files
authored
Merge pull request #161 from pyiron/pyproject_toml
Switch to pyproject.toml
2 parents da756af + acab604 commit dfd8a86

File tree

16 files changed

+149
-2363
lines changed

16 files changed

+149
-2363
lines changed

.ci_support/release.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
def get_setup_version_and_pattern(setup_content):
2+
depend_lst, version_lst = [], []
3+
for l in setup_content:
4+
if '==' in l:
5+
lst = l.split('[')[-1].split(']')[0].replace(' ', '').replace('"', '').replace("'", '').split(',')
6+
for dep in lst:
7+
if dep != '\n':
8+
version_lst.append(dep.split('==')[1])
9+
depend_lst.append(dep.split('==')[0])
10+
11+
version_high_dict = {d: v for d, v in zip(depend_lst, version_lst)}
12+
return version_high_dict
13+
14+
15+
def get_env_version(env_content):
16+
read_flag = False
17+
depend_lst, version_lst = [], []
18+
for l in env_content:
19+
if 'dependencies:' in l:
20+
read_flag = True
21+
elif read_flag:
22+
lst = l.replace('-', '').replace(' ', '').replace('\n', '').split("=")
23+
if len(lst) == 2:
24+
depend_lst.append(lst[0])
25+
version_lst.append(lst[1])
26+
return {d:v for d, v in zip(depend_lst, version_lst)}
27+
28+
29+
def update_dependencies(setup_content, version_low_dict, version_high_dict):
30+
version_combo_dict = {}
31+
for dep, ver in version_high_dict.items():
32+
if dep in version_low_dict.keys() and version_low_dict[dep] != ver:
33+
version_combo_dict[dep] = dep + ">=" + version_low_dict[dep] + ",<=" + ver
34+
else:
35+
version_combo_dict[dep] = dep + "==" + ver
36+
37+
setup_content_new = ""
38+
pattern_dict = {d:d + "==" + v for d, v in version_high_dict.items()}
39+
for l in setup_content:
40+
for k, v in pattern_dict.items():
41+
if v in l:
42+
l = l.replace(v, version_combo_dict[k])
43+
setup_content_new +=l
44+
return setup_content_new
45+
46+
47+
if __name__ == "__main__":
48+
with open('pyproject.toml', "r") as f:
49+
setup_content = f.readlines()
50+
51+
with open('environment.yml', "r") as f:
52+
env_content = f.readlines()
53+
54+
setup_content_new = update_dependencies(
55+
setup_content=setup_content[2:],
56+
version_low_dict=get_env_version(env_content=env_content),
57+
version_high_dict=get_setup_version_and_pattern(setup_content=setup_content[2:]),
58+
)
59+
60+
with open('pyproject.toml', "w") as f:
61+
f.writelines("".join(setup_content[:2]) + setup_content_new)

.github/workflows/black.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- uses: psf/black@stable
1717
with:
1818
options: "--check --diff"

.github/workflows/coverage.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- uses: conda-incubator/setup-miniconda@v2
1919
with:
2020
python-version: "3.11"
@@ -23,13 +23,10 @@ jobs:
2323
channel-priority: strict
2424
use-mamba: true
2525
environment-file: .ci_support/environment-openmpi.yml
26-
- name: Setup
27-
shell: bash -l {0}
28-
run: |
29-
pip install --no-deps .
3026
- name: Test
3127
shell: bash -l {0}
3228
run: |
29+
pip install --no-deps .
3330
coverage run --omit pylammpsmpi/_version.py -m unittest discover tests
3431
coverage combine
3532
- name: Coveralls

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: (github.actor == 'dependabot[bot]')
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
with:
1414
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR
1515
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

.github/workflows/deploy.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,21 @@ jobs:
1414
runs-on: ubuntu-latest
1515
environment:
1616
name: pypi
17-
url: https://pypi.org/p/pylammpsmpi
17+
url: https://pypi.org/p/${{ github.event.repository.name }}
1818
permissions:
1919
id-token: write
2020
steps:
21-
- uses: actions/checkout@v2
22-
- uses: actions/setup-python@v2
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v4
2323
with:
2424
python-version: "3.11"
25-
2625
- name: Install dependencies
27-
run: >-
28-
python -m pip install --user --upgrade setuptools wheel
26+
run: python -m pip install --user --upgrade setuptools wheel versioneer
2927
- name: Convert dependencies
30-
run: >-
31-
sed -i 's/==/>=/g' setup.py; cat setup.py
28+
run: |
29+
cp .ci_support/environment-old.yml environment.yml
30+
python .ci_support/release.py; cat pyproject.toml
3231
- name: Build
33-
run: >-
34-
python setup.py sdist bdist_wheel
32+
run: python setup.py sdist bdist_wheel
3533
- name: Publish distribution 📦 to PyPI
3634
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/format_black.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
with:
1818
token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }}
1919
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR

.github/workflows/pypicheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- uses: conda-incubator/setup-miniconda@v2
1515
with:
1616
python-version: "3.11"

.github/workflows/unittests-mpich.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: ['3.9', '3.10', '3.11']
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222
- uses: conda-incubator/setup-miniconda@v2
2323
with:
2424
python-version: ${{ matrix.python-version }}
@@ -27,10 +27,9 @@ jobs:
2727
channel-priority: strict
2828
use-mamba: true
2929
environment-file: .ci_support/environment-mpich.yml
30-
- name: Setup
31-
shell: bash -l {0}
32-
run: pip install --no-deps .
3330
- name: Test
3431
shell: bash -l {0}
3532
timeout-minutes: 5
36-
run: python -m unittest discover tests
33+
run: |
34+
pip install --no-deps .
35+
python -m unittest discover tests

.github/workflows/unittests-old.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- uses: conda-incubator/setup-miniconda@v2
1919
with:
2020
python-version: '3.9'
@@ -23,10 +23,9 @@ jobs:
2323
channel-priority: strict
2424
use-mamba: true
2525
environment-file: .ci_support/environment-old.yml
26-
- name: Setup
27-
shell: bash -l {0}
28-
run: pip install --no-deps .
2926
- name: Test
3027
shell: bash -l {0}
3128
timeout-minutes: 5
32-
run: python -m unittest discover tests
29+
run: |
30+
pip install --no-deps .
31+
python -m unittest discover tests

.github/workflows/unittests-openmpi.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: ['3.9', '3.10', '3.11']
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222
- uses: conda-incubator/setup-miniconda@v2
2323
with:
2424
python-version: ${{ matrix.python-version }}
@@ -27,10 +27,9 @@ jobs:
2727
channel-priority: strict
2828
use-mamba: true
2929
environment-file: .ci_support/environment-openmpi.yml
30-
- name: Setup
31-
shell: bash -l {0}
32-
run: pip install --no-deps .
3330
- name: Test
3431
shell: bash -l {0}
3532
timeout-minutes: 5
36-
run: python -m unittest discover tests
33+
run: |
34+
pip install --no-deps .
35+
python -m unittest discover tests

0 commit comments

Comments
 (0)