Skip to content

Commit e9110d7

Browse files
committed
MAINT: Full-speed setuptools
1 parent 935079b commit e9110d7

File tree

6 files changed

+89
-152
lines changed

6 files changed

+89
-152
lines changed

doc/source/conf.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import sys
2323
import os
24+
from configparser import ConfigParser
2425

2526
# Check for external Sphinx extensions we depend on
2627
try:
@@ -53,7 +54,11 @@
5354

5455
# Write long description from info
5556
with open('_long_description.inc', 'wt') as fobj:
56-
fobj.write(rel['LONG_DESCRIPTION'])
57+
fobj.write(rel['long_description'])
58+
59+
# Load metadata from setup.cfg
60+
config = ConfigParser()
61+
config.read(os.path.join('..', '..', 'setup.cfg'))
5762

5863
# Add any Sphinx extension module names here, as strings. They can be
5964
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -87,7 +92,7 @@
8792

8893
# General information about the project.
8994
project = u'NiBabel'
90-
copyright = u'2006-2019, %(MAINTAINER)s <%(AUTHOR_EMAIL)s>' % rel
95+
copyright = u'2006-2019, %(maintainer)s <%(author_email)s>' % config['metadata']
9196

9297
# The version info for the project you're documenting, acts as replacement for
9398
# |version| and |release|, also used in various other places throughout the

nibabel/info.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,6 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
8484
else _cmp(extra, pkg_extra))
8585

8686

