Skip to content

Commit 3bc44f4

Browse files
committed
update setup.py and use jupyter_packaging
+ align folder structure with js cookiecutter + Update .gitignore
1 parent a5917ef commit 3bc44f4

File tree

8 files changed

+68
-759
lines changed

8 files changed

+68
-759
lines changed

{{cookiecutter.github_project_name}}/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ $RECYCLE.BIN/
145145
# ----
146146

147147
**/node_modules/
148-
{{ cookiecutter.python_package_name }}/nbextension/static/index.*
148+
{{ cookiecutter.python_package_name }}/nbextension/index.*
149149
{{ cookiecutter.python_package_name }}/labextension/*.tgz
150150

151151
# Coverage data
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["jupyter_packaging==0.7.9", "jupyterlab==3.*", "setuptools>=40.8.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

{{cookiecutter.github_project_name}}/setup.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,51 @@
66

77
from __future__ import print_function
88
from glob import glob
9+
import os
910
from os.path import join as pjoin
11+
from setuptools import setup, find_packages
1012

1113

12-
from setupbase import (
13-
create_cmdclass, install_npm, ensure_targets,
14-
find_packages, combine_commands, ensure_python,
15-
get_version, HERE
14+
from jupyter_packaging import (
15+
create_cmdclass,
16+
install_npm,
17+
ensure_targets,
18+
combine_commands,
19+
get_version,
1620
)
1721

18-
from setuptools import setup
22+
HERE = os.path.dirname(os.path.abspath(__file__))
23+
24+
1925

2026

2127
# The name of the project
2228
name = '{{ cookiecutter.python_package_name }}'
2329

24-
# Ensure a valid python version
25-
ensure_python('>=3.6')
26-
27-
# Get our version
30+
# Get the version
2831
version = get_version(pjoin(name, '_version.py'))
2932

30-
nb_path = pjoin(HERE, name, 'nbextension', 'static')
31-
# lab_path = pjoin(HERE, name, 'labextension')
32-
lab3_path = pjoin(HERE, name, 'labextension')
3333

3434
# Representative files that should exist after a successful build
3535
jstargets = [
36-
pjoin(nb_path, 'index.js'),
36+
pjoin(HERE, name, 'nbextension', 'index.js'),
3737
pjoin(HERE, 'lib', 'plugin.js'),
3838
]
3939

40+
4041
package_data_spec = {
4142
name: [
42-
'nbextension/static/**js*',
43-
# 'labextension/*.tgz',
44-
'labextension/*'
43+
'nbextension/**js*',
44+
'labextension/**'
4545
]
4646
}
4747

48-
labext_name = "{{ cookiecutter.npm_package_name }}"
4948

5049
data_files_spec = [
51-
('share/jupyter/nbextensions/{{ cookiecutter.python_package_name}}',
52-
nb_path, '*.js*'),
53-
("share/jupyter/labextensions/%s" % labext_name, lab3_path, "**"),
54-
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
55-
# ('share/jupyter/lab/extensions', lab_path, '*.tgz'),
56-
('etc/jupyter/nbconfig/notebook.d' , HERE, '{{ cookiecutter.python_package_name}}.json')
50+
('share/jupyter/nbextensions/{{ cookiecutter.npm_package_name }}', '{{ cookiecutter.python_package_name }}/nbextension', '**'),
51+
('share/jupyter/labextensions/{{ cookiecutter.npm_package_name }}', '{{ cookiecutter.python_package_name }}/labextension', '**'),
52+
('share/jupyter/labextensions/{{ cookiecutter.npm_package_name }}', '.', 'install.json'),
53+
('etc/jupyter/nbconfig/notebook.d', '.', '{{ cookiecutter.npm_package_name }}.json'),
5754
]
5855

5956

0 commit comments

Comments
 (0)