Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Last active February 7, 2017 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bollwyvl/b6a7b274f5a7d8a572b91833bba468cf to your computer and use it in GitHub Desktop.
Save bollwyvl/b6a7b274f5a7d8a572b91833bba468cf to your computer and use it in GitHub Desktop.
testing notebook #1508
__pycache__/

Trying out some test cases from jupyter/notebook#1508

docker-compose build base
docker-compose up

The various emoji should point out the test win/fail.

Here's what I get (after build):

bollweg@rocinante:~/Documents/projects/anaconda-4.3-notebook-config (master)$ docker-compose up
Creating network "anaconda43notebookconfig_default" with the default driver
Creating anaconda43notebookconfig_nbext-user-wins_1
Creating anaconda43notebookconfig_srvext-user-wins_1
Creating anaconda43notebookconfig_nbext-user-wins-again_1
Creating anaconda43notebookconfig_base_1
Attaching to anaconda43notebookconfig_nbext-user-wins_1, anaconda43notebookconfig_nbext-user-wins-again_1, anaconda43notebookconfig_base_1, anaconda43notebookconfig_srvext-user-wins_1
anaconda43notebookconfig_base_1 exited with code 0
nbext-user-wins_1        | Known nbextensions:
nbext-user-wins-again_1  | Known nbextensions:
nbext-user-wins_1        | Disabling notebook extension thisthing...
nbext-user-wins_1        |       - Validating: problems found:
nbext-user-wins_1        |         - require?  X thisthing
nbext-user-wins-again_1  | Enabling notebook extension this-thing...
nbext-user-wins-again_1  |       - Validating: problems found:
nbext-user-wins-again_1  |         - require?  X this-thing
nbext-user-wins_1        | Enabling notebook extension thisthing...
nbext-user-wins_1        |       - Validating: problems found:
nbext-user-wins_1        |         - require?  X thisthing
nbext-user-wins-again_1  | Disabling notebook extension this-thing...
nbext-user-wins-again_1  |       - Validating: problems found:
nbext-user-wins-again_1  |         - require?  X this-thing
srvext-user-wins_1       | Disabling: fake_ext
srvext-user-wins_1       | - Writing config: /home/jovyan/.conda/envs/test-notebook-config/etc/jupyter
nbext-user-wins_1        | Enabling notebook extension thisotherthing...
nbext-user-wins_1        |       - Validating: problems found:
nbext-user-wins_1        |         - require?  X thisotherthing
srvext-user-wins_1       | Enabling: fake_ext
srvext-user-wins_1       | - Writing config: /home/jovyan/.jupyter
srvext-user-wins_1       |     - Validating...
srvext-user-wins_1       |       fake_ext  OK
nbext-user-wins-again_1  | [I 21:16:30.590 NotebookApp] It looks like you're running the notebook from source.
nbext-user-wins-again_1  |     If you're working on the Javascript of the notebook, try running
nbext-user-wins-again_1  |
nbext-user-wins-again_1  |         npm run build:watch
nbext-user-wins-again_1  |
nbext-user-wins-again_1  |     in another terminal window to have the system incrementally
nbext-user-wins-again_1  |     watch and build the notebook's JavaScript for you, as you make changes.
nbext-user-wins-again_1  |
nbext-user-wins-again_1  | [I 21:16:30.597 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
nbext-user-wins-again_1  | [W 21:16:30.648 NotebookApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
nbext-user-wins-again_1  | [I 21:16:30.664 NotebookApp] Serving notebooks from local directory: /home/jovyan/notebook-config-tests
nbext-user-wins-again_1  | [I 21:16:30.664 NotebookApp] 0 active kernels
nbext-user-wins-again_1  | [I 21:16:30.664 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
nbext-user-wins-again_1  | [I 21:16:30.665 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
nbext-user-wins-again_1  | [I 21:16:30.665 NotebookApp] Welcome to Project Jupyter! Explore the various tools available and their corresponding documentation. If you are interested in contributing to the platform, please visit the communityresources section at http://jupyter.org/community.html.
nbext-user-wins-again_1  | [W 21:16:30.666 NotebookApp] No web browser found: could not locate runnable browser.
nbext-user-wins_1        | [I 21:16:30.917 NotebookApp] It looks like you're running the notebook from source.
nbext-user-wins_1        |     If you're working on the Javascript of the notebook, try running
nbext-user-wins_1        |
nbext-user-wins_1        |         npm run build:watch
nbext-user-wins_1        |
nbext-user-wins_1        |     in another terminal window to have the system incrementally
nbext-user-wins_1        |     watch and build the notebook's JavaScript for you, as you make changes.
nbext-user-wins_1        |
nbext-user-wins_1        | [I 21:16:30.923 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
nbext-user-wins_1        | [W 21:16:30.961 NotebookApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
nbext-user-wins_1        | [I 21:16:30.975 NotebookApp] Serving notebooks from local directory: /home/jovyan/notebook-config-tests
nbext-user-wins_1        | [I 21:16:30.975 NotebookApp] 0 active kernels
nbext-user-wins_1        | [I 21:16:30.976 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
nbext-user-wins_1        | [I 21:16:30.976 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
nbext-user-wins_1        | [I 21:16:30.976 NotebookApp] Welcome to Project Jupyter! Explore the various tools available and their corresponding documentation. If you are interested in contributing to the platform, please visit the communityresources section at http://jupyter.org/community.html.
nbext-user-wins_1        | [W 21:16:30.977 NotebookApp] No web browser found: could not locate runnable browser.
srvext-user-wins_1       | [I 21:16:31.520 NotebookApp] It looks like you're running the notebook from source.
srvext-user-wins_1       |     If you're working on the Javascript of the notebook, try running
srvext-user-wins_1       |
srvext-user-wins_1       |         npm run build:watch
srvext-user-wins_1       |
srvext-user-wins_1       |     in another terminal window to have the system incrementally
srvext-user-wins_1       |     watch and build the notebook's JavaScript for you, as you make changes.
srvext-user-wins_1       |
srvext-user-wins_1       | [I 21:16:31.526 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
srvext-user-wins_1       | [W 21:16:31.567 NotebookApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
srvext-user-wins_1       | [I 21:16:31.578 NotebookApp] 👹 FAKE SERVEREXTENSION LOADED
srvext-user-wins_1       | [I 21:16:31.581 NotebookApp] Serving notebooks from local directory: /home/jovyan/notebook-config-tests
srvext-user-wins_1       | [I 21:16:31.581 NotebookApp] 0 active kernels
srvext-user-wins_1       | [I 21:16:31.581 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
srvext-user-wins_1       | [I 21:16:31.581 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
srvext-user-wins_1       | [I 21:16:31.582 NotebookApp] Welcome to Project Jupyter! Explore the various tools available and their corresponding documentation. If you are interested in contributing to the platform, please visit the communityresources section at http://jupyter.org/community.html.
srvext-user-wins_1       | [W 21:16:31.582 NotebookApp] No web browser found: could not locate runnable browser.
nbext-user-wins-again_1  | 🤔 this-thing should be TRUE {"load_extensions": {"this-thing": true}}
nbext-user-wins_1        | 🤔 thisotherthing should be TRUE, while thisthing is FALSE {"load_extensions": {"thisthing": false, "thisotherthing": true}}
anaconda43notebookconfig_nbext-user-wins-again_1 exited with code 0
srvext-user-wins_1       | Should have seen 👹
anaconda43notebookconfig_nbext-user-wins_1 exited with code 0
anaconda43notebookconfig_srvext-user-wins_1 exited with code 0
version: "2"
services:
base:
build:
context: .
volumes:
- .:/home/jovyan/notebook-config-tests
nbext-user-wins:
extends: base
command: /bin/bash nbext-user-wins.sh
nbext-user-wins-again:
extends: base
command: /bin/bash nbext-user-wins-again.sh
srvext-user-wins:
extends: base
command: /bin/bash srvext-user-wins.sh
FROM continuumio/anaconda3:4.3.0
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/$NB_USER
# Create jovyan user with UID=1000 and in the 'users' group
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER
# Setup jovyan home directory
RUN mkdir /home/$NB_USER/work /home/$NB_USER/.jupyter && \
echo "cacert=/etc/ssl/certs/ca-certificates.crt" > /home/$NB_USER/.curlrc && \
chown -R $NB_USER /home/$NB_USER
USER $NB_USER
WORKDIR $HOME
COPY ./environment.yml $HOME
# create a development environment
RUN conda env update
ENV CONDA_PREFIX=$HOME/.conda/envs/test-notebook-config \
PATH=$CONDA_PREFIX/bin:$PATH \
CONDA_DEFAULT_ENV=test-notebook-config
RUN conda list
# get notebook
RUN git clone https://github.com/jupyter/notebook.git --depth=1
WORKDIR notebook
RUN PATH=$CONDA_PREFIX/bin:$PATH npm install
RUN PATH=$CONDA_PREFIX/bin:$PATH npm install proptypes
RUN PATH=$CONDA_PREFIX/bin:$PATH pip install -e .
RUN PATH=$CONDA_PREFIX/bin:$PATH jupyter nbextension list
RUN mkdir $HOME/notebook-config-tests
WORKDIR $HOME/notebook-config-tests
name: test-notebook-config
dependencies:
- ipykernel
- ipython_genutils
- jinja2
- jupyter_client
- jupyter_core
- nbconvert
- nbformat
- nodejs
- python >=3.5,<3.6
- requests
- terminado
- tornado
- traitlets
# serverextension
def load_jupyter_server_extension(nbapp):
nbapp.log.info("👹 FAKE SERVEREXTENSION LOADED")
#!/bin/bash
. activate test-notebook-config
jupyter nbextension list
jupyter nbextension enable this-thing
jupyter nbextension disable this-thing --sys-prefix
jupyter notebook --NotebookApp.token="" --NotebookApp.password="" &
sleep 5
echo 🤔 this-thing should be TRUE \
`curl -s http://localhost:8888/api/config/notebook`
#!/bin/bash
. activate test-notebook-config
jupyter nbextension list
jupyter nbextension disable thisthing
jupyter nbextension enable thisthing --sys-prefix
jupyter nbextension enable thisotherthing --sys-prefix
jupyter notebook --NotebookApp.token="" --NotebookApp.password="" &
sleep 5
echo 🤔 thisotherthing should be TRUE, while thisthing is FALSE \
`curl -s http://localhost:8888/api/config/notebook`
#!/bin/bash
. activate test-notebook-config
export PYTHONPATH=.
jupyter serverextension list
jupyter serverextension disable fake_ext --sys-prefix
jupyter serverextension enable fake_ext
jupyter notebook --NotebookApp.token="" --NotebookApp.password="" &
sleep 5
echo "Should have seen 👹"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment