From 4419d45d2e6e1b17d8bc093b70647ab62bd6e098 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 12 Oct 2022 21:11:57 -0400 Subject: [PATCH] migrate from setup.py to pyproject.toml (#995) Follows PEP 621. This PR also removes the automatic `__date__` -- it only reflects the installation date. --- dpgen/__init__.py | 4 --- pyproject.toml | 49 +++++++++++++++++++++++++++++++ setup.py | 74 ----------------------------------------------- 3 files changed, 49 insertions(+), 78 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/dpgen/__init__.py b/dpgen/__init__.py index 1351b73fe4..e231787465 100644 --- a/dpgen/__init__.py +++ b/dpgen/__init__.py @@ -21,10 +21,6 @@ from ._version import version as __version__ except ImportError: __version__ = 'unkown' -try: - from ._date import date as __date__ -except ImportError: - __date__ = 'unkown' def info(): """ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..5720dbc240 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "dpgen" +dynamic = ["version"] +description = "DP-GEN: The deep potential generator" +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', + 'dpdata>=0.2.6', + 'pymatgen>=2022.7.19', + 'ase', + 'monty>2.0.0', + 'paramiko', + 'custodian', + 'GromacsWrapper>=0.8.0', + 'dpdispatcher>=0.3.11', + 'netCDF4', + 'dargs>=0.2.9', + 'h5py', + 'pymatgen-analysis-defects', +] +requires-python = ">=3.6" +readme = "README.md" +keywords = ["deep potential generator", "active learning", "deepmd-kit"] + +[project.urls] +Homepage = "https://github.com/deepmodeling/dpgen" +documentation = "https://docs.deepmodeling.com/projects/dpgen" +repository = "https://github.com/deepmodeling/dpgen" + +[project.entry-points.console_scripts] +dpgen = "dpgen.main:main" + +[tool.setuptools.packages.find] +include = ["dpgen*"] + +[tool.setuptools_scm] +write_to = "dpgen/_version.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 1336b6484c..0000000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from os import path -from dpgen import NAME,SHORT_CMD -import setuptools, datetime - -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() - -today = datetime.date.today().strftime("%b-%d-%Y") -with open(path.join('dpgen', '_date.py'), 'w') as fp : - fp.write('date = \'%s\'' % today) - -install_requires=[ - 'numpy>=1.14.3', - 'dpdata>=0.2.6', - 'pymatgen>=2022.7.19', - 'ase', - 'monty>2.0.0', - 'paramiko', - 'custodian', - 'GromacsWrapper>=0.8.0', - 'dpdispatcher>=0.3.11', - 'netCDF4', - 'dargs>=0.2.9', - 'h5py', - 'pymatgen-analysis-defects', -] - -setuptools.setup( - name=NAME, - use_scm_version={'write_to': 'dpgen/_version.py'}, - setup_requires=['setuptools_scm'], - author="Han Wang", - author_email="wang_han@iapcm.ac.cn", - description="DPGen: The deep potential generator", - long_description=readme, - long_description_content_type="text/markdown", - url="https://github.com/deepmodeling/dpgen", - python_requires="~=3.6", - packages=['dpgen', - 'dpgen/generator', - 'dpgen/generator/lib', - 'dpgen/auto_test', - 'dpgen/auto_test/lib', - 'dpgen/data', - 'dpgen/data/tools', - 'dpgen/remote', - 'dpgen/dispatcher', - 'dpgen/database', - 'dpgen/tools', - 'dpgen/simplify', - 'dpgen/collect', - ], - # data_files = [('dpgen/tools/', ['dpgen/tools/update_time.sh', ])], - # package_data={'example':['*.json']}, - classifiers=[ - "Programming Language :: Python :: 3.6", - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", - ], - keywords='deep potential generator active learning deepmd-kit', - install_requires=install_requires, - entry_points={ - 'console_scripts': [ - SHORT_CMD+'= dpgen.main:main'] - } -) -