Skip to content

Commit a0bbc97

Browse files
authored
Merge pull request #1133 from effigies/mnt/pyproject
MNT: Re-add pyproject.toml
2 parents 16bdd14 + 7ee6327 commit a0bbc97

File tree

6 files changed

+87
-79
lines changed

6 files changed

+87
-79
lines changed

min-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy ==1.17
3-
packaging ==17.0
3+
packaging ==17
44
setuptools

pyproject.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta:__legacy__"
4+
5+
[project]
6+
name = "nibabel"
7+
description = "Access a multitude of neuroimaging data formats"
8+
authors = [
9+
{ name = "nibabel developers", email = "neuroimaging@python.org" },
10+
]
11+
maintainers = [
12+
{ name = "Christopher Markiewicz" },
13+
]
14+
readme = "README.rst"
15+
license = { text="MIT License" }
16+
requires-python = ">=3.7"
17+
dependencies = ["numpy >=1.17", "packaging >=17", "setuptools"]
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Environment :: Console",
21+
"Intended Audience :: Science/Research",
22+
"License :: OSI Approved :: MIT License",
23+
"Operating System :: OS Independent",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Topic :: Scientific/Engineering",
30+
]
31+
# Version from versioneer
32+
# optional-dependencies from setup.cfg (using ConfigParser features)
33+
dynamic = ["version", "optional-dependencies"]
34+
35+
[project.urls]
36+
"Homepage" = "https://nipy.org/nibabel"
37+
"Development" = "https://github.com/nipy/nibabel"
38+
39+
[project.scripts]
40+
nib-conform = "nibabel.cmdline.conform:main"
41+
nib-convert = "nibabel.cmdline.convert:main"
42+
nib-ls = "nibabel.cmdline.ls:main"
43+
nib-dicomfs = "nibabel.cmdline.dicomfs:main"
44+
nib-diff = "nibabel.cmdline.diff:main"
45+
nib-stats = "nibabel.cmdline.stats:main"
46+
nib-nifti-dx = "nibabel.cmdline.nifti_dx:main"
47+
nib-tck2trk = "nibabel.cmdline.tck2trk:main"
48+
nib-trk2tck = "nibabel.cmdline.trk2tck:main"
49+
nib-roi = "nibabel.cmdline.roi:main"
50+
parrec2nii = "nibabel.cmdline.parrec2nii:main"
51+
52+
[tool.setuptools]
53+
platforms = ["OS Independent"]
54+
provides = ["nibabel", "nisext"]
55+
zip-safe = false
56+
57+
[tool.setuptools.packages]
58+
find = {}
59+
60+
[tool.setuptools.package-data]
61+
nibabel = ["tests/data/*", "*/tests/data/*", "benchmarks/pytest.benchmark.ini"]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Auto-generated by tools/update_requirements.py
22
numpy >=1.17
3-
packaging >=17.0
3+
packaging >=17
44
setuptools

setup.cfg

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,3 @@
1-
[metadata]
2-
name = nibabel
3-
url = https://nipy.org/nibabel
4-
download_url = https://github.com/nipy/nibabel
5-
author = nibabel developers
6-
author_email = neuroimaging@python.org
7-
maintainer = Chris Markiewicz
8-
maintainer_email = neuroimaging@python.org
9-
classifiers =
10-
Development Status :: 4 - Beta
11-
Environment :: Console
12-
Intended Audience :: Science/Research
13-
License :: OSI Approved :: MIT License
14-
Operating System :: OS Independent
15-
Programming Language :: Python
16-
Programming Language :: Python :: 3.7
17-
Programming Language :: Python :: 3.8
18-
Programming Language :: Python :: 3.9
19-
Programming Language :: Python :: 3.10
20-
Topic :: Scientific/Engineering
21-
license = MIT License
22-
description = Access a multitude of neuroimaging data formats
23-
long_description = file:README.rst
24-
long_description_content_type = text/x-rst; charset=UTF-8
25-
platforms = OS Independent
26-
provides =
27-
nibabel
28-
nisext
29-
30-
[options]
31-
python_requires = >=3.7
32-
install_requires =
33-
numpy >=1.17
34-
packaging >=17.0
35-
setuptools
36-
zip_safe = False
37-
packages = find:
38-
391
[options.extras_require]
402
dicom =
413
pydicom >=1.0.0
@@ -74,26 +36,6 @@ all =
7436
%(test)s
7537
%(zstd)s
7638

