forked from WorldWideTelescope/pywwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·151 lines (133 loc) · 4.12 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
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) Jupyter Development Team, AAS WorldWide Telescope team
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import io
from os.path import join as pjoin
import sys
sys.path.append(".")
from setupbase import (
create_cmdclass,
install_npm,
ensure_targets,
find_packages,
combine_commands,
get_version,
HERE,
)
from setuptools import setup
# Gather package metadata.
name = "pywwt"
version = get_version(pjoin(name, "_version.py"))
with io.open("README.md", encoding="utf_8") as f:
LONG_DESCRIPTION = f.read()
# Wire up the NPM build to the Python package build -- we generate JavaScript
# artifacts from the `frontend/` package and then include them as data assets in
# the pywwt Python package.
nb_path = pjoin(name, "nbextension", "static")
js_outputs = [
pjoin(nb_path, "index.js"),
]
js_content_command = combine_commands(
install_npm("frontend", build_cmd="pywwt-export"),
ensure_targets(js_outputs),
)
# Custom "command class" that (1) makes sure to create the JS content, (2)
# includes that content as extra "package data" in the Python package, and (3)
# can install special metadata files in the Python environment root.
package_data_spec = {
name: [
"interactive_figure/*.html",
"interactive_figure/*.js",
"labextension/*.tgz",
"nbextension/static/*.*js*",
"tests/data/*/*.png",
"tests/data/*.fits",
"web_static/**",
]
}
lab_path = pjoin(name, "labextension")
local_nbdotd_path = pjoin("jupyter.d", "notebook.d")
local_jnbcfgdotd_path = pjoin("jupyter.d", "jupyter_notebook_config.d")
data_files_spec = [
("share/jupyter/nbextensions/pywwt", nb_path, "*.js*"),
("share/jupyter/lab/extensions", lab_path, "*.tgz"),
("etc/jupyter/nbconfig/notebook.d", local_nbdotd_path, "pywwt.json"),
("etc/jupyter/jupyter_notebook_config.d", local_jnbcfgdotd_path, "pywwt.json"),
]
cmdclass = create_cmdclass(
"js-content", package_data_spec=package_data_spec, data_files_spec=data_files_spec
)
cmdclass["js-content"] = js_content_command
# Ready to go!
setup_args = dict(
name=name,
description="The AAS WorldWide Telescope from Python",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
version=version,
cmdclass=cmdclass,
packages=find_packages(),
author="AAS WorldWide Telescope team",
author_email="[email protected]",
url="https://github.com/WorldWideTelescope/pywwt",
license="BSD",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "Widgets", "IPython"],
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Topic :: Multimedia :: Graphics",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Framework :: Jupyter",
],
include_package_data=True,
python_requires=">=3.7",
install_requires=[
# Keep alphabetized:
"astropy>=1.0,!=4.0.1",
"beautifulsoup4",
"ipyevents",
"ipywidgets>=7.0.0",
"lxml",
"matplotlib>1.5",
"nest_asyncio",
"numpy>=1.9",
"python-dateutil",
"pytz",
"qtpy",
"reproject>=0.8",
"requests",
"toasty>=0.15",
"tornado",
"traitlets>=5",
"wwt_data_formats>=0.12",
],
extras_require={
"test": [
"pytest",
"pytest-cov>=2.6.1",
"pytest-remotedata>=0.3.1",
],
"docs": [
"astropy-sphinx-theme",
"sphinx>=1.6",
"sphinx-automodapi",
"numpydoc",
"jupyter_sphinx",
],
"qt": [
'PyQt5;python_version>="3"',
'PyQtWebEngine;python_version>="3"',
],
"lab": ["jupyterlab"],
},
entry_points={},
)
if __name__ == "__main__":
setup(**setup_args)