forked from microsoft/jupyter-Kqlmagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·217 lines (177 loc) · 6.99 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
"""Setup for Kqlmagic"""
# To use a consistent encoding
import codecs
import sys
import re
from os import path
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
DESCRIPTION = "Kqlmagic: Microsoft Azure Monitor magic extension to Jupyter notebook"
NAME = "Kqlmagic"
AUTHOR = 'Michael Binshtock'
AUTHOR_EMAIL = '[email protected]'
MAINTAINER = 'Michael Binshtock'
MAINTAINER_EMAIL = '[email protected]'
URL = 'https://github.com/Microsoft/jupyter-Kqlmagic'
LICENSE = 'MIT License'
KEYWORDS = 'database ipython jupyter jupyterlab jupyter-notebook query language kql kusto loganalytics applicationinsights'
INSTALL_REQUIRES = [
'ipython>=7.1.1',
'ipykernel>=5.1.1',
'plotly>=3.10.0',
'prettytable>=0.7.2',
'matplotlib>=3.0.0',
'pandas>=0.23.4',
'adal>=1.2.2',
'Pygments>=2.2.0',
'seaborn>=0.9.0',
'requests>=2.21.0',
'python-dateutil>=2.7.5',
'isodate>=0.6.0',
'traitlets>=4.3.2',
'psutil>=5.4.7',
'six>=1.11.0',
'setuptools>=41.0.1',
'Markdown>=3.0.1',
'beautifulsoup4>=4.6.3',
'lxml>=4.2.5',
'pytz>=2019.1',
'pyjwt>=1.7.1',
'flask>=1.1.1',
'pyperclip>=1.7.0',
'azure-cli-core>=2.4.0',
'msrestazure>=0.6.0',
'azure-common>=1.1.25',
]
TEST_REQUIRE = [
'pytest',
'pytest-pep8',
'pytest-docstyle',
'pytest-flakes',
'pytest-cov',
'QtPy',
'PyQt5'
]
EXTRAS_REQUIRE = {
'dev': [
'twine',
'pip',
'wheel',
'black',
],
'test': TEST_REQUIRE,
'widgets':[
'ipywidgets'
],
'sso': [
'cryptography>=2.7',
'password-strength>=0.0.3',
]
}
PROJECT_URLS = {
'Documentation': 'https://github.com/microsoft/jupyter-Kqlmagic/blob/master/README.md',
'Source': 'https://github.com/microsoft/jupyter-Kqlmagic',
}
CURRENT_PATH = path.abspath(path.dirname(__file__))
PACKAGE_PATH = 'azure-Kqlmagic'.replace('-', path.sep)
with open(path.join(PACKAGE_PATH, 'version.py'), 'r') as fd:
VERSION = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
#==============================================================================
# Minimal Python version sanity check
# Taken from the notebook setup.py -- Modified BSD License
#==============================================================================
v = sys.version_info
if v[:2] < (3, 6):
pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
try:
import pip
pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
if pip_version < (9, 0, 1) :
pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
'pip {} detected.'.format(pip.__version__)
else:
# pip is new enough - it must be something else
pip_message = ''
except Exception:
pass
error = """ERROR: Kqlmagic {ver} requires Python version 3.6 or above.
Python {py} detected.
{pip}
""".format(ver=VERSION, py=sys.version_info, pip=pip_message)
print(error, file=sys.stderr)
sys.exit(1)
CURRENT_PATH = path.abspath(path.dirname(__file__))
with codecs.open(path.join(CURRENT_PATH, 'README.rst'), encoding='utf-8') as f:
README = f.read()
with codecs.open(path.join(CURRENT_PATH, 'NEWS.txt'), encoding='utf-8') as f:
NEWS = f.read()
LONG_DESCRIPTION = (README + '\n\n' + NEWS).replace('\r','')
LONG_DESCRIPTION_CONTENT_TYPE = 'text/x-rst'
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
except (ImportError, NotImplementedError):
self.pytest_args = ['-n', '1', '--boxed']
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Customer Service',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Environment :: Console',
'Environment :: Plugins',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Topic :: Database',
'Topic :: Database :: Front-Ends',
'Framework :: IPython',
'Framework :: Jupyter',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
keywords=KEYWORDS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
url=URL,
license=LICENSE,
python_requires='>=3.6',
packages=find_packages('azure'),
package_dir={'': 'azure'},
include_package_data=True,
zip_safe=False,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
project_urls=PROJECT_URLS,
# cmdclass={'test': PyTest},
# tests_require=TEST_REQUIRE,
)