-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup.py
77 lines (67 loc) · 2.11 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
#!/usr/bin/env python
from setuptools import setup, find_packages # type: ignore
from setuptools.command.sdist import sdist
from setuptools.command.develop import develop
from shutil import which
from subprocess import check_call
import re
__version__ = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
open('observable_jupyter/__init__.py', encoding='utf_8_sig').read()
).group(1)
def build_js():
if which("node") is None:
raise ValueError("Install node to create an sdist.")
check_call(['npm', 'install', '--silent', '--prefix', 'js'])
check_call(['npm', 'run', 'build', '--quiet', '--prefix', 'js'])
class BuildJsAndSdist(sdist):
def run(self):
print('Building JavaScript as part of sdist...')
build_js()
sdist.run(self)
class BuildJSAndDevelop(develop):
def run(self):
print('Building JavaScript as part of develop...')
build_js()
develop.run(self)
with open("README.md") as readme_file:
readme = readme_file.read()
setup(
author="Thomas Ballinger",
author_email="[email protected]",
python_requires=">=3.6",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"License :: OSI Approved :: ISC License (ISCL)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
],
description="Embed Observable cells hosted on observablehq.com into Jupyter notebooks.",
install_requires=[],
license="ISC license",
long_description=readme,
long_description_content_type="text/markdown",
include_package_data=True,
keywords="observable_jupyter",
name="observable_jupyter",
packages=find_packages(include=["observable_jupyter", "observable_jupyter.*"]),
cmdclass={
'sdist': BuildJsAndSdist,
'develop': BuildJSAndDevelop,
},
setup_requires=[],
extras_require={
'test': [
'pytest',
'IPython'
],
'dev': [
'jupyter',
'nox',
'pytest',
]
},
url="https://github.com/observablehq/observable_jupyter",
version=__version__,
zip_safe=False,
)