77-
[options.entry_points]
78-
console_scripts =
79-
nib-conform=nibabel.cmdline.conform:main
80-
nib-convert=nibabel.cmdline.convert:main
81-
nib-ls=nibabel.cmdline.ls:main
82-
nib-dicomfs=nibabel.cmdline.dicomfs:main
83-
nib-diff=nibabel.cmdline.diff:main
84-
nib-stats=nibabel.cmdline.stats:main
85-
nib-nifti-dx=nibabel.cmdline.nifti_dx:main
86-
nib-tck2trk=nibabel.cmdline.tck2trk:main
87-
nib-trk2tck=nibabel.cmdline.trk2tck:main
88-
nib-roi=nibabel.cmdline.roi:main
89-
parrec2nii=nibabel.cmdline.parrec2nii:main
90-
91-
[options.package_data]
92-
nibabel =
93-
tests/data/*
94-
*/tests/data/*
95-
benchmarks/pytest.benchmark.ini
96-
9739
[flake8]
9840
max-line-length = 100
9941
ignore = D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E24,E121,E123,E126,E226,E266,E402,E704,E731,F821,I100,I101,I201,N802,N803,N804,N806,W503,W504,W605

setup.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,27 @@
77
# copyright and license terms.
88
#
99
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
10-
"""Build helper."""
10+
"""
11+
Setuptools entrypoint
1112
12-
import sys
13+
This file is a basic stub needed to integrate with versioneer, which allows the
14+
version to be retrieved from git and set statically in a built package.
15+
16+
This file should not be run directly. To install, use:
17+
18+
pip install .
19+
20+
To build a package for distribution, use:
21+
22+
pip install --upgrade build
23+
python -m build
24+
25+
"""
1326

1427
from setuptools import setup
1528
import versioneer
1629

17-
# Give setuptools a hint to complain if it's too old a version
18-
# 30.3.0 allows us to put most metadata in setup.cfg
19-
# Should match pyproject.toml
20-
SETUP_REQUIRES = ['setuptools >= 30.3.0']
21-
# This enables setuptools to install wheel on-the-fly
22-
SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else []
23-
24-
if __name__ == "__main__":
25-
setup(name='nibabel',
26-
setup_requires=SETUP_REQUIRES,
27-
version=versioneer.get_version(),
28-
cmdclass=versioneer.get_cmdclass())
30+
setup(
31+
version=versioneer.get_version(),
32+
cmdclass=versioneer.get_cmdclass(),
33+
)

tools/update_requirements.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env python3
22
import sys
3-
from configparser import ConfigParser
3+
import tomli
44
from pathlib import Path
55

66
if sys.version_info < (3, 6):
77
print("This script requires Python 3.6 to work correctly")
88
sys.exit(1)
99

1010
repo_root = Path(__file__).parent.parent
11-
setup_cfg = repo_root / "setup.cfg"
11+
pyproject_toml = repo_root / "pyproject.toml"
1212
reqs = repo_root / "requirements.txt"
1313
min_reqs = repo_root / "min-requirements.txt"
1414

15-
config = ConfigParser()
16-
config.read(setup_cfg)
17-
requirements = config.get("options", "install_requires").strip().splitlines()
15+
with open(pyproject_toml, 'rb') as fobj:
16+
config = tomli.load(fobj)
17+
requirements = config["project"]["dependencies"]
1818

1919
script_name = Path(__file__).relative_to(repo_root)
2020

0 commit comments

Comments
 (0)