-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
109 lines (97 loc) · 3.9 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file is part of the HUB TOOLBOX available at
https://github.com/OFAI/hub-toolbox-python3/
The HUB TOOLBOX is licensed under the terms of the GNU GPLv3.
(c) 2011-2018, Dominik Schnitzer and Roman Feldbauer
Austrian Research Institute for Artificial Intelligence (OFAI)
Contact: <[email protected]>
Installation:
-------------
In the console (terminal application) change to the folder containing this file.
To build the package hub_toolbox:
python3 setup.py build
To install the package (with administrator rights):
sudo python3 setup.py install
To test the installation:
sudo python3 setup.py test
If this succeeds with an 'OK' message, you are ready to go.
Otherwise you may consider filing a bug report on github.
(Some skipped tests are perfectly fine, though.)
"""
import re, os, sys
REQ_MAJOR = 3
REQ_MINOR = 6
if sys.version_info < (REQ_MAJOR, REQ_MINOR):
sys.stdout.write(
(f"The HUB TOOLBOX requires Python {REQ_MAJOR}.{REQ_MINOR} or higher."
f"\nPlease try to run as python3 setup.py or update your Python "
f"environment.\n Consider using Anaconda for easy package handling."))
sys.exit(1)
try:
import numpy, scipy, sklearn # @UnusedImport
except ImportError:
sys.stdout.write("The HUB TOOLBOX requires numpy, scipy and scikit-learn. "
"Please make sure these packages are available locally. "
"Consider using Anaconda for easy package handling.\n")
try:
import pandas, joblib # @UnusedImport
except ImportError:
sys.stdout.write("Some modules of the HUB TOOLBOX require pandas and joblib. "
"Please make sure these packages are available locally. "
"Consider using Anaconda for easy package handling.\n")
try:
import nmslib, falconn # @UnusedImport
except ImportError:
sys.stdout.write("The 'approximate' module uses 'nmslib' and 'falconn' "
"libraries for approximate nearest neighbor search. "
"Please make sure these packages are available locally. "
"Consider using Anaconda for easy package handling.\n")
setup_options = {}
try:
from setuptools import setup
setup_options['test_suite'] = 'tests'
except ImportError:
from distutils.core import setup
import warnings
warnings.warn("setuptools not found, resorting to distutils. "
"Unit tests won't be discovered automatically.")
# Parsing current version number
# Adapted from the Lasagne project at
# https://github.com/Lasagne/Lasagne/blob/master/setup.py
here = os.path.abspath(os.path.dirname(__file__))
try:
# obtain version string from __init__.py
# Read ASCII file with builtin open() so __version__ is str in Python 2 and 3
with open(os.path.join(here, 'hub_toolbox', '__init__.py'), 'r') as f:
init_py = f.read()
version = re.search("__version__ = '(.*)'", init_py).groups()[0]
except Exception:
version = ''
setup(
name = "hub_toolbox",
version = version,
author = "Roman Feldbauer",
author_email = "[email protected]",
maintainer = "Roman Feldbauer",
maintainer_email = "[email protected]",
description = "Hubness reduction and analysis tools",
license = "GNU GPLv3",
keywords = ["machine learning", "data science"],
url = "https://github.com/OFAI/hub-toolbox-python3",
packages=['hub_toolbox', 'tests'],
package_data={'hub_toolbox': ['example_datasets/*']},
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 "
"or later (GPLv3+)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering"
],
**setup_options
)