This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
115 lines (88 loc) · 3.74 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
110
111
112
113
114
115
import os
import setuptools
from distutils import log
from setuptools.command.develop import develop
from setuptools.command.install import install
pjoin = os.path.join
here = os.path.abspath(os.path.dirname(__file__))
# Get the current package version.
version_ns = {}
with open(pjoin(here, 'tmtk', 'version.py')) as f:
exec(f.read(), {}, version_ns)
version_string = version_ns['__version__']
with open("requirements.txt", 'r') as f:
required_packages = f.read().splitlines()
if os.environ.get('READTHEDOCS') == 'True':
for dependency in ['pandas']:
for package in required_packages:
if package.startswith(dependency):
required_packages.remove(package)
class HookedInstall(install):
def run(self):
install.run(self)
log.info('Attempting to install and enable transmart-aborist extension.')
log.info('This can be done manually by running.')
log.info(' $ jupyter nbextension install --py tmtk.arborist')
log.info(' $ jupyter serverextension enable --py tmtk.arborist')
try:
import notebook
except ImportError:
log.info("Cannot find module 'notebook'. Aborting automated install.")
return
notebook_version = getattr(notebook, '__version__')
if notebook_version is None or notebook_version < '5.7.8':
log.info("Version of notebook package should be at least 5.7.8 for Arborist, consider:")
log.info(" $ pip install --upgrade notebook")
log.info('Aborting automated install.')
return
from notebook.nbextensions import install_nbextension_python, enable_nbextension_python
from notebook.serverextensions import toggle_serverextension_python, validate_serverextension
enable_nbextension_python('widgetsnbextension', sys_prefix=True)
install_nbextension_python('tmtk.arborist', sys_prefix=True, overwrite=True)
toggle_serverextension_python('tmtk.arborist', enabled=True, sys_prefix=True)
warnings = validate_serverextension('tmtk.arborist')
if warnings:
[log.warn(warning) for warning in warnings]
else:
log.info('Extension has been enabled.')
class HookedDevelop(develop):
def run(self):
develop.run(self)
log.info('For the Arborist to work you need to install and enable the jupyter serverextension using:')
log.info(' $ jupyter nbextension install --py tmtk.arborist')
log.info(' $ jupyter serverextension enable --py tmtk.arborist')
setuptools.setup(
name="tmtk",
version=version_string,
url="https://www.github.com/thehyve/tmtk/",
author="Jochem Bijlard",
author_email="j.bijlard@gmail.com",
description="A toolkit for ETL curation for the tranSMART data warehouse.",
long_description=open('README.rst').read(),
packages=setuptools.find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
keywords=['transmart', 'etl', 'arborist', 'concept tree'],
download_url='https://github.com/thehyve/tmtk/tarball/{}/'.format(version_string),
install_requires=required_packages,
setup_requires=[
# dependency for `python setup.py bdist_wheel`
'wheel'
],
entry_points={
'console_scripts': [
'transmart-batch = tmtk.utils.batch.__main__:run_batch'
]
},
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
cmdclass={
'install': HookedInstall,
'develop': HookedDevelop
}
)