diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 2221abe0894..0d7a4ff5487 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -43,7 +43,7 @@ jobs: # Change setuptools-scm local_scheme to "no-local-version" so the # local part of the version isn't included, making the version string # compatible with PyPI. - sed --in-place "s/node-and-date/no-local-version/g" setup.py + sed --in-place "s/node-and-date/no-local-version/g" pyproject.toml - name: Build source and wheel distributions run: | diff --git a/pyproject.toml b/pyproject.toml index 68d2fb48c9f..d470afe6d9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +local_scheme = "node-and-date" +fallback_version = "unknown" + [tool.coverage.run] omit = ["*/tests/*", "*pygmt/__init__.py"] diff --git a/setup.py b/setup.py index 7557aaf1e7d..a7815ccd7da 100644 --- a/setup.py +++ b/setup.py @@ -35,9 +35,6 @@ PLATFORMS = "Any" PYTHON_REQUIRES = ">=3.8" INSTALL_REQUIRES = ["numpy>=1.19", "pandas", "xarray", "netCDF4", "packaging"] -# Configuration for setuptools-scm -SETUP_REQUIRES = ["setuptools_scm"] -USE_SCM_VERSION = {"local_scheme": "node-and-date", "fallback_version": "unknown"} if __name__ == "__main__": setup( @@ -45,7 +42,6 @@ fullname=FULLNAME, description=DESCRIPTION, long_description=LONG_DESCRIPTION, - use_scm_version=USE_SCM_VERSION, author=AUTHOR, author_email=AUTHOR_EMAIL, maintainer=MAINTAINER, @@ -60,5 +56,4 @@ keywords=KEYWORDS, python_requires=PYTHON_REQUIRES, install_requires=INSTALL_REQUIRES, - setup_requires=SETUP_REQUIRES, )