setup.py 1.61 KB
Newer Older
soumith's avatar
soumith committed
1
2
#!/usr/bin/env python
import os
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
3
4
import io
import re
soumith's avatar
soumith committed
5
6
7
import shutil
import sys
from setuptools import setup, find_packages
8
from pkg_resources import get_distribution, DistributionNotFound
soumith's avatar
soumith committed
9
10


Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
11
12
13
14
15
16
17
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
18

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


Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
26
27
28
29
30
31
32
33
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
34

Thomas Grainger's avatar
Thomas Grainger committed
35
36
readme = open('README.rst').read()

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

39
40
41
42
43
44
requirements = [
    'numpy',
    'six',
    'torch',
]

45
46
47
48
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)

49
50
51
tqdm_ver = ' == 4.19.9' if sys.version_info[0] < 3 else ''
requirements.append('tqdm' + tqdm_ver)

Thomas Grainger's avatar
Thomas Grainger committed
52
setup(
soumith's avatar
soumith committed
53
54
55
56
57
58
59
    # 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
60
    long_description=readme,
soumith's avatar
soumith committed
61
62
63
    license='BSD',

    # Package info
soumith's avatar
soumith committed
64
    packages=find_packages(exclude=('test',)),
soumith's avatar
soumith committed
65
66

    zip_safe=True,
67
    install_requires=requirements,
soumith's avatar
soumith committed
68
)