Skip to content

Commit

Permalink
Rewrites the installation guide
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Feb 24, 2023
1 parent 1272f29 commit 5019d0d
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# `rsconnect-jupyter` User Guide

The `rsconnect-jupyter` package is a _Jupyter Notebook_ extension (i.e., `nbextension`) that provides publishing compatiblity with [Posit Connect](https://docs.posit.co/rsc/#rstudio-connect).
The `rsconnect-jupyter` package is a _Jupyter Notebook_ extension (i.e., `nbextension`) that provides publishing compatibility with [Posit Connect](https://docs.posit.co/connect).

## Requirements

- [Python >=3.7](https://www.python.org/downloads/)
- [Jupyter](https://pypi.org/project/jupyter)
- [Posit Connect](https://www.posit.co/download/posit-connect/**) v1.7.0 or higher, configured with Python support
- [Notebook >=5,7](https://pypi.org/project/notebook/)
- [Posit Connect](https://www.posit.co/download/posit-connect/) v1.7.0 or higher, configured with Python support

!!! Warning
This extension is **NOT** compatible with _JupyterLab_. Only _Jupyter Notebooks_, and associated runtime enviornments, such as _JupyterHub_, are supported.
This extension is **NOT** compatible with _JupyterLab_. Only _Jupyter Notebooks_, and associated runtime environments, such as _JupyterHub_, are supported.

!!! Warning
In order to publish to _Posit Connect_, a compatible Python environment must in exist on the _Post Connect_ instance. See the _Posit Connect_ documentation on [Python integrations](https://docs.posit.co/rsc/integration/python/) for additional information.
In order to publish to _Posit Connect_, a compatible Python environment must in exist on the _Posit Connect_ instance. See the _Posit Connect_ documentation on [Python integrations](https://docs.posit.co/connect/admin/python/) for additional information.

## Installation

--8<-- "snippets/install.md"

## Runtime Environment Configuration
## Environment Configuration

### Localhost (Your Computer)

For localhost installation, a Python virtual environment is recommend to isolate runtime dependencies. There are various Python virtual environments avaiable. The following tutorial covers a few of them.
For localhost installation, a Python virtual environment is recommended to isolate runtime dependencies. There are various Python virtual environments available. The following tutorial covers a few of them.

#### Conda

Expand All @@ -38,47 +39,48 @@ conda install -c conda-forge jupyter rsconnect-jupyter
Next, following the [installation guide](#installation).

!!! Tip
When creating a _Conda_ virtual environment, a specific Python version may be specified. Create your virtual environment with a Python environment that is avaiable on your Posit Connect server.
When creating a _Conda_ virtual environment, a specific Python version may be specified. Create your virtual environment with a Python environment that is available on your Posit Connect server.

<div class="code-title">Terminal</div>
```shell
conda create --name rsconnect-jupyter python=3.8
```

#### Python Virtual Environment (virtualenv)
!!! Note

If _Anaconda_ is used, then _Jupyter Notebook_ launches with kernel environments for each existing Conda environment. Follow the [installation guide](#installation) for each kernel/Conda-environment to enable `rsconnect-jupyter`.

#### Python Virtual Environment ([venv](https://docs.python.org/3/library/venv.html))

<div class="code-title">Terminal</div>
```shell
python -m pip install virtualenv
python -m virtualenv .venv
python -m venv .venv
source .venv/bin/activate
```

Next, following the [installation guide](#installation).

!!! Tip
Running `source .venv/bin/activate` activates the virtual environment. While the `virtualenv` is active, Python-related commands like `python`, `pip`, and `jupyter` will use to copies located inside the virtual environment.

### Posit Workbench

See [Installing Python on Posit Workbench](https://docs.posit.co/rsw/integration/jupyter-standalone/#4-install-jupyter-notebooks-jupyterlab-and-python-packages).

Once you complete the installation instructions, please return to this document for additional information such as [Upgrading](upgrading) or [Usage](usage) instructions.
Running `source .venv/bin/activate` activates the virtual environment. While the virtual environment is active, the `.venv/bin` directory is prepended to the `$PATH` environment variable for the active shell. Therefore executables installed within the virtual environment, like `python`, `pip`, and `jupyter`, are utilized. To determine which version of `python`, `pip`, or `jupyter` is active, execute the `which` command (e.g, `which python`).

## JupyterHub
### JupyterHub

Follow the [installation guide](#installation) to install `rsconnect-jupyter` onto the _JupyterHub_ server.
Follow the [installation guide](#installation) to install and enable `rsconnect-jupyter` in _JupyterHub_.

If you've configured separate kernel environments, repeat the installation guide for each kernel environment.

!!! Note
The exact install location depends on your JupyterHub configuration.
The exact install location depends on your _JupyterHub_ configuration.

#### Quick Start Example

The following example shows how to launch a Docker container running _JupyterHub_ with the `rsconnect-jupyter` extension installed.

!!! example "Docker Example"
!!! Warning

This configuration is **NOT** intended for production usage. This is a minmal working configuration designed to highlight `rsconnect-jupyter` configuration.

!!! Example "Docker Example"

Create the following Dockerfile.

Expand Down Expand Up @@ -120,7 +122,7 @@ The following example shows how to launch a Docker container running _JupyterHub
docker run --rm -p 8000:8000 --name jupyterhub jupyterhub:rsconnect-jupyter
```

Once executed, a series of startup logs will be shown. Wait for the log message "JupyterHub is now running at http://:8000".
Once executed, a series of startup logs will be shown. Wait for the log message: `JupyterHub is now running at http://:8000`.

Once shown, the _JupyterHub_ server is running on your local machine. To access _JupyterHub_ procceed with the following steps:

Expand All @@ -131,4 +133,10 @@ The following example shows how to launch a Docker container running _JupyterHub

!!! Warning

At the time of writing, the `jupyterhub:jupyterhub:3` Docker image is built using Python version 3.10.6. Therefore, in order to publish to Posit Connect, a compatible Python version 3.10 environment must exist in Posit Connect.
At the time of writing, the `jupyterhub/jupyterhub:3` Docker image is built using Python version 3.10.6. Therefore, in order to publish to Posit Connect, a compatible Python version 3.10 environment must exist in Posit Connect.

### Posit Workbench

[Posit Workbench](https://docs.posit.co/ide/server-pro/) supports _Jupyter Notebook_ sessions. See the [Jupyter Configuration](https://docs.posit.co/ide/server-pro/jupyter-sessions/configuration.html) guide to configure _Jupyter Notebook_ sessions.

Once enabled, follow the [installation guide](#installation) to install and enable the `rsconnect-jupyter` plugin for each Jupyter kernel.

0 comments on commit 5019d0d

Please sign in to comment.