diff --git a/README.md b/README.md index 5d8214b2..a5ad27bd 100644 --- a/README.md +++ b/README.md @@ -259,11 +259,8 @@ If a valence of 3 is detected on carbon, the formal charge will be assigned to - # Plugins -One can follow [a simple example](plugin_example/) to add their own format by creating and installing plugins. It's critical to add the [Format](dpdata/format.py) class to `entry_points['dpdata.plugins']` in `setup.py`: -```py - entry_points={ - 'dpdata.plugins': [ - 'random=dpdata_random:RandomFormat' - ] - }, +One can follow [a simple example](plugin_example/) to add their own format by creating and installing plugins. It's critical to add the [Format](dpdata/format.py) class to `entry_points['dpdata.plugins']` in [`pyproject.toml`](plugin_example/pyproject.toml): +```toml +[project.entry-points.'dpdata.plugins'] +random = "dpdata_random:RandomFormat" ``` diff --git a/plugin_example/pyproject.toml b/plugin_example/pyproject.toml new file mode 100644 index 00000000..d8652bd2 --- /dev/null +++ b/plugin_example/pyproject.toml @@ -0,0 +1,16 @@ +[build-system] +requires = ["setuptools>=45"] +build-backend = "setuptools.build_meta" + +[project] +name = "dpdata_random" +version = "0.0.0" +description = "An example for dpdata plugin" +dependencies = [ + 'numpy', + 'dpdata', +] +readme = "README.md" + +[project.entry-points.'dpdata.plugins'] +random = "dpdata_random:RandomFormat" diff --git a/plugin_example/setup.py b/plugin_example/setup.py deleted file mode 100644 index 031afb60..00000000 --- a/plugin_example/setup.py +++ /dev/null @@ -1,12 +0,0 @@ -from setuptools import setup - -setup( - name="dpdata_random", - packages=['dpdata_random'], - entry_points={ - 'dpdata.plugins': [ - 'random=dpdata_random:RandomFormat' - ] - }, - install_requires=['dpdata', 'numpy'], -) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..6cc28717 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "dpdata" +dynamic = ["version"] +description = "Manipulating data formats of DeePMD-kit, VASP, QE, PWmat, and LAMMPS, etc." +authors = [ + {name = "DeepModeling"}, + {name = "Han Wang", email = "wang_han@iapcm.ac.cn"}, +] +license = {file = "LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3.6", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", +] +dependencies = [ + 'numpy>=1.14.3', + 'monty', + 'scipy', + 'h5py', + 'wcmatch', + 'importlib_metadata>=1.4; python_version < "3.8"', +] +requires-python = ">=3.6" +readme = "README.md" +keywords = ["lammps", "vasp", "deepmd-kit"] + +[project.urls] +Homepage = "https://github.com/deepmodeling/dpdata" +documentation = "https://docs.deepmodeling.com/projects/dpdata" +repository = "https://github.com/deepmodeling/dpdata" + +[project.entry-points.console_scripts] +dpdata = "dpdata.cli:dpdata_cli" + +[project.optional-dependencies] +ase = ['ase'] +amber = ['parmed'] +pymatgen = ['pymatgen'] +docs = [ + 'sphinx', + 'recommonmark', + 'sphinx_rtd_theme>=1.0.0rc1', + 'numpydoc', + 'm2r2', + 'deepmodeling-sphinx>=0.1.1', + 'sphinx-argparse', +] + +[tool.setuptools.packages.find] +include = ["dpdata*"] + +[tool.setuptools.package-data] +dpdata = ['*.json'] + +[tool.setuptools_scm] +write_to = "dpdata/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 4407c625..00000000 --- a/setup.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -from os import path -import setuptools - -readme_file = path.join(path.dirname(path.abspath(__file__)), 'README.md') -try: - from m2r import parse_from_file - readme = parse_from_file(readme_file) -except ImportError: - with open(readme_file) as f: - readme = f.read() - -# install_requires = ['xml'] -install_requires=['numpy>=1.14.3', 'monty', 'scipy', 'h5py', 'wcmatch', 'importlib_metadata>=1.4; python_version < "3.8"'] - -setuptools.setup( - name="dpdata", - use_scm_version={'write_to': 'dpdata/_version.py'}, - setup_requires=['setuptools_scm'], - author="Han Wang", - author_email="wang_han@iapcm.ac.cn", - description="Manipulating data formats of DeePMD-kit, VASP, QE, PWmat, and LAMMPS, etc.", - long_description=readme, - long_description_content_type="text/markdown", - url="https://github.com/deepmodeling/dpdata", - packages=['dpdata', - 'dpdata/vasp', - 'dpdata/lammps', - 'dpdata/md', - 'dpdata/deepmd', - 'dpdata/qe', - 'dpdata/siesta', - 'dpdata/gaussian', - 'dpdata/cp2k', - 'dpdata/xyz', - 'dpdata/pwmat', - 'dpdata/amber', - 'dpdata/fhi_aims', - 'dpdata/gromacs', - 'dpdata/abacus', - 'dpdata/rdkit', - 'dpdata/plugins', - 'dpdata/pymatgen', - ], - package_data={'dpdata':['*.json']}, - classifiers=[ - "Programming Language :: Python :: 3.6", - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", - ], - keywords='lammps vasp deepmd-kit', - install_requires=install_requires, - extras_require={ - 'ase': ['ase'], - 'amber': ['parmed'], - 'pymatgen': ['pymatgen'], - 'docs': [ - 'sphinx', - 'recommonmark', - 'sphinx_rtd_theme>=1.0.0rc1', - 'numpydoc', - 'm2r2', - 'deepmodeling-sphinx>=0.1.1', - 'sphinx-argparse', - ], - }, - entry_points={"console_scripts": ["dpdata = dpdata.cli:dpdata_cli"]}, -) -