Skip to content

MNT: Re-add pyproject.toml #1133

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

Merged
merged 3 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion min-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auto-generated by tools/update_requirements.py
numpy ==1.17
packaging ==17.0
packaging ==17
setuptools
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "nibabel"
description = "Access a multitude of neuroimaging data formats"
authors = [
{ name = "nibabel developers", email = "[email protected]" },
]
maintainers = [
{ name = "Christopher Markiewicz" },
]
readme = "README.rst"
license = { text="MIT License" }
requires-python = ">=3.7"
dependencies = ["numpy >=1.17", "packaging >=17", "setuptools"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
]
# Version from versioneer
# optional-dependencies from setup.cfg (using ConfigParser features)
dynamic = ["version", "optional-dependencies"]

[project.urls]
"Homepage" = "https://nipy.org/nibabel"
"Development" = "https://github.com/nipy/nibabel"

[project.scripts]
nib-conform = "nibabel.cmdline.conform:main"
nib-convert = "nibabel.cmdline.convert:main"
nib-ls = "nibabel.cmdline.ls:main"
nib-dicomfs = "nibabel.cmdline.dicomfs:main"
nib-diff = "nibabel.cmdline.diff:main"
nib-stats = "nibabel.cmdline.stats:main"
nib-nifti-dx = "nibabel.cmdline.nifti_dx:main"
nib-tck2trk = "nibabel.cmdline.tck2trk:main"
nib-trk2tck = "nibabel.cmdline.trk2tck:main"
nib-roi = "nibabel.cmdline.roi:main"
parrec2nii = "nibabel.cmdline.parrec2nii:main"

[tool.setuptools]
platforms = ["OS Independent"]
provides = ["nibabel", "nisext"]
zip-safe = false

[tool.setuptools.packages]
find = {}

[tool.setuptools.package-data]
nibabel = ["tests/data/*", "*/tests/data/*", "benchmarks/pytest.benchmark.ini"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auto-generated by tools/update_requirements.py
numpy >=1.17
packaging >=17.0
packaging >=17
setuptools
58 changes: 0 additions & 58 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
[metadata]
name = nibabel
url = https://nipy.org/nibabel
download_url = https://github.com/nipy/nibabel
author = nibabel developers
author_email = [email protected]
maintainer = Chris Markiewicz
maintainer_email = [email protected]
classifiers =
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering
license = MIT License
description = Access a multitude of neuroimaging data formats
long_description = file:README.rst
long_description_content_type = text/x-rst; charset=UTF-8
platforms = OS Independent
provides =
nibabel
nisext

[options]
python_requires = >=3.7
install_requires =
numpy >=1.17
packaging >=17.0
setuptools
zip_safe = False
packages = find:

[options.extras_require]
dicom =
pydicom >=1.0.0
Expand Down Expand Up @@ -74,26 +36,6 @@ all =
%(test)s
%(zstd)s

[options.entry_points]
console_scripts =
nib-conform=nibabel.cmdline.conform:main
nib-convert=nibabel.cmdline.convert:main
nib-ls=nibabel.cmdline.ls:main
nib-dicomfs=nibabel.cmdline.dicomfs:main
nib-diff=nibabel.cmdline.diff:main
nib-stats=nibabel.cmdline.stats:main
nib-nifti-dx=nibabel.cmdline.nifti_dx:main
nib-tck2trk=nibabel.cmdline.tck2trk:main
nib-trk2tck=nibabel.cmdline.trk2tck:main
nib-roi=nibabel.cmdline.roi:main
parrec2nii=nibabel.cmdline.parrec2nii:main

[options.package_data]
nibabel =
tests/data/*
*/tests/data/*
benchmarks/pytest.benchmark.ini

[flake8]
max-line-length = 100
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
Expand Down
33 changes: 19 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Build helper."""
"""
Setuptools entrypoint

import sys
This file is a basic stub needed to integrate with versioneer, which allows the
version to be retrieved from git and set statically in a built package.

This file should not be run directly. To install, use:

pip install .

To build a package for distribution, use:

pip install --upgrade build
python -m build

"""

from setuptools import setup
import versioneer

# Give setuptools a hint to complain if it's too old a version
# 30.3.0 allows us to put most metadata in setup.cfg
# Should match pyproject.toml
SETUP_REQUIRES = ['setuptools >= 30.3.0']
# This enables setuptools to install wheel on-the-fly
SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else []

if __name__ == "__main__":
setup(name='nibabel',
setup_requires=SETUP_REQUIRES,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass())
setup(
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
)
10 changes: 5 additions & 5 deletions tools/update_requirements.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/env python3
import sys
from configparser import ConfigParser
import tomli
from pathlib import Path

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

repo_root = Path(__file__).parent.parent
setup_cfg = repo_root / "setup.cfg"
pyproject_toml = repo_root / "pyproject.toml"
reqs = repo_root / "requirements.txt"
min_reqs = repo_root / "min-requirements.txt"

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

script_name = Path(__file__).relative_to(repo_root)

Expand Down