-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from pyiron/pyproject_toml
Switch to pyproject.toml
- Loading branch information
Showing
14 changed files
with
165 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
version_low_dict=get_env_version(env_content=env_content), | ||
version_high_dict=get_setup_version_and_pattern(setup_content=setup_content), | ||
) | ||
|
||
with open('pyproject.toml', "w") as f: | ||
f.writelines(setup_content_new) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[build-system] | ||
requires = ["ase", "matplotlib", "numpy", "setuptools", "scipy"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "structuretoolkit" | ||
description = "build, analyse and visualise atomistic structures for materials science" | ||
authors = [ | ||
{ name = "Jan Janssen", email = "[email protected]" }, | ||
] | ||
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 = [ | ||
"ase==3.22.1", | ||
"matplotlib==3.8.2", | ||
"numpy==1.26.2", | ||
"scipy==1.11.4", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/pyiron/structuretoolkit" | ||
Documentation = "https://github.com/pyiron/structuretoolkit" | ||
Repository = "https://github.com/pyiron/structuretoolkit" | ||
|
||
[project.optional-dependencies] | ||
grainboundary = [ | ||
"aimsgb==1.1.0", | ||
"pymatgen==2023.11.12", | ||
] | ||
pyscal = ["pyscal2==2.10.18"] | ||
nglview = ["nglview==3.0.8"] | ||
plotly = ["plotly==5.18.0"] | ||
clusters = ["scikit-learn==1.3.2"] | ||
symmetry = ["spglib==2.1.0"] | ||
surface = [ | ||
"spglib==2.1.0", | ||
"pymatgen==2023.11.12", | ||
] | ||
phonopy = [ | ||
"phonopy==2.20.0", | ||
"spglib==2.1.0", | ||
] | ||
pyxtal = ["pyxtal==0.6.1"] | ||
|
||
[tool.setuptools] | ||
packages = ["structuretoolkit"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "structuretoolkit.__version__"} | ||
|
||
[tool.versioneer] | ||
VCS = "git" | ||
style = "pep440-pre" | ||
versionfile_source = "structuretoolkit/_version.py" | ||
parentdir_prefix = "structuretoolkit" | ||
tag_prefix = "structuretoolkit-" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,3 @@ | ||
""" | ||
Setuptools based setup module | ||
""" | ||
from setuptools import setup, find_packages | ||
import versioneer | ||
from setuptools import setup | ||
|
||
setup( | ||
name='structuretoolkit', | ||
version=versioneer.get_version(), | ||
description='structuretoolkit - to analyse, build and visualise atomistic structures.', | ||
long_description='http://pyiron.org', | ||
|
||
url='https://github.com/pyiron/structuretoolkit', | ||
author='Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department', | ||
author_email='[email protected]', | ||
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.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11' | ||
], | ||
|
||
keywords='pyiron', | ||
packages=find_packages(exclude=["*tests*", "*docs*", "*binder*", "*conda*", "*notebooks*", "*.ci_support*"]), | ||
install_requires=[ | ||
'ase==3.22.1', | ||
'matplotlib==3.8.2', # ase already requires matplotlib | ||
'numpy==1.26.2', # ase already requires numpy | ||
'scipy==1.11.4', # ase already requires scipy | ||
], | ||
extras_require={ | ||
"grainboundary": ['aimsgb==1.1.0', 'pymatgen==2023.11.12'], | ||
"pyscal": ['pyscal2==2.10.18'], | ||
"nglview": ['nglview==3.0.8'], | ||
"plotly": ['plotly==5.18.0'], | ||
"clusters": ['scikit-learn==1.3.2'], | ||
"symmetry": ['spglib==2.1.0'], | ||
"surface": ['spglib==2.1.0', 'pymatgen==2023.11.12'], | ||
"phonopy": ['phonopy==2.20.0', 'spglib==2.1.0'], | ||
"pyxtal": ['pyxtal==0.6.1'] | ||
}, | ||
cmdclass=versioneer.get_cmdclass(), | ||
) | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.