Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --diff"
Expand Down
7 changes: 2 additions & 5 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,13 +23,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}
run: |
pip install --no-deps .
coverage run --omit pylammpsmpi/_version.py -m unittest discover tests
coverage combine
- name: Coveralls
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down
18 changes: 8 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,21 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pylammpsmpi
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: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: >-
python -m pip install --user --upgrade setuptools wheel
run: python -m pip install --user --upgrade setuptools wheel versioneer
- 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: >-
python setup.py sdist bdist_wheel
run: python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
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
2 changes: 1 addition & 1 deletion .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 Down
9 changes: 4 additions & 5 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']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -27,10 +27,9 @@ 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: python -m unittest discover tests
run: |
pip install --no-deps .
python -m unittest discover tests
9 changes: 4 additions & 5 deletions .github/workflows/unittests-old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
Expand All @@ -23,10 +23,9 @@ jobs:
channel-priority: strict
use-mamba: true
environment-file: .ci_support/environment-old.yml
- name: Setup
shell: bash -l {0}
run: pip install --no-deps .
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: python -m unittest discover tests
run: |
pip install --no-deps .
python -m unittest discover tests
9 changes: 4 additions & 5 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']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -27,10 +27,9 @@ 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: python -m unittest discover tests
run: |
pip install --no-deps .
python -m unittest discover tests
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
include LICENSE
include versioneer.py
include pylammpsmpi/_version.py
include LICENSE
8 changes: 3 additions & 5 deletions pylammpsmpi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from pylammpsmpi.wrapper.extended import LammpsLibrary
from pylammpsmpi.wrapper.concurrent import LammpsConcurrent
from pylammpsmpi.wrapper.base import LammpsBase

from ._version import get_versions

try:
from pylammpsmpi.wrapper.extended import LammpsLibrary
from pylammpsmpi.wrapper.concurrent import LammpsConcurrent
from pylammpsmpi.wrapper.base import LammpsBase
from pylammpsmpi.wrapper.ase import LammpsASELibrary
except ImportError:
pass


__version__ = get_versions()["version"]
del get_versions
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["setuptools", "versioneer[toml]==0.29"]
build-backend = "setuptools.build_meta"

[project]
name = "pylammpsmpi"
description = "Parallel Lammps Python interface - control a mpi4py parallel LAMMPS instance from a serial python process or a Jupyter notebook"
authors = [
{ name = "Jan Janssen", email = "janssen@mpie.de" },
]
readme = "README.md"
license = { file = "LICENSE" }
keywords = ["pyiron"]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Scientific/Engineering :: Physics",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"mpi4py==3.1.5",
"pympipool==0.7.5",
"numpy==1.26.2",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/pyiron/pylammpsmpi"
Documentation = "https://github.com/pyiron/pylammpsmpi"
Repository = "https://github.com/pyiron/pylammpsmpi"

[project.optional-dependencies]
ase = [
"ase==3.22.1",
"scipy==1.11.4",
]

[tool.setuptools.packages.find]
include = ["pylammpsmpi*"]

[tool.setuptools.dynamic]
version = {attr = "pylammpsmpi.__version__"}

[tool.versioneer]
VCS = "git"
style = "pep440-pre"
versionfile_source = "pylammpsmpi/_version.py"
parentdir_prefix = "pylammpsmpi"
tag_prefix = "pylammpsmpi-"
13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

34 changes: 3 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,8 @@
from setuptools import setup, find_packages
from setuptools import setup

import versioneer

setup(
name="pylammpsmpi",
version=versioneer.get_version(),
description="Parallel Lammps Python interface",
long_description="PylammpsMPI couples a serial python process to an MPI parallel LAMMPS libary.",
url='https://github.com/pyiron/pylammpsmpi',
author='Jan Janssen',
author_email='janssen@mpie.de',
license='BSD',

classifiers=[
'Development Status :: 5 - Production/Stable',
'Topic :: Scientific/Engineering :: Physics',
'License :: OSI Approved :: BSD License',
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],

keywords='lammps, mpi4py',
packages=find_packages(exclude=["*tests*"]),
install_requires=[
"mpi4py==3.1.5", "pympipool==0.7.5", "numpy==1.26.2"
],
extras_require={
"ase": ["ase==3.22.1", "scipy==1.11.4"],
},
cmdclass=versioneer.get_cmdclass(),
)
)
Loading