setup.py 1.53 KB
Newer Older
soumith's avatar
soumith committed
1
import os
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
2
3
import io
import re
soumith's avatar
soumith committed
4
5
import sys
from setuptools import setup, find_packages
6
from pkg_resources import get_distribution, DistributionNotFound
soumith's avatar
soumith committed
7
8


Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
9
10
11
12
13
14
15
def read(*names, **kwargs):
    with io.open(
        os.path.join(os.path.dirname(__file__), *names),
        encoding=kwargs.get("encoding", "utf8")
    ) as fp:
        return fp.read()

Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
16

17
18
19
20
21
22
23
def get_dist(pkgname):
    try:
        return get_distribution(pkgname)
    except DistributionNotFound:
        return None


Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
24
25
26
27
28
29
30
31
def find_version(*file_paths):
    version_file = read(*file_paths)
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")

Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
32

Thomas Grainger's avatar
Thomas Grainger committed
33
34
readme = open('README.rst').read()

Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
35
VERSION = find_version('torchvision', '__init__.py')
soumith's avatar
soumith committed
36

37
38
39
40
41
42
requirements = [
    'numpy',
    'six',
    'torch',
]

43
44
45
46
pillow_ver = ' >= 4.1.1'
pillow_req = 'pillow-simd' if get_dist('pillow-simd') is not None else 'pillow'
requirements.append(pillow_req + pillow_ver)

Thomas Grainger's avatar
Thomas Grainger committed
47
setup(
soumith's avatar
soumith committed
48
49
50
51
52
53
54
    # Metadata
    name='torchvision',
    version=VERSION,
    author='PyTorch Core Team',
    author_email='soumith@pytorch.org',
    url='https://github.com/pytorch/vision',
    description='image and video datasets and models for torch deep learning',
Thomas Grainger's avatar
Thomas Grainger committed
55
    long_description=readme,
soumith's avatar
soumith committed
56
57
58
    license='BSD',

    # Package info
soumith's avatar
soumith committed
59
    packages=find_packages(exclude=('test',)),
soumith's avatar
soumith committed
60
61

    zip_safe=True,
62
    install_requires=requirements,
63
64
65
    extras_require={
        "scipy": ["scipy"],
    },
soumith's avatar
soumith committed
66
)