Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Latest commit

 

History

History
72 lines (41 loc) · 3.2 KB

convert-notebook.md

File metadata and controls

72 lines (41 loc) · 3.2 KB

Bring your notebook and make it reproducible (Convert cells with pip commands automatically)

Let's say I have a notebook I was working on that uses pip in my cells and I want to make it reproducible.

  1. Let's open the notebook called make-notebook-reproducible, provided in notebooks folder.

    Start my notebook with pip cells

    NOTE: A warning from the jupyterlab-requirements extension will appear to tell users what should be used to handle dependencies.

    Start my notebook and warning
  2. Run cell with %horus check to check the status of your notebook:

    Horus check initial command

    As you can see, initially there are errors reported because no Pipfile or Pipfile.lock exist for this notebook.

  3. Run %horus convert, so that the extenstion can convert !pip install cells to commands that allow reproducibility.

    Horus convert command
  4. Run the converted cells to add the requirements to your notebook.

    NOTE: If you want to edit some dependencies, you can simply add them again with your specific requirements (%horus requirement --add).

  5. Run cell with %horus check to check the status of your notebook.

  6. Run %horus lock to lock dependencies using Thoth resolution engine.

    If you are interested in a specific recommendation from Thoth, add --recommendation-type <recommendation-type>, default is latest ("latest", "stable", "performance", "security").

    By default, Thoth will discover the runtime environment you are running on. If you want to receive a recommendation for a specific runtime environment, you can use the following flags:

    • --os-name
    • --os-version
    • --python-version

    You can also use %horus lock --pipenv if you want to lock dependencies with Pipenv resolution engine.

  7. Run cell with %horus check to check the status of your notebook or %horus show to show the content of your notebook.

    If you want to show a specific part of your dependencies information stored in the notebook metadata, you can use the following flags:

    • --pipfile
    • --pipfile-lock
    • --thoth-config (only if Thoth resolution engine was used)

Other cases

You can consider another use case for managing dependencies:

Next steps

Remove kernels