From 9ca7e2945d72da031afba2c9eb73f39eec367699 Mon Sep 17 00:00:00 2001 From: Jonathan Curran Date: Wed, 5 Dec 2018 15:22:36 -0700 Subject: [PATCH] Rename python package to rsconnect_jupyter (#139) --- .github/pull_request_template.md | 3 - CHANGELOG.md | 13 ++- Jenkinsfile | 8 +- MANIFEST.in | 6 +- Makefile | 26 ++--- README.md | 2 +- docs/Dockerfile | 2 +- docs/build-doc.sh | 4 +- docs/guide/README.md | 95 +++++++++++------- {rsconnect => rsconnect_jupyter}/__init__.py | 8 +- {rsconnect => rsconnect_jupyter}/api.py | 2 +- {rsconnect => rsconnect_jupyter}/bundle.py | 2 +- .../environment.py | 3 +- .../static/connect.js | 13 ++- .../static/images/publishDocWithSource.png | Bin .../static/images/publishDocWithSource_2x.png | Bin .../static/images/publishDocWithoutSource.png | Bin .../images/publishDocWithoutSource_2x.png | Bin .../static/index.js | 2 +- .../static/main.css | 0 .../tests/__init__.py | 0 .../tests/data/pip1/dummy.ipynb | 0 .../tests/data/pip1/requirements.txt | 0 .../tests/data/pip2/data.csv | 0 .../tests/data/pip2/dummy.ipynb | 0 .../tests/test_bundle.py | 6 +- .../tests/test_environment.py | 8 +- .../tests/test_integration.py | 0 run.sh | 4 +- selenium/Makefile | 2 +- selenium/README.md | 16 +-- selenium/t/test_switch_mode.py | 2 +- setup.py | 4 +- 33 files changed, 129 insertions(+), 102 deletions(-) rename {rsconnect => rsconnect_jupyter}/__init__.py (97%) rename {rsconnect => rsconnect_jupyter}/api.py (99%) rename {rsconnect => rsconnect_jupyter}/bundle.py (99%) rename {rsconnect => rsconnect_jupyter}/environment.py (97%) rename {rsconnect => rsconnect_jupyter}/static/connect.js (98%) rename {rsconnect => rsconnect_jupyter}/static/images/publishDocWithSource.png (100%) rename {rsconnect => rsconnect_jupyter}/static/images/publishDocWithSource_2x.png (100%) rename {rsconnect => rsconnect_jupyter}/static/images/publishDocWithoutSource.png (100%) rename {rsconnect => rsconnect_jupyter}/static/images/publishDocWithoutSource_2x.png (100%) rename {rsconnect => rsconnect_jupyter}/static/index.js (87%) rename {rsconnect => rsconnect_jupyter}/static/main.css (100%) rename {rsconnect => rsconnect_jupyter}/tests/__init__.py (100%) rename {rsconnect => rsconnect_jupyter}/tests/data/pip1/dummy.ipynb (100%) rename {rsconnect => rsconnect_jupyter}/tests/data/pip1/requirements.txt (100%) rename {rsconnect => rsconnect_jupyter}/tests/data/pip2/data.csv (100%) rename {rsconnect => rsconnect_jupyter}/tests/data/pip2/dummy.ipynb (100%) rename {rsconnect => rsconnect_jupyter}/tests/test_bundle.py (97%) rename {rsconnect => rsconnect_jupyter}/tests/test_environment.py (89%) rename {rsconnect => rsconnect_jupyter}/tests/test_integration.py (100%) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 34a72d13..fe3399e4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,4 @@ ### Description - - - Connected to # ### Testing Notes / Validation Steps diff --git a/CHANGELOG.md b/CHANGELOG.md index 81ac6a2e..edbf5708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ -# v1.0.0 +# v1.2.0 +- Renamed plugin from `rsconnect` to `rsconnect_jupyter` +- Publish notebooks with source allowing them to be rendered on RStudio Connect. + `pip` and `virtualenv` are used to determine dependent packages. + +# v1.0.1 +- Ensure json is decoded as utf-8 -- initial release -- publish notebooks as static documents +# v1.0.0 +- Initial release +- Publish notebooks as pre-rendered static documents diff --git a/Jenkinsfile b/Jenkinsfile index 15face08..7367903b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,10 +82,10 @@ def buildAndTest(pyVersion) { push: !isUserBranch ) - img.inside("-v ${env.WORKSPACE}:/rsconnect") { + img.inside("-v ${env.WORKSPACE}:/rsconnect_jupyter") { withEnv(["PY_VERSION=${pyVersion}"]) { print "running tests: python${pyVersion}" - sh '/rsconnect/run.sh test' + sh '/rsconnect_jupyter/run.sh test' } } return img @@ -136,7 +136,7 @@ try { 'python3.6': { img = buildAndTest("3.6") - img.inside("-v ${env.WORKSPACE}:/rsconnect") { + img.inside("-v ${env.WORKSPACE}:/rsconnect_jupyter") { print "building python wheel package" sh 'make dist' archiveArtifacts artifacts: 'dist/*.whl' @@ -155,7 +155,7 @@ try { docker_context: './docs', push: !isUserBranch ) - docs_image.inside("-v ${env.WORKSPACE}:/rsconnect") { + docs_image.inside("-v ${env.WORKSPACE}:/rsconnect_jupyter") { sh 'make docs-build' archiveArtifacts artifacts: 'dist/*.pdf,dist/*.html' stash includes: 'dist/*.pdf,dist/*.html', name: 'docs' diff --git a/MANIFEST.in b/MANIFEST.in index 8a0f101e..841ccdf9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include README.md -include rsconnect/static/*.js -include rsconnect/static/main.css -include rsconnect/static/images/*.png +include rsconnect_jupyter/static/*.js +include rsconnect_jupyter/static/main.css +include rsconnect_jupyter/static/images/*.png diff --git a/Makefile b/Makefile index 02911dfb..0885257b 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ IMAGE=rstudio/rsconnect-jupyter-py VERSION=$(shell cat version.txt).$(shell printenv BUILD_NUMBER || echo 9999) clean: - rm -rf build/ dist/ rsconnect.egg-info/ + rm -rf build/ dist/ rsconnect_jupyter.egg-info/ all-images: image2 image3.5 image3.6 image3.7 @@ -24,13 +24,13 @@ image%: launch: docker run --rm -i -t \ -v $(CURDIR)/notebooks$(PY_VERSION):/notebooks \ - -v $(CURDIR):/rsconnect \ + -v $(CURDIR):/rsconnect_jupyter \ -e NB_UID=$(NB_UID) \ -e NB_GID=$(NB_GID) \ -e PY_VERSION=$(PY_VERSION) \ -p :9999:9999 \ $(DOCKER_IMAGE) \ - /rsconnect/run.sh $(TARGET) + /rsconnect_jupyter/run.sh $(TARGET) notebook%: @@ -63,12 +63,12 @@ package: run: # link python package python setup.py develop -# install rsconnect as a jupyter extension - jupyter-nbextension install --symlink --user --py rsconnect +# install rsconnect_jupyter as a jupyter extension + jupyter-nbextension install --symlink --user --py rsconnect_jupyter # enable js extension - jupyter-nbextension enable --py rsconnect + jupyter-nbextension enable --py rsconnect_jupyter # enable python extension - jupyter-serverextension enable --py rsconnect + jupyter-serverextension enable --py rsconnect_jupyter # start notebook jupyter-notebook -y --notebook-dir=/notebooks --ip='0.0.0.0' --port=9999 --no-browser --NotebookApp.token='' @@ -82,10 +82,10 @@ dist-run%: make DOCKER_IMAGE=$(IMAGE)$* PY_VERSION=$* TARGET=dist-run launch dist-run: dist - pip install dist/rsconnect-$(VERSION)-py2.py3-none-any.whl - jupyter-nbextension install --symlink --user --py rsconnect - jupyter-nbextension enable --py rsconnect - jupyter-serverextension enable --py rsconnect + pip install dist/rsconnect_jupyter-$(VERSION)-py2.py3-none-any.whl + jupyter-nbextension install --symlink --user --py rsconnect_jupyter + jupyter-nbextension enable --py rsconnect_jupyter + jupyter-serverextension enable --py rsconnect_jupyter jupyter-notebook -y --notebook-dir=/notebooks --ip='0.0.0.0' --port=9999 --no-browser --NotebookApp.token='' build/mock-connect/bin/flask: @@ -115,8 +115,8 @@ ifeq (${JOB_NAME},) BUILD_DOC=docker run --rm=true ${DOCKER_RUN_AS} \ -e VERSION=${VERSION} \ ${DOCKER_ARGS} \ - -v $(CURDIR):/rsconnect \ - -w /rsconnect \ + -v $(CURDIR):/rsconnect_jupyter \ + -w /rsconnect_jupyter \ rsconnect-jupyter-docs docs/build-doc.sh endif diff --git a/README.md b/README.md index 3dafcc1a..89394645 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Installation and usage instructions are available [here](https://github.com/rstudio/rsconnect-jupyter/tree/master/docs). -# Developing `rsconnect` +# Developing `rsconnect-jupyter` Need to run this after checkout and when modifying the docker images diff --git a/docs/Dockerfile b/docs/Dockerfile index e85a167e..9f41af29 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -78,4 +78,4 @@ RUN export PANDOC_VERSION=2.1.3 && \ gzip -d pandoc.gz pandoc-citeproc.gz && \ chmod 0755 pandoc pandoc-citeproc -WORKDIR /rsconnect +WORKDIR /rsconnect_jupyter diff --git a/docs/build-doc.sh b/docs/build-doc.sh index 7422b344..9cdacc83 100755 --- a/docs/build-doc.sh +++ b/docs/build-doc.sh @@ -10,10 +10,10 @@ sed s/RSCONNECT_VERSION/${VERSION}/g < README.md > ../../build/docs-README.md pandoc -f markdown-implicit_figures \ --self-contained \ - -o ${OUT}/rsconnect-jupyter-${VERSION}.html \ + -o ${OUT}/rsconnect_jupyter-${VERSION}.html \ -H style.css \ ../../build/docs-README.md pandoc -f markdown-implicit_figures \ - -o ${OUT}/rsconnect-jupyter-${VERSION}.pdf \ + -o ${OUT}/rsconnect_jupyter-${VERSION}.pdf \ ../../build/docs-README.md diff --git a/docs/guide/README.md b/docs/guide/README.md index 2151606c..5ec16bdf 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,7 +1,7 @@ --- -title: rsconnect User Guide +title: rsconnect-jupyter User Guide --- -[rsconnect](https://www.github.com/rstudio/rsconnect-jupyter/) is a +[rsconnect-jupyter](https://www.github.com/rstudio/rsconnect-jupyter/) is a plugin for [Jupyter Notebook](https://jupyter.org/) that enables publishing notebooks to [RStudio Connect](https://www.rstudio.com/products/connect/). @@ -17,11 +17,12 @@ If using `conda`, `pip` and `wheel` should already be installed. # Installation -Download the `rsconnect` python package from -[https://s3.amazonaws.com/rstudio-rsconnect-jupyter/rsconnect-RSCONNECT_VERSION-py2.py3-none-any.whl](https://s3.amazonaws.com/rstudio-rsconnect-jupyter/rsconnect-RSCONNECT_VERSION-py2.py3-none-any.whl) +Download the `rsconnect-jupyter` python package from +[https://s3.amazonaws.com/rstudio-rsconnect-jupyter/rsconnect_jupyter-RSCONNECT_VERSION-py2.py3-none-any.whl](https://s3.amazonaws.com/rstudio-rsconnect-jupyter/rsconnect_jupyter-RSCONNECT_VERSION-py2.py3-none-any.whl) (packaged as a [wheel](https://pythonwheels.com/) file). -If you are installing `rsconnect` for use in Jupyterhub, please see the [Jupyterhub](#Installation-In-Jupyterhub) section below. +If you are installing `rsconnect-jupyter` for use in Jupyterhub, please see the +[Jupyterhub](#Installation-In-Jupyterhub) section below. We recommend working within a `virtualenv`. If you are unfamiliar, these commands create and activate a `virtualenv` @@ -33,52 +34,52 @@ virtualenv /my/path source /my/path/bin/activate ``` -Install the `rsconnect` package with the following command: +Install the `rsconnect-jupyter` package with the following command: ```bash -pip install rsconnect-RSCONNECT_VERSION-py2.py3-none-any.whl +pip install rsconnect_jupyter-RSCONNECT_VERSION-py2.py3-none-any.whl ``` -Enable the `rsconnect` extension with the following commands: +Enable the `rsconnect-jupyter` extension with the following commands: ```bash -# Install `rsconnect` as a jupyter extension -jupyter-nbextension install --sys-prefix --py rsconnect +# Install `rsconnect-jupyter` as a jupyter extension +jupyter-nbextension install --sys-prefix --py rsconnect_jupyter # Enable JavaScript extension -jupyter-nbextension enable --sys-prefix --py rsconnect +jupyter-nbextension enable --sys-prefix --py rsconnect_jupyter # Enable Python extension -jupyter-serverextension enable --sys-prefix --py rsconnect +jupyter-serverextension enable --sys-prefix --py rsconnect_jupyter ``` Note: The above commands only need to be run once when installing -`rsconnect`. +`rsconnect_jupyter`. Note: If you run into an issue during installation please let us know by filing a bug [here](https://github.com/rstudio/rsconnect-jupyter/issues). # Uninstalling -First disable and remove the `rsconnect` notebook extension: +First disable and remove the `rsconnect-jupyter` notebook extension: ```bash -# Disable Python extensions found in `rsconnect` -jupyter-serverextension disable --sys-prefix --py rsconnect +# Disable Python extensions found in `rsconnect-jupyter` +jupyter-serverextension disable --sys-prefix --py rsconnect_jupyter # Remove JavaScript extension -jupyter-nbextension uninstall --sys-prefix --py rsconnect +jupyter-nbextension uninstall --sys-prefix --py rsconnect_jupyter ``` -Finally, uninstall the `rsconnect` python package: +Finally, uninstall the `rsconnect-jupyter` python package: ```bash -pip uninstall rsconnect +pip uninstall rsconnect_jupyter ``` # Upgrading -To upgrade `rsconnect`, first uninstall the extension and then +To upgrade `rsconnect-jupyter`, first uninstall the extension and then re-install it. # Usage @@ -113,11 +114,23 @@ If you select "Publish document with source code", the notebook file and a list #### Environment detection with pip -The list of packages sent along with the notebook comes from the python environment where the notebook kernel is running. In order for environment inspection to work, the `rsconnect` package must be installed in the kernel environment; that is, the environment where the `ipykernel` package is installed. In most cases that will be the same as the notebook server environment where `jupyter` is installed. +The list of packages sent along with the notebook comes from the python +environment where the notebook kernel is running. In order for environment +inspection to work, the `rsconnect-jupyter` package must be installed in the +kernel environment; that is, the environment where the `ipykernel` package is +installed. In most cases that will be the same as the notebook server +environment where `jupyter` is installed. -If there is a `requirements.txt` file in the same directory as the notebook file, its contents will be used. This allows you to directly control which packages will be installed on the RStudio Connect server before the notebook is rendered. If you use this option, you must ensure that all necessary packages are listed in the `requirements.txt` file. +If there is a `requirements.txt` file in the same directory as the notebook +file, its contents will be used. This allows you to directly control which +packages will be installed on the RStudio Connect server before the notebook is +rendered. If you use this option, you must ensure that all necessary packages +are listed in the `requirements.txt` file. -If there isn't a requirements file, the command `pip freeze` will be used to inspect the environment. The output of `pip freeze` lists all packages currently installed, as well as their versions, which enables RStudio Connect to recreate the same environment. +If there isn't a requirements file, the command `pip freeze` will be used to +inspect the environment. The output of `pip freeze` lists all packages currently +installed, as well as their versions, which enables RStudio Connect to recreate +the same environment. ### Handling conflicts @@ -148,16 +161,23 @@ You may share notebooks if appropriate. # Installation in JupyterHub -In JupyterHub, follow the directions [above](#Installation) to install the `rsconnect` package into the Python environment where the Jupyter notebook server and kernel are installed. Typically those will be the same environment. If you've configured separate kernel environments, install the `rsconnect` package in the notebook server environment as well as each kernel environment. +In JupyterHub, follow the directions [above](#Installation) to install the +`rsconnect-jupyter` package into the Python environment where the Jupyter +notebook server and kernel are installed. Typically those will be the same +environment. If you've configured separate kernel environments, install the +`rsconnect-jupyter` package in the notebook server environment as well as each +kernel environment. The exact install location depends on your Jupyterhub configuration. ## JupyterHub Example Configuration -This section presents a simple working example of a Jupyterhub configuration with `rsconnect` installed. +This section presents a simple working example of a Jupyterhub configuration +with `rsconnect-jupyter` installed. -This example uses Docker, but you can install the `rsconnect` package in any Jupyterhub installation. Docker is not required. +This example uses Docker, but you can install the `rsconnect-jupyter` package in +any Jupyterhub installation. Docker is not required. Example Dockerfile: @@ -167,17 +187,17 @@ FROM jupyterhub/jupyterhub:0.9.4 # Install Jupyter notebook into the existing base conda environment RUN conda install notebook -# Download and install rsconnect in the same environment -# Update this to specify the desired version of the rsconnect package, +# Download and install rsconnect-jupyter in the same environment +# Update this to specify the desired version of the rsconnect-jupyter package, # or pass `--build-arg VERSION=...` to docker build. ARG VERSION=RSCONNECT_VERSION ARG REPOSITORY=https://s3.amazonaws.com/rstudio-rsconnect-jupyter -RUN wget ${REPOSITORY}/rsconnect-${VERSION}-py2.py3-none-any.whl -RUN pip install rsconnect-${VERSION}-py2.py3-none-any.whl && \ - jupyter-nbextension install --sys-prefix --py rsconnect && \ - jupyter-nbextension enable --sys-prefix --py rsconnect && \ - jupyter-serverextension enable --sys-prefix --py rsconnect +RUN wget ${REPOSITORY}/rsconnect_jupyter-${VERSION}-py2.py3-none-any.whl +RUN pip install rsconnect_jupyter-${VERSION}-py2.py3-none-any.whl && \ + jupyter-nbextension install --sys-prefix --py rsconnect_jupyter && \ + jupyter-nbextension enable --sys-prefix --py rsconnect_jupyter && \ + jupyter-serverextension enable --sys-prefix --py rsconnect_jupyter # create test users RUN useradd -m -s /bin/bash user1 && \ @@ -192,8 +212,11 @@ CMD ["jupyterhub"] Run these commands to build and start the container: ```bash -docker build -t jupyterhub:rsconnect . -docker run --rm -p 8000:8000 --name jupyterhub jupyterhub:rsconnect +docker build -t jupyterhub:rsconnect-jupyter . +docker run --rm -p 8000:8000 --name jupyterhub jupyterhub:rsconnect-jupyter ``` -Connect to Jupyterhub on http://localhost:8000 and log in as one of the test users. From there, you can create a notebook and publish it to RStudio Connect. Note that the current Jupyterhub docker image uses Python 3.6.5, so you will need a compatible Python version installed on your RStudio Connect server. +Connect to Jupyterhub on http://localhost:8000 and log in as one of the test +users. From there, you can create a notebook and publish it to RStudio Connect. +Note that the current Jupyterhub docker image uses Python 3.6.5, so you will +need a compatible Python version installed on your RStudio Connect server. diff --git a/rsconnect/__init__.py b/rsconnect_jupyter/__init__.py similarity index 97% rename from rsconnect/__init__.py rename to rsconnect_jupyter/__init__.py index 584bed75..bc8170f8 100644 --- a/rsconnect/__init__.py +++ b/rsconnect_jupyter/__init__.py @@ -16,7 +16,7 @@ def _jupyter_server_extension_paths(): return [{ - "module": "rsconnect" + "module": "rsconnect_jupyter" }] @@ -27,9 +27,9 @@ def _jupyter_nbextension_paths(): # the path is relative to the `rsconnect` directory src="static", # directory in the `nbextension/` namespace - dest="rsconnect", + dest="rsconnect_jupyter", # _also_ in the `nbextension/` namespace - require="rsconnect/index")] + require="rsconnect_jupyter/index")] def md5(s): @@ -161,7 +161,7 @@ def post(self, action): def load_jupyter_server_extension(nb_app): - nb_app.log.info("rsconnect enabled!") + nb_app.log.info("rsconnect_jupyter enabled!") web_app = nb_app.web_app host_pattern = '.*$' action_pattern = r'(?P\w+)' diff --git a/rsconnect/api.py b/rsconnect_jupyter/api.py similarity index 99% rename from rsconnect/api.py rename to rsconnect_jupyter/api.py index bfee7f81..67a3715b 100644 --- a/rsconnect/api.py +++ b/rsconnect_jupyter/api.py @@ -23,7 +23,7 @@ def __init__(self, message): from notebook.utils import url_path_join -logger = logging.getLogger('rsconnect') +logger = logging.getLogger('rsconnect_jupyter') logger.setLevel(logging.INFO) diff --git a/rsconnect/bundle.py b/rsconnect_jupyter/bundle.py similarity index 99% rename from rsconnect/bundle.py rename to rsconnect_jupyter/bundle.py index d2582127..d048deae 100644 --- a/rsconnect/bundle.py +++ b/rsconnect_jupyter/bundle.py @@ -12,7 +12,7 @@ import nbformat from ipython_genutils import text -log = logging.getLogger('rsconnect') +log = logging.getLogger('rsconnect_jupyter') log.setLevel(logging.DEBUG) diff --git a/rsconnect/environment.py b/rsconnect_jupyter/environment.py similarity index 97% rename from rsconnect/environment.py rename to rsconnect_jupyter/environment.py index 5eab5fbf..35618070 100644 --- a/rsconnect/environment.py +++ b/rsconnect_jupyter/environment.py @@ -81,8 +81,9 @@ def output_file(dirname, filename, package_manager): with open(path, 'r') as f: data = f.read() + # TODO TODO TODO TODO data = '\n'.join([line for line in data.split('\n') - if 'rsconnect-jupyter' not in line]) + if 'rsconnect_jupyter' not in line]) return { 'filename': filename, diff --git a/rsconnect/static/connect.js b/rsconnect_jupyter/static/connect.js similarity index 98% rename from rsconnect/static/connect.js rename to rsconnect_jupyter/static/connect.js index 14182b77..ca25d787 100644 --- a/rsconnect/static/connect.js +++ b/rsconnect_jupyter/static/connect.js @@ -21,7 +21,7 @@ define([ function init() { // construct notification widget - notify = Jupyter.notification_area.widget("rsconnect"); + notify = Jupyter.notification_area.widget("rsconnect_jupyter"); // create an action that can be invoked from many places (e.g. command // palette, button click, keyboard shortcut, etc.) @@ -33,7 +33,7 @@ define([ handler: debounce(1000, onPublishClicked) }, "publish", - "rsconnect" + "rsconnect_jupyter" ); // add a button that invokes the action @@ -251,8 +251,7 @@ define([ var path = Jupyter.notebook.notebook_name; try { - // cannot assume rsconnect is installed in the kernel environment - var cmd = ["!", Jupyter.notebook.kernel_selector.kernelspecs[Jupyter.notebook.kernel.name].spec.argv[0], " -m rsconnect.environment ${PWD}/", path].join(""); + var cmd = ["!", Jupyter.notebook.kernel_selector.kernelspecs[Jupyter.notebook.kernel.name].spec.argv[0], " -m rsconnect_jupyter.environment ${PWD}/", path].join(""); console.log("executing: " + cmd); } catch (e) { return $.Deferred().reject(e); @@ -764,12 +763,12 @@ define([ " ", '
', ' ', - ' ', + ' ', ' Publish document with source code
', ' Choose this option if you want to create a scheduled report or rebuild your document on the server', "
", ' ', - ' ', + ' ', ' Publish finished document only
', ' Choose this option to publish a snapshot of the notebook as it appears in Jupyter', "
", @@ -1231,7 +1230,7 @@ define([ // unlikely but possible if we aren't able to save debug.error("Failed to save notebook:", err); Dialog.modal({ - title: "rsconnect-jupyter", + title: "rsconnect_jupyter", body: "Failed to save this notebook. Error: " + err, buttons: { Ok: { class: "btn-primary" } } }); diff --git a/rsconnect/static/images/publishDocWithSource.png b/rsconnect_jupyter/static/images/publishDocWithSource.png similarity index 100% rename from rsconnect/static/images/publishDocWithSource.png rename to rsconnect_jupyter/static/images/publishDocWithSource.png diff --git a/rsconnect/static/images/publishDocWithSource_2x.png b/rsconnect_jupyter/static/images/publishDocWithSource_2x.png similarity index 100% rename from rsconnect/static/images/publishDocWithSource_2x.png rename to rsconnect_jupyter/static/images/publishDocWithSource_2x.png diff --git a/rsconnect/static/images/publishDocWithoutSource.png b/rsconnect_jupyter/static/images/publishDocWithoutSource.png similarity index 100% rename from rsconnect/static/images/publishDocWithoutSource.png rename to rsconnect_jupyter/static/images/publishDocWithoutSource.png diff --git a/rsconnect/static/images/publishDocWithoutSource_2x.png b/rsconnect_jupyter/static/images/publishDocWithoutSource_2x.png similarity index 100% rename from rsconnect/static/images/publishDocWithoutSource_2x.png rename to rsconnect_jupyter/static/images/publishDocWithoutSource_2x.png diff --git a/rsconnect/static/index.js b/rsconnect_jupyter/static/index.js similarity index 87% rename from rsconnect/static/index.js rename to rsconnect_jupyter/static/index.js index 9ffe2896..bb83f408 100644 --- a/rsconnect/static/index.js +++ b/rsconnect_jupyter/static/index.js @@ -10,7 +10,7 @@ define([ // add custom css $("") .attr({ - href: requirejs.toUrl("nbextensions/rsconnect/main.css"), + href: requirejs.toUrl("nbextensions/rsconnect_jupyter/main.css"), rel: "stylesheet", type: "text/css" }) diff --git a/rsconnect/static/main.css b/rsconnect_jupyter/static/main.css similarity index 100% rename from rsconnect/static/main.css rename to rsconnect_jupyter/static/main.css diff --git a/rsconnect/tests/__init__.py b/rsconnect_jupyter/tests/__init__.py similarity index 100% rename from rsconnect/tests/__init__.py rename to rsconnect_jupyter/tests/__init__.py diff --git a/rsconnect/tests/data/pip1/dummy.ipynb b/rsconnect_jupyter/tests/data/pip1/dummy.ipynb similarity index 100% rename from rsconnect/tests/data/pip1/dummy.ipynb rename to rsconnect_jupyter/tests/data/pip1/dummy.ipynb diff --git a/rsconnect/tests/data/pip1/requirements.txt b/rsconnect_jupyter/tests/data/pip1/requirements.txt similarity index 100% rename from rsconnect/tests/data/pip1/requirements.txt rename to rsconnect_jupyter/tests/data/pip1/requirements.txt diff --git a/rsconnect/tests/data/pip2/data.csv b/rsconnect_jupyter/tests/data/pip2/data.csv similarity index 100% rename from rsconnect/tests/data/pip2/data.csv rename to rsconnect_jupyter/tests/data/pip2/data.csv diff --git a/rsconnect/tests/data/pip2/dummy.ipynb b/rsconnect_jupyter/tests/data/pip2/dummy.ipynb similarity index 100% rename from rsconnect/tests/data/pip2/dummy.ipynb rename to rsconnect_jupyter/tests/data/pip2/dummy.ipynb diff --git a/rsconnect/tests/test_bundle.py b/rsconnect_jupyter/tests/test_bundle.py similarity index 97% rename from rsconnect/tests/test_bundle.py rename to rsconnect_jupyter/tests/test_bundle.py index 43f1bd3b..015068cd 100644 --- a/rsconnect/tests/test_bundle.py +++ b/rsconnect_jupyter/tests/test_bundle.py @@ -11,8 +11,8 @@ import nbformat -from rsconnect.environment import detect_environment -from rsconnect.bundle import make_html_bundle, make_source_bundle +from rsconnect_jupyter.environment import detect_environment +from rsconnect_jupyter.bundle import make_html_bundle, make_source_bundle class TestBundle(TestCase): @@ -179,7 +179,7 @@ def do_test_html_bundle(self, dir): 'open_browser': False, 'token': '', 'nbserver_extensions': { - 'rsconnect': True + 'rsconnect_jupyter': True } } } diff --git a/rsconnect/tests/test_environment.py b/rsconnect_jupyter/tests/test_environment.py similarity index 89% rename from rsconnect/tests/test_environment.py rename to rsconnect_jupyter/tests/test_environment.py index 3d1b1600..97a38c77 100644 --- a/rsconnect/tests/test_environment.py +++ b/rsconnect_jupyter/tests/test_environment.py @@ -4,7 +4,7 @@ from unittest import TestCase from os.path import dirname, exists, join -from rsconnect.environment import detect_environment +from rsconnect_jupyter.environment import detect_environment version_re = re.compile(r'\d+\.\d+(\.\d+)?') @@ -28,9 +28,9 @@ def test_file(self): self.assertIn('.', locale) self.assertEqual(result, { - 'package_manager': 'pip', + 'package_manager': 'pip', 'source': 'file', - 'filename': 'requirements.txt', + 'filename': 'requirements.txt', 'contents': 'numpy\npandas\nmatplotlib\n', 'python': self.python_version(), }) @@ -51,7 +51,7 @@ def test_pip_freeze(self): self.assertIn('.', locale) self.assertEqual(result, { - 'package_manager': 'pip', + 'package_manager': 'pip', 'source': 'pip_freeze', 'filename': 'requirements.txt', 'python': self.python_version(), diff --git a/rsconnect/tests/test_integration.py b/rsconnect_jupyter/tests/test_integration.py similarity index 100% rename from rsconnect/tests/test_integration.py rename to rsconnect_jupyter/tests/test_integration.py diff --git a/run.sh b/run.sh index bb057d56..c39c782e 100755 --- a/run.sh +++ b/run.sh @@ -9,7 +9,7 @@ then exit $? fi -cd /rsconnect +cd /rsconnect_jupyter export PATH=/opt/conda/bin:$PATH source activate "py${PY_VERSION/./}" -make -f /rsconnect/Makefile $1 +make -f /rsconnect_jupyter/Makefile $1 diff --git a/selenium/Makefile b/selenium/Makefile index 6f45b18f..1654f741 100644 --- a/selenium/Makefile +++ b/selenium/Makefile @@ -28,7 +28,7 @@ PYTESTLOG?=selenium_tests.log PYTESTOPTS?= RERUN_FAILURES?=0 RESULT_XML?=result.xml -RSCONNECT_DIR=/rsconnect +RSCONNECT_DIR=/rsconnect_jupyter SCALE=1 SCALE_FIREFOX=${SCALE} SCALE_CHROME=${SCALE} diff --git a/selenium/README.md b/selenium/README.md index 30a23c98..0147b1a7 100644 --- a/selenium/README.md +++ b/selenium/README.md @@ -7,7 +7,7 @@ You'll need the following commands available on your system to run the test case * coreutils (id, rm, cd, cat, printf, ...) * docker * docker-compose - * git + * git * make * python 2.7+ * vncviewer (macosx users can launch vnc from spotlight, or the ```open``` @@ -234,7 +234,7 @@ from t.pages.publish_content_form import PublishContentForm # set the directory paths for where data files and jupyter notebooks -data_dir = "/rsconnect/selenium/data" +data_dir = "/rsconnect_jupyter/selenium/data" notebooks_dir = "/notebooks" # copy the template notbook to a new notebooks directory @@ -497,7 +497,7 @@ Default Value: `${RSCONNECT_DIR}/selenium` Example usage: ``` -make test LOGS_DIR=/rsconnect/selenium +make test LOGS_DIR=/rsconnect_jupyter/selenium ``` ##### NB_UID @@ -626,16 +626,16 @@ make test RESULT_XML=result.xml ##### RSCONNECT_DIR -Name of the directory that the rsconnect-jupyter directory, on the host +Name of the directory that the rsconnect_jupyter directory, on the host machine, will be mounted to, in the Docker container. -Default Value:`/rsconnect` +Default Value:`/rsconnect_jupyter` Example usage: ``` -make test-env-up RSCONNECT_DIR=/rsconnect -make jupyter-up RSCONNECT_DIR=/rsconnect -make test RSCONNECT_DIR=/rsconnect +make test-env-up RSCONNECT_DIR=/rsconnect_jupyter +make jupyter-up RSCONNECT_DIR=/rsconnect_jupyter +make test RSCONNECT_DIR=/rsconnect_jupyter ``` ##### SCALE diff --git a/selenium/t/test_switch_mode.py b/selenium/t/test_switch_mode.py index ffea0c05..f4213a8a 100644 --- a/selenium/t/test_switch_mode.py +++ b/selenium/t/test_switch_mode.py @@ -58,4 +58,4 @@ def test_switch_mode(self, connect_url): pf.publish_with_source.click() pf.submit.click() - pf.title_error.should(have.text('Failed to publish. Cannot change app mode once deployed')) + pf.title_error.should(have.text('Cannot change app mode once deployed')) diff --git a/setup.py b/setup.py index 8c08b5ce..6c01c4a3 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def readme(): BUILD = os.environ.get('BUILD_NUMBER', '9999') -setup(name='rsconnect', +setup(name='rsconnect_jupyter', version='{version}.{build}'.format(version=VERSION, build=BUILD), description='Jupyter Notebook integration with RStudio Connect', long_description=readme(), @@ -30,7 +30,7 @@ def readme(): author='Jonathan Curran', author_email='jonathan.curran@rstudio.com', license='GPL-2.0', - packages=['rsconnect'], + packages=['rsconnect_jupyter'], install_requires=[ 'notebook', 'nbformat',