Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Initial implementation with local deploy option
Browse files Browse the repository at this point in the history
* Project setup
* Port of deploy as local dashboard logic from jupyter/dashboards
* Simplification of converter options
* Tests for bundling logic

(c) Copyright IBM Corp. 2015
  • Loading branch information
parente committed Dec 15, 2015
1 parent 98ddfff commit 7d7d780
Show file tree
Hide file tree
Showing 26 changed files with 13,577 additions and 2 deletions.
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
61 changes: 61 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Licensing terms

This project is licensed under the terms of the Modified BSD License
(also known as New or Revised or 3-Clause BSD), as follows:

- Copyright (c) 2001-2015, IPython Development Team
- Copyright (c) 2015-, Jupyter Development Team

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

Neither the name of the Jupyter Development Team nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## About the Jupyter Development Team

The Jupyter Development Team is the set of all contributors to the Jupyter project.
This includes all of the Jupyter Subprojects, which are the different repositories
under the [jupyter](https://github.com/jupyter/) GitHub organization.

The core team that coordinates development on GitHub can be found here:
https://github.com/jupyter/.

## Our copyright policy

Jupyter uses a shared copyright model. Each contributor maintains copyright
over their contributions to Jupyter. But, it is important to note that these
contributions are typically only changes to the repositories. Thus, the Jupyter
source code, in its entirety is not the copyright of any single person or
institution. Instead, it is the collective copyright of the entire Jupyter
Development Team. If individual contributors want to maintain a record of what
changes/contributions they have specific copyright on, they should indicate
their copyright in the commit message of the change, when they commit the
change to one of the Jupyter repositories.

With this in mind, the following banner should be used in any source code file
to indicate the copyright and license terms:

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
94 changes: 94 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

.PHONY: build clean dev help install sdist test install

# Version of Python to dev/test against
PYTHON?=python3
# CMS package to use for dev, expressed as a pip installable
CMS_PACKAGE?=git+https://github.com/parente/contentmanagement.git@deploy-extension
# Dashboards package to use for dev, expressed as a pip installable
DASHBOARDS_PACKAGE?=jupyter_dashboards

# Using pyspark notebook to get both a python2 and python3 env
REPO:=jupyter/pyspark-notebook:a388c4a66fd4
DEV_REPO:=jupyter/pyspark-notebook-db-dev:a388c4a66fd4
PYTHON2_SETUP:=source activate python2

help:
@echo 'Host commands:'
@echo ' build - build dev image'
@echo ' clean - clean built files'
@echo ' dev - start notebook server in a container with source mounted'
@echo ' install - install latest sdist into a container'
@echo ' sdist - build a source distribution into dist/'
@echo ' test - run unit tests within a container'

build:
@-docker rm -f dev-build
@docker run -it --user jovyan --name dev-build \
$(REPO) bash -c 'pip install --no-binary :all: $(CMS_PACKAGE) $(DASHBOARDS_PACKAGE); \
$(PYTHON2_SETUP); \
pip install --no-binary :all: $(CMS_PACKAGE) $(DASHBOARDS_PACKAGE)'
@docker commit dev-build $(DEV_REPO)
@-docker rm -f dev-build

clean:
@-rm -rf dist
@-rm -rf *.egg-info
@-rm -rf __pycache__ */__pycache__ */*/__pycache__
@-find . -name '*.pyc' -exec rm -fv {} \;

dev: dev-$(PYTHON)

dev-python2: SETUP_CMD?=$(PYTHON2_SETUP); pushd /src && pip install --no-deps -e . && popd
dev-python2: _dev

dev-python3: SETUP_CMD?=pushd /src && pip install --no-deps -vvv -e . && popd
dev-python3: _dev

_dev: NB_HOME?=/root
_dev: CMD?=sh -c "python --version; jupyter notebook --no-browser --port 8888 --ip=0.0.0.0"
_dev: AUTORELOAD?=no
_dev:
@docker run -it --rm \
--user jovyan \
-p 9500:8888 \
-e AUTORELOAD=$(AUTORELOAD) \
-v `pwd`:/src \
$(DEV_REPO) bash -c '$(SETUP_CMD); $(CMD)'

install: CMD?=exit
install:
@docker run -it --rm \
--user jovyan \
-v `pwd`:/src \
$(REPO) bash -c 'cd /src/dist && \
pip install --no-binary :all: $$(ls -1 *.tar.gz | tail -n 1) && \
$(CMD)'

sdist: REPO?=jupyter/pyspark-notebook:$(TAG)
sdist:
@docker run -it --rm \
-v `pwd`:/src \
$(REPO) bash -c 'cp -r /src /tmp/src && \
cd /tmp/src && \
python setup.py sdist $(POST_SDIST) && \
cp -r dist /src'

test: test-$(PYTHON)

test-python2: SETUP_CMD?=$(PYTHON2_SETUP);
test-python2: _test

test-python3: _test

_test: CMD?=cd /src; python --version; python -B -m unittest discover -s test
_test:
# Need to use two commands here to allow for activation of multiple python versions
@docker run -it --rm \
-v `pwd`:/src \
$(DEV_REPO) bash -c '$(SETUP_CMD) $(CMD)'

release: POST_SDIST=register upload
release: sdist
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# dashboards_local_deploy
Converts a notebook to a dashboard and deploys it to the same Jupyter Notebook server
[![PyPI version](https://badge.fury.io/py/jupyter_dashboards_bundler.svg)](https://badge.fury.io/py/jupyter_dashboards) [![Google Group](https://img.shields.io/badge/-Google%20Group-lightgrey.svg)](https://groups.google.com/forum/#!forum/jupyter)

# Jupyter Dashboards Bundlers

Collection of reference implementation bundlers that convert, package, and deploy notebooks as standalone dashboards.

## What It Gives You

* *File → Deploy as → Local dashboard* menu item to deploy the current notebook as a dashboard within the same Jupyter Notebook server instance.

## Prerequisites

* Jupyter Notebook 4.0.x running on Python 3.x or Python 2.7.x
* jupyter_cms>=0.3.0
* Edge Chrome, Firefox, or Safari

## Install It

`pip install jupyter_dashboards_bundlers`

Restart your Notebook server if you did not have `jupyter_cms` previously installed.

## Use It

Currently, there is only one bundler available in this package. It converts your notebook to a web application and deploys it to your Jupyter Notebook server for local use. To use it:

1. Write a notebook.
2. Define a dashboard layout using the `jupyter_dashboards` extension.
3. Click *File → Deploy as → Local dashboard*.
4. Enjoy your dashboard after the redirect.
Empty file added dashboards_bundlers/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions dashboards_bundlers/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

version_info = (0, 1, 0, 'dev')
__version__ = '.'.join(map(str, version_info))
Loading

0 comments on commit 7d7d780

Please sign in to comment.