Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

[Issue 23] Support Declarative Widgets #62

Merged
merged 12 commits into from
Feb 15, 2016
Merged
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bower_components/
certs/
data/decl-widgets-taxi-demo.ipynb
ext/
node_modules/
public/components/
public/css/
certs/
public/urth_components/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ addons:

before_install:
- npm install -g gulp bower
- make ext/ipywidgets
- make ext/ipywidgets ext/declarativewidgets

notifications:
email:
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.kernel
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ RUN pip install jupyter_kernel_gateway==0.3.1
RUN pip uninstall -y ipywidgets && \
pip install git+https://github.com/ipython/ipywidgets.git@38218351c9dc4196419f6c8f0129df7d0f4cd24c

# install Declarative Widgets
RUN pip install jupyter_declarativewidgets && \
jupyter declarativewidgets install --user --symlink --overwrite && \
jupyter declarativewidgets activate

# run kernel gateway, not notebook server
CMD ["jupyter", "kernelgateway", "--KernelGatewayApp.ip=0.0.0.0"]
7 changes: 7 additions & 0 deletions Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ RUN cd ext && \
cd ipywidgets && \
npm install --quiet

# 3d1d93d5af7ad7b0679f4c522c0e112c1c2a0b82 is a commit on 'StandaloneExperiment' branch
RUN cd ext && \
git clone https://github.com/jhpedemonte/declarativewidgets.git && \
cd declarativewidgets && \
git checkout 3d1d93d5af7ad7b0679f4c522c0e112c1c2a0b82 && \
make node_modules ext/ipywidgets dist NOSCALA=true

# npm & bower install separately, so these are properly cached by docker and not affected by
# changes in rest of source
ADD package.json package.json
Expand Down
49 changes: 36 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ help:
@cat config.json

clean:
@-rm -r bower_components
@-rm -r ext
@-rm -r node_modules
@-rm -r public/components
@-rm -r public/css
@-rm -r certs
@-rm -rf bower_components
@-rm -rf certs
@-rm -f data/decl-widgets-taxi-demo.ipynb
@-rm -rf ext
@-rm -rf node_modules
@-rm -rf public/components
@-rm -rf public/css
@-rm -rf public/urth_components

############### Docker images

Expand All @@ -57,17 +59,24 @@ kill:
############### Dashboard server development on host

ext/ipywidgets:
-npm uninstall --quiet jupyter-js-widgets
-rm -rf ext/ipywidgets
@mkdir -p ext ; \
cd ext ; \
git clone https://github.com/ipython/ipywidgets.git ; \
cd ipywidgets ; \
@-npm uninstall --quiet jupyter-js-widgets
@-rm -rf $@
@mkdir -p $@ ; \
git clone https://github.com/ipython/ipywidgets.git $@ ; \
cd $@ ; \
git checkout 38218351c9dc4196419f6c8f0129df7d0f4cd24c ; \
cd ipywidgets ; \
npm install --quiet

dev-install: ext/ipywidgets
ext/declarativewidgets:
@-npm uninstall --quiet urth-widgets
@-rm -rf $@
@mkdir -p $@ ; \
git clone -b StandaloneExperiment https://github.com/jhpedemonte/declarativewidgets.git $@ ; \
cd $@ ; \
make node_modules ext/ipywidgets dist NOSCALA=true

dev-install: ext/ipywidgets ext/declarativewidgets
npm install --quiet
npm run bower

Expand Down Expand Up @@ -206,3 +215,17 @@ certs/server.pem:
-out $@

certs: certs/server.pem

############### Examples/demos

# this example requires some additional Polymer elements
data/decl-widgets-taxi-demo.ipynb: URTH_COMP_DIR=public/urth_components
data/decl-widgets-taxi-demo.ipynb:
@cp etc/notebooks/$(@F) data/
@mkdir -p $(URTH_COMP_DIR)
@cd $(URTH_COMP_DIR) && bower --silent --config.interactive=false --config.analytics=false \
--config.directory=. install --production \
PolymerElements/paper-button PolymerElements/paper-card \
PolymerElements/paper-slider GoogleWebComponents/google-map

examples: data/decl-widgets-taxi-demo.ipynb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add this to .PHONY else it does nothing because the directory examples exists. (Or just move to etc/notebooks per other comment and then it'll work fine.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Need to run gulp build before make examples. Probably add to dev-install target.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to just make sure that public/urth_components exists before doing bower install of Polymer elements.

Loading