Skip to content

Commit 48e559c

Browse files
committed
add data_files to setup.py so it automatically enables serverextension
also: cleans up setup.py os.path imports
1 parent bd9761c commit 48e559c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"NotebookApp": {
3+
"nbserver_extensions": {
4+
"bookstore": true
5+
}
6+
}
7+
}

setup.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
# from __future__ import print_function
1919
import os
2020
import sys
21-
from os import path
2221
from setuptools import setup
2322

2423
# io.open is needed for projects that support Python 2.7
@@ -37,13 +36,18 @@ def read(fname):
3736
return fhandle.read()
3837

3938

40-
req_path = os.path.join(os.path.dirname('__file__'), 'requirements.txt')
39+
setup_dir_name = os.path.abspath(os.path.dirname(__file__))
40+
req_path = os.path.join(setup_dir_name, 'requirements.txt')
4141
required = [req.strip() for req in read(req_path).splitlines() if req.strip()]
4242

43-
test_req_path = os.path.join(os.path.dirname('__file__'), 'requirements-dev.txt')
43+
test_req_path = os.path.join(setup_dir_name, 'requirements-dev.txt')
4444
test_required = [req.strip() for req in read(test_req_path).splitlines() if req.strip()]
4545
extras_require = {"test": test_required, "dev": test_required}
4646

47+
target_dir = os.path.join("etc", "jupyter", "jupyter_notebook_config.d")
48+
config_files = [os.path.join("jupyter_config", "jupyter_notebook_config.d", "bookstore.json")]
49+
data_files = [(target_dir, config_files)]
50+
4751
pip_too_old = False
4852
pip_message = ''
4953

@@ -72,8 +76,7 @@ def read(fname):
7276

7377

7478
# Get the long description from the README file
75-
here = path.abspath(path.dirname(__file__))
76-
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
79+
with open(os.path.join(setup_dir_name, 'README.md'), encoding='utf-8') as f:
7780
long_description = f.read()
7881

7982
setup(
@@ -93,6 +96,7 @@ def read(fname):
9396
install_requires=required,
9497
extras_require=extras_require,
9598
entry_points={},
99+
data_files=data_files,
96100
project_urls={
97101
'Documentation': 'https://github.com/nteract/bookstore/#todo',
98102
'Funding': 'https://nteract.io',

0 commit comments

Comments
 (0)