Jupyter: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
Jupyter Notebooks provide access to the Python programming language through a web browser interface. | Jupyter Notebooks provide access to the Python programming language through a web browser interface. | ||
==Setting up password-protected Jupyter notebook== | |||
If you just want a single-user password-protected Jupyter notebook, you can modify Jupyter's config file, <code>jupyter_notebook_config.py</code>, to contain a hashed password. Then, when you run it, Jupyter will load the configuration file and password-protect the notebook that it starts up. Here's how to do that: | |||
===Create config file=== | |||
Start by running a Jupyter command that will create a new, empty config file: | |||
<pre> | |||
$ jupyter notebook --generate-config | |||
</pre> | |||
The file it creates is called <code>jupyter_notebook_config.json</code>. Once you generate the hashed password, this is where you'll add it. | |||
===Generate hashed password=== | |||
You can generate a hashed password by interactively entering your password on the command line, live: | |||
<pre> | |||
$ jupyter notebook password | |||
Enter password: ******* | |||
Verify password: ******* | |||
[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json | |||
</pre> | |||
Alternatively, you can generate the hash yourself, or in a script, using components of Juypter notebook from a Python script: | |||
<pre> | |||
>>> from notebook.auth import passwd | |||
>>> passwd() | |||
Enter password: | |||
Verify password: | |||
'sha1:8c8fe60bb8b6:ccf9ede0825894254b2e042ea597d77107ee11abd' | |||
</pre> | |||
Revision as of 06:10, 19 April 2017
Jupyter Notebooks
(Also see: Ipython)
Jupyter Notebooks provide access to the Python programming language through a web browser interface.
Setting up password-protected Jupyter notebook
If you just want a single-user password-protected Jupyter notebook, you can modify Jupyter's config file, jupyter_notebook_config.py, to contain a hashed password. Then, when you run it, Jupyter will load the configuration file and password-protect the notebook that it starts up. Here's how to do that:
Create config file
Start by running a Jupyter command that will create a new, empty config file:
$ jupyter notebook --generate-config
The file it creates is called jupyter_notebook_config.json. Once you generate the hashed password, this is where you'll add it.
Generate hashed password
You can generate a hashed password by interactively entering your password on the command line, live:
$ jupyter notebook password Enter password: ******* Verify password: ******* [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
Alternatively, you can generate the hash yourself, or in a script, using components of Juypter notebook from a Python script:
>>> from notebook.auth import passwd >>> passwd() Enter password: Verify password: 'sha1:8c8fe60bb8b6:ccf9ede0825894254b2e042ea597d77107ee11abd'