1
|
|
#!/usr/bin/env python
|
2
|
|
|
3
|
0
|
import os
|
4
|
0
|
import shutil
|
5
|
0
|
import sys
|
6
|
0
|
import json
|
7
|
|
|
8
|
0
|
from setuptools import setup, find_packages
|
9
|
0
|
from setuptools.command.develop import develop
|
10
|
0
|
from setuptools.command.install import install
|
11
|
0
|
from setuptools.command.sdist import sdist
|
12
|
|
|
13
|
0
|
import pyct.build
|
14
|
|
|
15
|
|
|
16
|
0
|
def get_setup_version(reponame):
|
17
|
|
"""
|
18
|
|
Helper to get the current version from either git describe or the
|
19
|
|
.version file (if available).
|
20
|
|
"""
|
21
|
0
|
basepath = os.path.split(__file__)[0]
|
22
|
0
|
version_file_path = os.path.join(basepath, reponame, '.version')
|
23
|
0
|
try:
|
24
|
0
|
from param import version
|
25
|
0
|
except Exception:
|
26
|
0
|
version = None
|
27
|
0
|
if version is not None:
|
28
|
0
|
return version.Version.setup_version(basepath, reponame, archive_commit="$Format:%h$")
|
29
|
|
else:
|
30
|
0
|
print("WARNING: param>=1.6.0 unavailable. If you are installing a package, "
|
31
|
|
"this warning can safely be ignored. If you are creating a package or "
|
32
|
|
"otherwise operating in a git repository, you should install param>=1.6.0.")
|
33
|
0
|
return json.load(open(version_file_path, 'r'))['version_string']
|
34
|
|
|
35
|
|
|
36
|
0
|
def _build_paneljs():
|
37
|
0
|
from bokeh.ext import build
|
38
|
0
|
from panel.compiler import bundle_resources
|
39
|
0
|
print("Building custom models:")
|
40
|
0
|
panel_dir = os.path.join(os.path.dirname(__file__), "panel")
|
41
|
0
|
build(panel_dir)
|
42
|
0
|
print("Bundling custom model resources:")
|
43
|
0
|
bundle_resources()
|
44
|
|
|
45
|
|
|
46
|
0
|
class CustomDevelopCommand(develop):
|
47
|
|
"""Custom installation for development mode."""
|
48
|
|
|
49
|
0
|
def run(self):
|
50
|
0
|
_build_paneljs()
|
51
|
0
|
develop.run(self)
|
52
|
|
|
53
|
|
|
54
|
0
|
class CustomInstallCommand(install):
|
55
|
|
"""Custom installation for install mode."""
|
56
|
|
|
57
|
0
|
def run(self):
|
58
|
0
|
_build_paneljs()
|
59
|
0
|
install.run(self)
|
60
|
|
|
61
|
|
|
62
|
0
|
class CustomSdistCommand(sdist):
|
63
|
|
"""Custom installation for sdist mode."""
|
64
|
|
|
65
|
0
|
def run(self):
|
66
|
0
|
_build_paneljs()
|
67
|
0
|
sdist.run(self)
|
68
|
|
|
69
|
|
|
70
|
0
|
_COMMANDS = {
|
71
|
|
'develop': CustomDevelopCommand,
|
72
|
|
'install': CustomInstallCommand,
|
73
|
|
'sdist': CustomSdistCommand,
|
74
|
|
}
|
75
|
|
|
76
|
0
|
try:
|
77
|
0
|
from wheel.bdist_wheel import bdist_wheel
|
78
|
|
|
79
|
0
|
class CustomBdistWheelCommand(bdist_wheel):
|
80
|
|
"""Custom bdist_wheel command to force cancelling qiskit-terra wheel
|
81
|
|
creation."""
|
82
|
|
|
83
|
0
|
def run(self):
|
84
|
|
"""Do nothing so the command intentionally fails."""
|
85
|
0
|
_build_paneljs()
|
86
|
0
|
bdist_wheel.run(self)
|
87
|
|
|
88
|
0
|
_COMMANDS['bdist_wheel'] = CustomBdistWheelCommand
|
89
|
0
|
except Exception:
|
90
|
0
|
pass
|
91
|
|
|
92
|
|
########## dependencies ##########
|
93
|
|
|
94
|
0
|
install_requires = [
|
95
|
|
'bokeh >=2.2',
|
96
|
|
'param >=1.9.3',
|
97
|
|
'pyviz_comms >=0.7.4',
|
98
|
|
'markdown',
|
99
|
|
'tqdm',
|
100
|
|
'pyct >=0.4.4'
|
101
|
|
]
|
102
|
|
|
103
|
0
|
_recommended = [
|
104
|
|
'notebook >=5.4',
|
105
|
|
'holoviews >=1.13.2',
|
106
|
|
'matplotlib',
|
107
|
|
'pillow',
|
108
|
|
'plotly'
|
109
|
|
]
|
110
|
|
|
111
|
0
|
_tests = [
|
112
|
|
'flake8',
|
113
|
|
'parameterized',
|
114
|
|
'pytest',
|
115
|
|
'scipy',
|
116
|
|
'nbsmoke >=0.2.0',
|
117
|
|
'pytest-cov',
|
118
|
|
'codecov',
|
119
|
|
'folium',
|
120
|
|
'ipympl',
|
121
|
|
'twine',
|
122
|
|
'pandas<1.1', # temporary fix for streamz incompatibility
|
123
|
|
'ipython >=7.0'
|
124
|
|
]
|
125
|
|
|
126
|
0
|
extras_require = {
|
127
|
|
'examples': [
|
128
|
|
'hvplot',
|
129
|
|
'plotly',
|
130
|
|
'altair',
|
131
|
|
'streamz',
|
132
|
|
'vega_datasets',
|
133
|
|
'vtk',
|
134
|
|
'scikit-learn',
|
135
|
|
'datashader',
|
136
|
|
'jupyter_bokeh',
|
137
|
|
'django',
|
138
|
|
'channels',
|
139
|
|
'pyvista',
|
140
|
|
'ipywidgets',
|
141
|
|
'ipywidgets_bokeh',
|
142
|
|
'ipyvolume',
|
143
|
|
'ipyleaflet'
|
144
|
|
],
|
145
|
|
'tests': _tests,
|
146
|
|
'recommended': _recommended,
|
147
|
|
'doc': _recommended + [
|
148
|
|
'nbsite >=0.6.1',
|
149
|
|
'nbconvert <6.0',
|
150
|
|
'sphinx_holoviz_theme',
|
151
|
|
'selenium',
|
152
|
|
'phantomjs',
|
153
|
|
'graphviz',
|
154
|
|
'lxml',
|
155
|
|
]
|
156
|
|
}
|
157
|
|
|
158
|
0
|
extras_require['all'] = sorted(set(sum(extras_require.values(), [])))
|
159
|
|
|
160
|
|
# Superset of what's in pyproject.toml (includes non-python
|
161
|
|
# dependencies). Also, pyproject.toml isn't supported by all tools
|
162
|
|
# anyway (e.g. older versions of pip, or conda - which also supports
|
163
|
|
# non-python dependencies). Note that setup_requires isn't used
|
164
|
|
# because it doesn't work well with pip.
|
165
|
0
|
extras_require['build'] = [
|
166
|
|
'param >=1.9.2',
|
167
|
|
'pyct >=0.4.4',
|
168
|
|
'setuptools >=30.3.0',
|
169
|
|
'bokeh >=2.0.0',
|
170
|
|
'pyviz_comms >=0.6.0',
|
171
|
|
# non-python dependency
|
172
|
|
'nodejs >=10.13.0',
|
173
|
|
]
|
174
|
|
|
175
|
0
|
setup_args = dict(
|
176
|
|
name='panel',
|
177
|
|
version=get_setup_version("panel"),
|
178
|
|
description='A high level app and dashboarding solution for Python.',
|
179
|
|
long_description=open('README.md').read() if os.path.isfile('README.md') else 'Consult README.md',
|
180
|
|
long_description_content_type="text/markdown",
|
181
|
|
author="HoloViz",
|
182
|
|
author_email="developers@holoviz.org",
|
183
|
|
maintainer="HoloViz",
|
184
|
|
maintainer_email="developers@holoviz.org",
|
185
|
|
platforms=['Windows', 'Mac OS X', 'Linux'],
|
186
|
|
license='BSD',
|
187
|
|
url='http://panel.holoviz.org',
|
188
|
|
cmdclass=_COMMANDS,
|
189
|
|
packages=find_packages(),
|
190
|
|
include_package_data=True,
|
191
|
|
classifiers=[
|
192
|
|
"License :: OSI Approved :: BSD License",
|
193
|
|
"Development Status :: 5 - Production/Stable",
|
194
|
|
"Programming Language :: Python :: 3",
|
195
|
|
"Programming Language :: Python :: 3.6",
|
196
|
|
"Programming Language :: Python :: 3.7",
|
197
|
|
"Programming Language :: Python :: 3.8",
|
198
|
|
"Operating System :: OS Independent",
|
199
|
|
"Intended Audience :: Developers",
|
200
|
|
"Intended Audience :: Science/Research",
|
201
|
|
"Intended Audience :: Financial and Insurance Industry",
|
202
|
|
"Intended Audience :: Healthcare Industry",
|
203
|
|
"Intended Audience :: Information Technology",
|
204
|
|
"Intended Audience :: Legal Industry",
|
205
|
|
"Intended Audience :: Other Audience",
|
206
|
|
"Intended Audience :: Science/Research",
|
207
|
|
"Natural Language :: English",
|
208
|
|
"Topic :: Scientific/Engineering",
|
209
|
|
"Topic :: Scientific/Engineering :: Visualization",
|
210
|
|
"Topic :: Scientific/Engineering :: Information Analysis",
|
211
|
|
"Topic :: Office/Business",
|
212
|
|
"Topic :: Office/Business :: Financial",
|
213
|
|
"Topic :: Software Development :: Libraries"],
|
214
|
|
python_requires=">=3.6",
|
215
|
|
entry_points={
|
216
|
|
'console_scripts': [
|
217
|
|
'panel = panel.command:main'
|
218
|
|
]},
|
219
|
|
install_requires=install_requires,
|
220
|
|
extras_require=extras_require,
|
221
|
|
tests_require=extras_require['tests']
|
222
|
|
)
|
223
|
|
|
224
|
0
|
if __name__ == "__main__":
|
225
|
0
|
example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
226
|
|
'panel', 'examples')
|
227
|
|
|
228
|
0
|
if 'develop' not in sys.argv and 'egg_info' not in sys.argv:
|
229
|
0
|
pyct.build.examples(example_path, __file__, force=True)
|
230
|
|
|
231
|
0
|
version = setup_args['version']
|
232
|
0
|
if 'post' not in version:
|
233
|
0
|
with open('./panel/package.json') as f:
|
234
|
0
|
package_json = json.load(f)
|
235
|
0
|
js_version = package_json['version']
|
236
|
0
|
if version != 'None' and version.split('+')[0] != js_version.replace('-', ''):
|
237
|
0
|
raise ValueError("panel.js version (%s) does not match "
|
238
|
|
"panel version (%s). Cannot build release."
|
239
|
|
% (js_version, version))
|
240
|
|
|
241
|
0
|
setup(**setup_args)
|
242
|
|
|
243
|
0
|
if os.path.isdir(example_path):
|
244
|
0
|
shutil.rmtree(example_path)
|