-
Notifications
You must be signed in to change notification settings - Fork 224
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
Changes from 7 commits
0c67c61
7cff590
cc9d8e0
033d369
f6bf6f6
796acf9
f6a0514
1155adc
f1015f5
6aa4888
cfc20a7
f85015e
f257a36
7553f0b
8fbf603
9d9ce07
2764315
5f54cc5
6ba0fe0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,45 @@ | ||
[build-system] | ||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] | ||
requires = ["setuptools>=61", "setuptools_scm[toml]>=6.2"] | ||
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]"}] | ||
maintainers = [{name = "The PyGMT Developers", email = "[email protected]"}] | ||
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"] | ||
include-package-data = true | ||
|
||
[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
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,10 @@ | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setup.py is no longer required since setuptools 64.0.0 (https://setuptools.pypa.io/en/latest/userguide/development_mode.html) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, it seems like setuptools v64.0.0 enabled non setup.py editable installs! On the developer side, this seems ok to remove setup.py, but are there any potential side effects for users not having such a new setuptools version? Or to put it another way, do we want to remove setup.py for PyGMT v0.8.0, or wait another minor version (e.g. v0.9.0)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I have setuptools 62.6.0 installed. Checking out this branch and running When running
It seems build dependencies like setuptools>=64 are automatically installed in isolated environments and do not affect users' installations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A downside here is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried disconnecting and used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's unrelated to this PR. Offline
This command gives the correct version for pygmt <= 0.6.0 but results in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @maxrjones Perhaps open an issue report for the offline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've opened a PR in #2097. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for opening the issue @seisman. Apologies for not responding to your question. I had originally interpreted your comment as opening an issue in the PyPA repo and wanted to do more debugging before taking that step. |
||
Build and install the project. | ||
A simple setup.py script to support editable installs. | ||
""" | ||
from setuptools import find_packages, setup | ||
# References: | ||
# - https://github.com/pypa/setuptools/issues/2816 | ||
# - https://setuptools.pypa.io/en/latest/userguide/quickstart.html#development-mode | ||
|
||
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()) | ||
from setuptools import setup | ||
|
||
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
|
There was a problem hiding this comment.
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 thepyproject.toml
support is stable.There was a problem hiding this comment.
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.