forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
115 lines (87 loc) · 4.28 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
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
''' Setup script for Bokeh.
Two separate components comprise Bokeh:
* A JavaScript runtime BokehJS that draws and handles events in browsers
* Python "bindings" and an optional server for interacting with BokehJS
The BokehJS library is written in a mixture of TypeScript and pure JavaScript.
This necessitates a "compilation" step to build a complete BokehJS from these
sources, and this fact makes the Bokeh setup and install more complicated than
typical pure Python projects.
In order to build BokehJS, the first step is to make sure that the "npm"
command is installed. If you are using conda, you can typically just run
conda install -c conda-forge nodejs
Otherwise, you can find general instructions for installing NodeJS here:
https://nodejs.org/en/download/
Once you have "npm" installed, this script can be used to build BokehJS
from the ``bokehjs`` source subdirectory, and install Bokeh into the python
source package by issuing the command:
python setup.py install --build-js
The script also supports the standard "develop" mode that setuptools offers:
python setup.py develop --build-js
It can take a few minutes for BokehJS to build, if you are not making changes
to the BokehJS source code, then you only need to build it once, the first
time. Subsequence invocations can be made to install the previously built
BokehJS from the ``bokehjs`` source subdirectory with the ``--install-js``
option, e.g:
python setup.py develop --install-js
It is also possible to build BokehJS "by hand" under the ``bokehjs`` source
subdirectory. In this case, to simply install the build BokehJS quickly into
the python source tree, the following command may be issued:
python setup.py --install-js
This will copy BokehJS from the ``bokehjs`` source directory, into the python
package directory, and perform no other actions.
Note that source distributions (sdists) and wheels are published with a
pre-built BokehJS included inside the python package, and do not include the
``bokehjs`` source. The ``--build-js`` and ``-install-js`` options are not valid
when running from an sdist. They will be ignored, and warning printed.
'''
import sys
from setuptools import find_packages, setup
import versioneer
from _setup_support import ( # isort:skip
build_or_install_bokehjs, check_building_dist, check_python,
conda_rendering, fixup_for_packaged, install_js, show_bokehjs, show_help,
INSTALL_REQUIRES,
)
# bail on unsupported Python versions
check_python()
# immediately handle lightweight "python setup.py --install-js"
if len(sys.argv) == 2 and sys.argv[-1] == '--install-js':
install_js()
sys.exit()
# if this is just conda-build skimming information, skip all this actual work
if not conda_rendering():
fixup_for_packaged() # --build_js and --install_js not valid FROM sdist
check_building_dist() # must build or install BokehJS when MAKING dists
bokehjs_action = build_or_install_bokehjs()
setup(
# basic package metadata
name='bokeh',
version=versioneer.get_version(),
description='Interactive plots and applications in the browser from Python',
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
license='BSD-3-Clause',
author='Bokeh Team',
author_email='[email protected]',
url='http://github.com/bokeh/bokeh',
classifiers=open("classifiers.txt").read().strip().split('\n'),
# details needed by setup
install_requires=INSTALL_REQUIRES,
python_requires=">=3.7",
packages=find_packages(include=["bokeh", "bokeh.*"]),
include_package_data=True,
entry_points={'console_scripts': ['bokeh = bokeh.__main__:main']},
zip_safe=False,
cmdclass=versioneer.get_cmdclass(),
)
# if this is just conda-build skimming information, skip all this actual work
if not conda_rendering():
if '--help' in sys.argv: show_help(bokehjs_action)
if 'develop' in sys.argv: show_bokehjs(bokehjs_action, develop=True)
if 'install' in sys.argv: show_bokehjs(bokehjs_action)