Skip to main content

Dependency manager for Jupyter Notebooks

Project description

jupyter-nbrequirements  License

Dependabot Status Node CI   Release

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

NBRequirements UI

Since v0.4.0, we've introduced a new UI! Check it out, interact with it and see what it can offer you!

NBRequirements UI

Our development efforts will from now on focus primarily on improving the UI.

The old-school approach

The Jupyter magic is in sync with the UI, so don't worry old schoolers, you can still run the commands manually and the existing notebooks will work!

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-hypernode.com/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 the engine parameter, which can be set to pipenv

%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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter-nbrequirements-0.7.1.tar.gz (337.2 kB view details)

Uploaded Source

Built Distribution

jupyter_nbrequirements-0.7.1-py3-none-any.whl (669.1 kB view details)

Uploaded Python 3

File details

Details for the file jupyter-nbrequirements-0.7.1.tar.gz.

File metadata

  • Download URL: jupyter-nbrequirements-0.7.1.tar.gz
  • Upload date:
  • Size: 337.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

File hashes

Hashes for jupyter-nbrequirements-0.7.1.tar.gz
Algorithm Hash digest
SHA256 05b643eed145dcb7cc5cb1269469843acd5bd154a90bfa11fc072812f00c13c9
MD5 0185776faf93610351c19bd8c4183cbc
BLAKE2b-256 92acbaf6d94caadcbed3e85400bee593f367b0d4b874b0961cc102d668137b00

See more details on using hashes here.

File details

Details for the file jupyter_nbrequirements-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: jupyter_nbrequirements-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 669.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

File hashes

Hashes for jupyter_nbrequirements-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eddacf557543cd54735179e0da1f3b6436183ed61a549308c96f3bf8d9c48328
MD5 7f140f0bfffe0f2ccfb5a5310fa4bb64
BLAKE2b-256 10f44af1916b6c342ddc043d4ae13b9df5b65d56179dc38befe941fb62e34f55

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page