Dependency manager for Jupyter Notebooks
Project description
jupyter-nbrequirements
Dependency management and optimization in Jupyter Notebooks.
About
This extension provides control over the notebook dependencies.
The main goals of the project are the following:
- manage notebook requirements without leaving the notebook
- provide a unique and optimized* environment for each notebook
*The requirements are optimized using the Thoth resolution engine
Installation
pip install jupyter-nbrequirements
And enable the required extensions (might not be needed with the latest version, but to be sure..)
jupyter nbextension install --user --py jupyter_nbrequirements
Usage
Create the environment for the notebook to run in
Say we want to do an EDA, we will probably need pandas, a visualization library like plotly and some additional libraries to make our lives easier, like sklearn and pandas-profiling.
In a Jupyter notebook cell:
%dep add pandas --version ">=0.24.0"
%dep add plotly
%dep add sklearn
%dep add pandas-profiling
And perhaps our code would need some refactoring and linter checks later on, so let's add a dev
dependency.
%dep add --dev black
You can now check the requirements that your notebook has by issuing %requirements
(or %dep
, which is just an alias for it) command:
%requirements
[packages]
pandas = ">=0.24.0"
plotly = "*"
sklearn = "*"
pandas-profiling = "*"
[dev-packages]
black = "*"
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "3.6"
Up to this point, we've been working only with the metadata. In order to create the environment and actually install the dependencies, you run the %dep ensure
command (insipired by the golang's dep, for those familiar with Golang).
%dep ensure
Since this project is still under development and it uses the Thoth resolution engine to optimize the notebook dependencies (which is also still under development as well), in case something goes wrong,
ensure
accepts theengine
parameter, which can be set topipenv
%dep ensure --engine pipenv
Check out the examples for more info.
Future plans:
See the Project Board.
Author: Marek Cermak macermak@redhat.com, @AICoE - Project Thoth
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jupyter-nbrequirements-0.1.0rc0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8626019e2c48c50ebc83ccdb1481d4c9d2595b278ba95455dbb424df6bdde7c |
|
MD5 | ee2a90ceedcae462986333b1cbe7a261 |
|
BLAKE2b-256 | 4e232b651b9a235e4f6a268d80077ee0fea90e7cc4cb7fa6adbd035d7afc6474 |
Hashes for jupyter_nbrequirements-0.1.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c944e30a00cf0ddb6b73522c516af5a98f96b33943586cd0e4c4e825e2e939a2 |
|
MD5 | 44a003e3a4c295da3d2cd597d92dcb57 |
|
BLAKE2b-256 | d7682da64d7a8a9bf07d4e0657b8c06a2b86fb25f88874436a53d05098f72e52 |