Skip to main content

A tool for building Docker images for Civis Platform Jupyter notebooks

Project description

civis-jupyter-notebook

PyPI version CircleCI Builds

A tool to enable any Docker image to be used with Civis Platform Jupyter notebooks.

Usage

In your Dockerfile, put the following code at the end:

ENV DEFAULT_KERNEL=<your kernel>  # set to python3 or ir

RUN pip install civis-jupyter-notebook && \
    civis-jupyter-notebooks-install

# Add Tini
ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

EXPOSE 8888
WORKDIR /root/work
ENTRYPOINT ["/tini", "--"]
CMD ["civis-jupyter-notebooks-start"]

Here you need to replace <your kernel> with the name of your kernel (e.g., python3 or ir). Note that your Dockerfile must use root as the default user.

See the example Docker image for more details.

Integration Testing Docker Images with Civis Platform

If you would like to test your image's integration with Civis Platform locally follow the steps below:

  1. Create a notebook in your Civis Platform account and grab the ID of the notebook. This ID is the number that appears at the end of the URL for the notebook, https://platform.civisanalytics.com/#/notebooks/<NOTEBOOK ID>.
  2. Create an environment file called my.env and add the following to it:
PLATFORM_OBJECT_ID=<NOTEBOOK ID>
CIVIS_API_KEY=<YOUR CIVIS API KEY>
  1. Build your image locally: docker build -t test ..
  2. Run the container: docker run --rm -p 8888:8888 --env-file my.env test.
  3. Access the notebook at the ip of your Docker host with port 8888 (e.g., http://localhost:8888/notebooks/notebook.ipynb).

Integration Testing Code Changes with Civis Platform

The scripts tests/build_dev_image.sh and tests/run_dev_image.sh can be used to test the integration of code changes with Civis Platform.

From the top directory in the repo type:

./tests/build_dev_image.sh
./tests/run_dev_image.sh <NOTEBOOK ID>

where <NOTEBOOK ID> is the ID of a Civis Platform notebook. See step 1 above if you do not have a notebook ID. Then you can connect to the notebook from your local browser and check to make sure it is working properly.

Contributing

See CONTRIBUTING.md for information about contributing to this project.

License

BSD-3

See LICENSE.txt for details.

The file terminal.js contains code from jupyter/nbclassic. As noted in the file, that code is Copyright (c) Jupyter Development Team and has a BSD-3 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

civis_jupyter_notebook-2.2.1.tar.gz (83.1 kB view details)

Uploaded Source

Built Distribution

civis_jupyter_notebook-2.2.1-py3-none-any.whl (84.8 kB view details)

Uploaded Python 3

File details

Details for the file civis_jupyter_notebook-2.2.1.tar.gz.

File metadata

File hashes

Hashes for civis_jupyter_notebook-2.2.1.tar.gz
Algorithm Hash digest
SHA256 abd49283dfe12aa3e79661c3c60740af60591235277d51078522dc6ddd839819
MD5 2a193bf76f96b01c4bbf056023fa8e40
BLAKE2b-256 754b737db8aac8b43c288a901e676ddd714d674bf5be35e251b379cd50f339fa

See more details on using hashes here.

File details

Details for the file civis_jupyter_notebook-2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for civis_jupyter_notebook-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f46357fd7f9cb099d6e08ba4c502a1bf0e3acb6abe5cb5e706da2ff0043d2796
MD5 33568fd97e4c50e66651754062b82a80
BLAKE2b-256 82dbfc450693aeba8946af3e6c883c0bb3dbed8b1a7a67386f44f2536a447970

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page