87-
CLASSIFIERS = ["Development Status :: 4 - Beta",
88-
"Environment :: Console",
89-
"Intended Audience :: Science/Research",
90-
"License :: OSI Approved :: MIT License",
91-
"Operating System :: OS Independent",
92-
"Programming Language :: Python",
93-
"Topic :: Scientific/Engineering"]
94-
95-
description = 'Access a multitude of neuroimaging data formats'
96-
9787
# Note: this long_description is the canonical place to edit this text.
9888
# It also appears in README.rst, but it should get there by running
9989
# ``tools/refresh_readme.py`` which pulls in this version.
@@ -183,34 +173,3 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
183173
.. _zenodo: https://zenodo.org
184174
.. _Digital Object Identifier: https://en.wikipedia.org/wiki/Digital_object_identifier
185175
"""
186-
187-
# versions for dependencies. Check these against:
188-
# doc/source/installation.rst
189-
# requirements.txt
190-
# .travis.yml
191-
NUMPY_MIN_VERSION = '1.8'
192-
PYDICOM_MIN_VERSION = '0.9.9'
193-
SIX_MIN_VERSION = '1.3'
194-
195-
# Main setup parameters
196-
NAME = 'nibabel'
197-
MAINTAINER = "Chris Markiewicz"
198-
MAINTAINER_EMAIL = "[email protected]"
199-
DESCRIPTION = description
200-
LONG_DESCRIPTION = long_description
201-
URL = "http://nipy.org/nibabel"
202-
DOWNLOAD_URL = "https://github.com/nipy/nibabel"
203-
LICENSE = "MIT license"
204-
CLASSIFIERS = CLASSIFIERS
205-
AUTHOR = "nibabel developers"
206-
AUTHOR_EMAIL = "[email protected]"
207-
PLATFORMS = "OS Independent"
208-
MAJOR = _version_major
209-
MINOR = _version_minor
210-
MICRO = _version_micro
211-
ISRELEASE = _version_extra == ''
212-
VERSION = __version__
213-
PROVIDES = ["nibabel", 'nisext']
214-
REQUIRES = ["numpy>=%s" % NUMPY_MIN_VERSION,
215-
"six>=%s" % SIX_MIN_VERSION,
216-
'bz2file; python_version < "3.0"']

setup.cfg

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[metadata]
2+
name = nibabel
3+
version = attr: nibabel.__version__
4+
url = https://nipy.org/nibabel
5+
download_url = https://github.com/nipy/nibabel
6+
author = nibabel developers
7+
author_email = [email protected]
8+
maintainer = Chris Markiewicz
9+
maintainer_email = [email protected]
10+
classifiers =
11+
Development Status :: 4 - Beta
12+
Environment :: Console
13+
Intended Audience :: Science/Research
14+
License :: OSI Approved :: MIT License
15+
Operating System :: OS Independent
16+
Programming Language :: Python
17+
Programming Language :: Python :: 2.7
18+
Programming Language :: Python :: 3.4
19+
Programming Language :: Python :: 3.5
20+
Programming Language :: Python :: 3.6
21+
Programming Language :: Python :: 3.7
22+
Topic :: Scientific/Engineering
23+
license = MIT License
24+
description = Access a multitude of neuroimaging data formats
25+
long_description = file:README.rst
26+
long_description_content_type = text/x-rst; charset=UTF-8
27+
platforms = OS Independent
28+
provides =
29+
nibabel
30+
nisext
31+
32+
[options]
33+
python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
34+
install_requires =
35+
numpy >=1.8
36+
six >=1.3
37+
bz2file ; python_version < "3.0"
38+
tests_require = nose
39+
test_suite = nose.collector
40+
zip_safe = False
41+
packages = find:
42+
include_package_data = True
43+
44+
[options.extras_require]
45+
dicom =
46+
dicom >=0.9.9
47+
doc =
48+
sphinx >=0.3
49+
test =
50+
nose >=0.10.1
51+
all =
52+
%(dicom)s
53+
%(doc)s
54+
%(test)s
55+
56+
[options.entry_points]
57+
console_scripts =
58+
nib-ls=nibabel.cmdline.ls:main
59+
nib-dicomfs=nibabel.cmdline.dicomfs:main
60+
nib-diff=nibabel.cmdline.diff:main
61+
nib-nifti-dx=nibabel.cmdline.nifti_dx:main
62+
nib-tck2trk=nibabel.cmdline.tck2trk:main
63+
nib-trk2tck=nibabel.cmdline.trk2tck:main
64+
parrec2nii=nibabel.cmdline.parrec2nii:main
65+
66+
[options.package_data]
67+
nibabel =
68+
*/tests/data/*
69+
70+
[flake8]
71+
max-line-length = 100
72+
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
73+
exclude =
74+
*test*
75+
*sphinx*
76+
nibabel/externals/*
77+
*/__init__.py
78+

setup.py

Lines changed: 3 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"""Build helper."""
1111

1212
import os
13-
from os.path import join as pjoin
14-
import sys
15-
from functools import partial
1613

1714
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
1815
# update it when the contents of directories change.
@@ -21,105 +18,8 @@
2118

2219
from setuptools import setup
2320

24-
# Commit hash writing, and dependency checking
25-
from nisext.sexts import (get_comrec_build, package_check, install_scripts_bat,
26-
read_vars_from)
27-
cmdclass = {'build_py': get_comrec_build('nibabel'),
28-
'install_scripts': install_scripts_bat}
29-
30-
# Get project related strings.
31-
INFO = read_vars_from(pjoin('nibabel', 'info.py'))
32-
33-
# Prepare setuptools args
34-
if 'setuptools' in sys.modules:
35-
extra_setuptools_args = dict(
36-
tests_require=['nose'],
37-
test_suite='nose.collector',
38-
zip_safe=False,
39-
extras_require=dict(
40-
doc='Sphinx>=0.3',
41-
test='nose>=0.10.1'),
42-
)
43-
pkg_chk = partial(package_check, setuptools_args = extra_setuptools_args)
44-
else:
45-
extra_setuptools_args = {}
46-
pkg_chk = package_check
47-
48-
# Do dependency checking
49-
pkg_chk('numpy', INFO.NUMPY_MIN_VERSION)
50-
pkg_chk('six', INFO.SIX_MIN_VERSION)
51-
custom_pydicom_messages = {'missing opt': 'Missing optional package "%s"'
52-
' provided by package "pydicom"'
53-
}
54-
pkg_chk('dicom',
55-
INFO.PYDICOM_MIN_VERSION,
56-
optional='dicom',
57-
messages = custom_pydicom_messages)
58-
59-
def main(**extra_args):
60-
setup(name='nibabel',
61-
maintainer=INFO.MAINTAINER,
62-
maintainer_email=INFO.MAINTAINER_EMAIL,
63-
description=INFO.DESCRIPTION,
64-
long_description=INFO.LONG_DESCRIPTION,
65-
url=INFO.URL,
66-
download_url=INFO.DOWNLOAD_URL,
67-
license=INFO.LICENSE,
68-
classifiers=INFO.CLASSIFIERS,
69-
author=INFO.AUTHOR,
70-
author_email=INFO.AUTHOR_EMAIL,
71-
platforms=INFO.PLATFORMS,
72-
version=INFO.VERSION,
73-
provides=INFO.PROVIDES,
74-
install_requires=INFO.REQUIRES,
75-
packages = ['nibabel',
76-
'nibabel.externals',
77-
'nibabel.externals.tests',
78-
'nibabel.gifti',
79-
'nibabel.gifti.tests',
80-
'nibabel.cifti2',
81-
'nibabel.cifti2.tests',
82-
'nibabel.cmdline',
83-
'nibabel.cmdline.tests',
84-
'nibabel.nicom',
85-
'nibabel.freesurfer',
86-
'nibabel.freesurfer.tests',
87-
'nibabel.nicom.tests',
88-
'nibabel.testing',
89-
'nibabel.tests',
90-
'nibabel.benchmarks',
91-
'nibabel.streamlines',
92-
'nibabel.streamlines.tests',
93-
# install nisext as its own package
94-
'nisext',
95-
'nisext.tests'],
96-
# The package_data spec has no effect for me (on python 2.6) -- even
97-
# changing to data_files doesn't get this stuff included in the source
98-
# distribution -- not sure if it has something to do with the magic
99-
# above, but distutils is surely the worst piece of code in all of
100-
# python -- duplicating things into MANIFEST.in but this is admittedly
101-
# only a workaround to get things started -- not a solution
102-
package_data = {'nibabel':
103-
[pjoin('tests', 'data', '*'),
104-
pjoin('externals', 'tests', 'data', '*'),
105-
pjoin('nicom', 'tests', 'data', '*'),
106-
pjoin('gifti', 'tests', 'data', '*'),
107-
pjoin('streamlines', 'tests', 'data', '*'),
108-
]},
109-
scripts = [pjoin('bin', 'parrec2nii'),
110-
pjoin('bin', 'nib-ls'),
111-
pjoin('bin', 'nib-dicomfs'),
112-
pjoin('bin', 'nib-nifti-dx'),
113-
pjoin('bin', 'nib-tck2trk'),
114-
pjoin('bin', 'nib-trk2tck'),
115-
pjoin('bin', 'nib-diff'),
116-
],
117-
cmdclass = cmdclass,
118-
**extra_args
119-
)
120-
21+
# Commit hash writing
22+
from nisext.sexts import get_comrec_build
12123

12224
if __name__ == "__main__":
123-
# Do not use nisext's dynamically updated install_requires
124-
extra_setuptools_args.pop('install_requires', None)
125-
main(**extra_setuptools_args)
25+
setup(cmdclass={'build_py': get_comrec_build('nibabel')})

tools/refresh_readme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
rel = runpy.run_path(os.path.join('nibabel', 'info.py'))
2121

22-
readme = ''.join(readme_lines) + '\n' + rel['LONG_DESCRIPTION']
22+
readme = ''.join(readme_lines) + '\n' + rel['long_description']
2323

2424
with open('README.rst', 'wt') as fobj:
2525
fobj.write(readme)

tox.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,3 @@ deps =
1818
deps =
1919
[testenv:np-1.2.1]
2020
deps =
21-
[flake8]
22-
max-line-length=100
23-
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
24-
exclude=*test*,*sphinx*,nibabel/externals/*,*/__init__.py
25-

0 commit comments

Comments
 (0)