Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate project metadata from setup.py to pyproject.toml following PEP621 #1848

Merged
merged 19 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
39 changes: 38 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
requires = ["setuptools>=61", "setuptools_scm[toml]>=6.2"]
Copy link
Member Author

@seisman seisman Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that changes in this PR require setuptools>=61.

setuptools v61.0.0 was released on Mar. 24, 2022. This version starts to support storing project metadata in pyproject.toml following PEP621 but it's still experimental and may change in future versions. I think we should not merge this PR unless the pyproject.toml support is stable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's wait and see first. I've had to pin to setuptools=58.4.0 on one of my projects 3 weeks ago because one of the dependencies didn't like setuptools v60.9. There might be some other packages pinning to a lower setuptools version too.

build-backend = "setuptools.build_meta"

[project]
name = "pygmt"
description = "A Python interface for the Generic Mapping Tools"
readme = "README.rst"
requires-python = ">=3.8"
license = {text = "BSD License"}
authors = [{name = "The PyGMT Developers", email = "[email protected]"}]
seisman marked this conversation as resolved.
Show resolved Hide resolved
maintainers = [{name = "The PyGMT Developers", email = "[email protected]"}]
seisman marked this conversation as resolved.
Show resolved Hide resolved
seisman marked this conversation as resolved.
Show resolved Hide resolved
keywords = []
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: BSD License",
]
dependencies = ["numpy>=1.19", "pandas", "xarray", "netCDF4", "packaging"]
dynamic = ["version"]

[project.urls]
homepage = "https://www.pygmt.org"
documentation = "https://www.pygmt.org"
repository = "https://github.com/GenericMappingTools/pygmt"
changelog = "https://www.pygmt.org/latest/changes.html"

[tool.setuptools]
platforms = ["Any"]

[tool.setuptools.packages.find]
include = ["pygmt*"]
exclude = ["doc"]

[tool.setuptools_scm]
local_scheme = "node-and-date"
fallback_version = "unknown"
seisman marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
60 changes: 2 additions & 58 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,3 @@
"""
Build and install the project.
"""
weiji14 marked this conversation as resolved.
Show resolved Hide resolved
from setuptools import find_packages, setup
from setuptools import setup

NAME = "pygmt"
FULLNAME = "PyGMT"
AUTHOR = "The PyGMT Developers"
AUTHOR_EMAIL = "[email protected]"
MAINTAINER = AUTHOR
MAINTAINER_EMAIL = AUTHOR_EMAIL
LICENSE = "BSD License"
URL = "https://github.com/GenericMappingTools/pygmt"
DESCRIPTION = "A Python interface for the Generic Mapping Tools"
KEYWORDS = ""
with open("README.rst", "r", encoding="utf8") as f:
LONG_DESCRIPTION = "".join(f.readlines())

PACKAGES = find_packages(exclude=["doc"])
SCRIPTS = []
PACKAGE_DATA = {"pygmt.tests": ["data/*", "baseline/*"]}
weiji14 marked this conversation as resolved.
Show resolved Hide resolved

CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
f"License :: OSI Approved :: {LICENSE}",
]
PLATFORMS = "Any"
PYTHON_REQUIRES = ">=3.8"
INSTALL_REQUIRES = ["numpy>=1.19", "pandas", "xarray", "netCDF4", "packaging"]

if __name__ == "__main__":
setup(
name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
license=LICENSE,
url=URL,
platforms=PLATFORMS,
scripts=SCRIPTS,
packages=PACKAGES,
package_data=PACKAGE_DATA,
classifiers=CLASSIFIERS,
keywords=KEYWORDS,
python_requires=PYTHON_REQUIRES,
install_requires=INSTALL_REQUIRES,
)
setup()
seisman marked this conversation as resolved.
Show resolved Hide resolved