Skip to content

Commit 06fca61

Browse files
seismanweiji14
andauthored
Migrate project metadata from setup.py to pyproject.toml following PEP621 (#1848)
Delete setup.py and move all project metadata to pyproject.toml as per https://peps.python.org/pep-0621. * Migrate project metadata from setup.py to pyproject.toml following PEP621 * Add docstrings to setup.py * Use the new email address for pygmt team * Update the link for development mode * Set include-package-data to include baseline and data files * Remove setup.py completely. Requires setuptools>=64.0.0 * Fix the minimum required numpy version to 1.20 * Add package data * Update the command to check README syntax * Run tests in editable mode * Multi-line dependencies Co-authored-by: Wei Ji <[email protected]>
1 parent f263b13 commit 06fca61

File tree

6 files changed

+56
-72
lines changed

6 files changed

+56
-72
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ jobs:
126126
127127
# Install the package that we want to test
128128
- name: Install the package
129-
run: |
130-
python -m build --sdist
131-
pip install dist/*
129+
run: make install
132130

133131
# Run the regular tests
134132
- name: Run tests

.github/workflows/ci_tests_dev.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ jobs:
150150
151151
# Install the package that we want to test
152152
- name: Install the package
153-
run: |
154-
python -m build --sdist
155-
pip install dist/*
153+
run: make install
156154

157155
- name: Add GMT's bin to PATH (Linux/macOS)
158156
run: echo ${GITHUB_WORKSPACE}/gmt-install-dir/bin >> $GITHUB_PATH

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ TESTDIR=tmp-test-dir-with-unique-name
44
PYTEST_COV_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \
55
--cov-report=term-missing --cov-report=xml --cov-report=html \
66
--pyargs ${PYTEST_EXTRA}
7-
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
7+
BLACK_FILES=$(PROJECT) doc/conf.py examples
88
BLACKDOC_OPTIONS=--line-length 79
9-
DOCFORMATTER_FILES=$(PROJECT) setup.py doc/conf.py examples
9+
DOCFORMATTER_FILES=$(PROJECT) doc/conf.py examples
1010
DOCFORMATTER_OPTIONS=--recursive --pre-summary-newline --make-summary-multi-line --wrap-summaries 79 --wrap-descriptions 79
11-
FLAKEHEAVEN_FILES=$(PROJECT) setup.py doc/conf.py examples
12-
LINT_FILES=$(PROJECT) setup.py doc/conf.py
11+
FLAKEHEAVEN_FILES=$(PROJECT) doc/conf.py examples
12+
LINT_FILES=$(PROJECT) doc/conf.py
1313

1414
help:
1515
@echo "Commands:"

doc/maintenance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ alongside the rest of the Scientific Python ecosystem, and therefore supports:
167167
* All minor versions of NumPy released in the 24 months prior to the project,
168168
and at minimum the last three minor versions.
169169

170-
In `setup.py`, the `python_requires` variable should be set to the minimum
170+
In `pyproject.toml`, the `requires-python` key should be set to the minimum
171171
supported version of Python. Minimum Python and NumPy version support should be
172172
adjusted upward on every major and minor release, but never on a patch release.
173173

@@ -277,7 +277,7 @@ So slightly broken RST can cause the PyPI page to not render the correct content
277277
using the `rst2html.py` script that comes with docutils:
278278
279279
```
280-
python setup.py --long-description | rst2html.py --no-raw > index.html
280+
rst2html.py --no-raw README.rst > index.html
281281
```
282282
283283
Open `index.html` and check for any flaws or error messages.

pyproject.toml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,54 @@
11
[build-system]
2-
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
2+
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "pygmt"
7+
description = "A Python interface for the Generic Mapping Tools"
8+
readme = "README.rst"
9+
requires-python = ">=3.8"
10+
license = {text = "BSD License"}
11+
authors = [{name = "The PyGMT Developers", email = "[email protected]"}]
12+
maintainers = [{name = "The PyGMT Developers", email = "[email protected]"}]
13+
keywords = []
14+
classifiers = [
15+
"Development Status :: 4 - Beta",
16+
"Intended Audience :: Science/Research",
17+
"Intended Audience :: Developers",
18+
"Intended Audience :: Education",
19+
"Topic :: Scientific/Engineering",
20+
"Topic :: Software Development :: Libraries",
21+
"Programming Language :: Python :: 3.8",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
"License :: OSI Approved :: BSD License",
25+
]
26+
dependencies = [
27+
"numpy>=1.20",
28+
"pandas",
29+
"xarray",
30+
"netCDF4",
31+
"packaging"
32+
]
33+
dynamic = ["version"]
34+
35+
[project.urls]
36+
homepage = "https://www.pygmt.org"
37+
documentation = "https://www.pygmt.org"
38+
repository = "https://github.com/GenericMappingTools/pygmt"
39+
changelog = "https://www.pygmt.org/latest/changes.html"
40+
41+
[tool.setuptools]
42+
platforms = ["Any"]
43+
include-package-data = true
44+
45+
[tool.setuptools.packages.find]
46+
include = ["pygmt*"]
47+
exclude = ["doc"]
48+
49+
[tool.setuptools.package-data]
50+
tests = ["data/*", "baseline/*"]
51+
552
[tool.setuptools_scm]
653
local_scheme = "node-and-date"
754
fallback_version = "999.999.999+unknown"

setup.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)