Skip to content

Commit 5d51e9f

Browse files
committed
enable files without ipynb extension in notebook component
1 parent 6d54dfd commit 5d51e9f

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

api/src/main/resources/plugins/jupyter.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,17 @@ def create_component(self, staged_component_path, application_name, user_name, c
7373
os.system('chmod a+x {}/.git/hooks/post-update'.format(repo_path))
7474
os.system('chmod a+w {} -R'.format(repo_path))
7575
this_dir = os.path.dirname(os.path.realpath(__file__))
76-
os.system('cp {}/jupyter_README.md {}/README.md'.format(this_dir, repo_path))
77-
os.system('cd {0} && git add README.md && git commit -m "Initial commit"'.format(repo_path))
76+
os.system('cp {}/jupyter_README.ipynb {}/README.ipynb'.format(this_dir, repo_path))
77+
os.system('cd {0} && git add README.ipynb && git commit -m "Initial commit"'.format(repo_path))
7878
## add notebooks to application_user github repo.
7979
notebook_install_path = '{}/{}/'.format(repo_path, application_name)
8080
os.system('mkdir -p {}'.format(notebook_install_path))
8181
file_list = component['component_detail']
8282
for file_name in file_list:
83-
if file_name.endswith(r'.ipynb'):
83+
# We copy all files in package to jupyter folder to let the user work with all kind of files/datasets.
84+
#if file_name.endswith(r'.ipynb'):
85+
if file_name != 'properties.json':
8486
self._fill_properties('%s/%s' % (staged_component_path, file_name), properties)
85-
8687
logging.debug('Copying {} to {}'.format(file_name, notebook_install_path))
8788
os.system('cp {}/{} {}'.format( staged_component_path, file_name, notebook_install_path ))
8889
# update local github repo:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Notebooks of PNDA Applications\n",
8+
"\n",
9+
"This folder synchronizes the notebooks of the deployed PNDA Applications when your jupyter server starts. Each PNDA app is checkout in a folder with its name.\n",
10+
"\n",
11+
"> **WARNING**: WATCH OUT! modfications to notebooks or files in this folders will be removed when your jupyter server restarts.\n",
12+
"> If you want to persist your changes, copy the files outside this folder.\n",
13+
"\n",
14+
"\n"
15+
]
16+
}
17+
],
18+
"metadata": {
19+
"kernelspec": {
20+
"display_name": "Python 3",
21+
"language": "python",
22+
"name": "python3"
23+
},
24+
"language_info": {
25+
"codemirror_mode": {
26+
"name": "ipython",
27+
"version": 3
28+
},
29+
"file_extension": ".py",
30+
"mimetype": "text/x-python",
31+
"name": "python",
32+
"nbconvert_exporter": "python",
33+
"pygments_lexer": "ipython3",
34+
"version": "3.7.3"
35+
}
36+
},
37+
"nbformat": 4,
38+
"nbformat_minor": 4
39+
}

api/src/main/resources/plugins/jupyter_README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)