Passed
Push — master ( 50cd65...da99ac )
by Fernando
03:18
created

setup.is_slicer_python()   A

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
#!/usr/bin/env python
2
3
"""The setup script."""
4
5
import os
6
from setuptools import setup, find_packages
7
8
with open('README.md', encoding='utf8') as readme_file:
9
    readme = readme_file.read()
10
11
with open('HISTORY.rst', encoding='utf8') as history_file:
12
    history = history_file.read()
13
14
requirements = [
15
    'Click',
16
    'humanize',
17
    'nibabel',
18
    'numpy',
19
    'Python-Deprecated',
20
    'scipy',
21
    'torch>=1.1',
22
    'torchvision',
23
    'tqdm',
24
]
25
26
27
def is_slicer_python():
28
    """
29
    Returns True if the code is believed to be executed from within Slicer's
30
    internal Python.
31
    """
32
    python_home = os.environ.get('PYTHONHOME')
33
    return python_home is not None and 'Slicer' in python_home
34
35
36
# New versions of Slicer need SimpleITK 2, but SimpleITK as preferred normally
37
# because of https://github.com/SimpleITK/SimpleITK/issues/1239
38
if is_slicer_python():
39
    requirements.append('SimpleITK')
40
else:
41
    requirements.append('SimpleITK<2')
42
43
44
setup(
45
    author='Fernando Perez-Garcia',
46
    author_email='[email protected]',
47
    python_requires='>=3.6',
48
    classifiers=[
49
        'Development Status :: 2 - Pre-Alpha',
50
        'Intended Audience :: Science/Research',
51
        'License :: OSI Approved :: MIT License',
52
        'Natural Language :: English',
53
        'Operating System :: OS Independent',
54
        'Programming Language :: Python :: 3.6',
55
        'Programming Language :: Python :: 3.7',
56
        'Programming Language :: Python :: 3.8',
57
    ],
58
    description=(
59
        'Tools for loading, augmenting and writing 3D medical images'
60
        ' on PyTorch.'
61
    ),
62
    entry_points={
63
        'console_scripts': [
64
            'torchio-transform=torchio.cli:apply_transform',
65
        ],
66
    },
67
    extras_require={
68
        'plot': ['matplotlib', 'seaborn'],
69
    },
70
    install_requires=requirements,
71
    license='MIT license',
72
    long_description=readme + '\n\n' + history,
73
    long_description_content_type='text/markdown',
74
    include_package_data=True,
75
    keywords='torchio',
76
    name='torchio',
77
    packages=find_packages(include=['torchio', 'torchio.*']),
78
    setup_requires=[],
79
    test_suite='tests',
80
    tests_require=[],
81
    url='https://github.com/fepegar/torchio',
82
    version='0.17.57',
83
    zip_safe=False,
84
)
85