Skip to content

Commit 167945e

Browse files
authored
Migrate from setup.cfg to pyproject.toml (#48)
* Migrate project metadata from setup.py to pyproject.toml Define project metadata in pyproject.toml! Required dependencies are now listed under the [project] section instead of in requirements.txt. Versioneer config has also been moved from setup.cfg to [tool.versioneer]. * Fix check on sdist version number Package name is cupy_xarray, not cupy-xarray. * Include optional test dependencies in pyproject.toml Remove requirements_test.txt file, moving the test dependencies to pyproject.toml instead. Also updated MANIFEST.in to remove the requirements.txt entry. * Keep setup.py with versioneer.get_version() and .get_cmdclass() Still need these two lines so that the sdist won't have a 0.0.0 version. Xref https://github.com/python-versioneer/python-versioneer/blob/0.29/INSTALL.md#common-steps
1 parent 791c62d commit 167945e

File tree

7 files changed

+41
-35
lines changed

7 files changed

+41
-35
lines changed

.github/workflows/pypi-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
python -m twine check dist/*
4747
pwd
48-
if [ -f dist/cupy-xarray-0.0.0.tar.gz ]; then
48+
if [ -f dist/cupy_xarray-0.0.0.tar.gz ]; then
4949
echo "❌ INVALID VERSION NUMBER"
5050
exit 1
5151
else

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
include versioneer.py
22
include cupy_xarray/_version.py
3-
include requirements.txt
43
include LICENSE
54
include README.md
65
include pyproject.toml
76
prune cupy_xarray/tests*
87

9-
108
recursive-exclude * __pycache__
119
recursive-exclude * *.py[co]

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
[build-system]
2+
requires = ["setuptools", "versioneer[toml]"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "cupy-xarray"
7+
description = "Interface for using cupy in xarray, providing convenience accessors."
8+
authors = [{name = "cupy-xarray developers"}]
9+
license = {text = "Apache License"}
10+
readme = "README.md"
11+
requires-python = ">=3.8"
12+
classifiers = [
13+
"Programming Language :: Python :: 3",
14+
"Operating System :: OS Independent",
15+
]
16+
dynamic = ["version"]
17+
dependencies = [
18+
"cupy",
19+
"xarray>=2024.02.0",
20+
]
21+
22+
[project.optional-dependencies]
23+
test = [
24+
"dask",
25+
"pytest",
26+
]
27+
128
[tool.ruff]
229
line-length = 100 # E501 (line-too-long)
330
exclude = [
@@ -17,3 +44,11 @@ select = [
1744
"SIM", # flake8-simplify
1845
"W", # pycodestyle warnings
1946
]
47+
48+
[tool.versioneer]
49+
VCS = "git"
50+
style = "pep440"
51+
versionfile_source = "cupy_xarray/_version.py"
52+
versionfile_build = "cupy_xarray/_version.py"
53+
tag_prefix = ""
54+
parentdir_prefix = ""

requirements.txt

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

requirements_test.txt

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

setup.cfg

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

setup.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
import versioneer
44

5-
with open("README.md", encoding="utf-8") as fh:
6-
long_description = fh.read()
7-
with open("requirements.txt") as fh:
8-
requirements = [line.strip() for line in fh]
9-
10-
setuptools.setup(
11-
name="cupy-xarray",
12-
version=versioneer.get_version(),
13-
cmdclass=versioneer.get_cmdclass(),
14-
author="cupy-xarray developers",
15-
description="Interface for using cupy in xarray, providing convenience accessors.",
16-
long_description=long_description,
17-
long_description_content_type="text/markdown",
18-
packages=setuptools.find_packages(),
19-
classifiers=[
20-
"Programming Language :: Python :: 3",
21-
"Operating System :: OS Independent",
22-
],
23-
python_requires=">=3.7",
24-
install_requires=requirements,
25-
)
5+
if __name__ == "__main__":
6+
setuptools.setup(
7+
version=versioneer.get_version(),
8+
cmdclass=versioneer.get_cmdclass(),
9+
)

0 commit comments

Comments
 (0)