Skip to main content

Poetry plugin to manage Jupyter kernels

Project description

📦 poetry-jupyter-plugin

overview

This is a really simple plugin to allow you to install your Poetry virtual environment as a Jupyter kernel. You may wish to do this to keep your dependencies locked down for reproducible notebooks, or to set up a single "data science" notebook for one-off calculations without fiddling about with installing packages globally or dealing with ipykernel directly.

asciicast

getting started

Install the plugin with:

$ poetry self add poetry-jupyter-plugin

Then, from within your poetry project:

$ poetry add ipykernel -G dev
$ poetry jupyter install

Remove the kernelspec with:

$ poetry jupyter remove

configuration

By default, the installed kernel will use the name of the project and a default Poetry icon. To configure these options, add this block to your pyproject.toml:

[tool.jupyter.kernel]
name = "my-cool-kernel"
display = "My cool kernel"
icon = "/path/to/icon.png"

prior art

There are other projects in this space, notably Pathbird's [poetry-kernel]. poetry-kernel installs a single kernelspec globally which then patches the virtualenv based on the specific project folder that you're running Jupyter in. This has some pros and cons over this project.

Pros:

  1. Single kernelspec, avoiding polluting the kernelspec list with lots of specs.
  2. Easy context switching between projects.

Cons:

  1. Notebooks have to be in the same folder (or a subfolder from) as the pyproject.toml folder.
  2. Requires forwarding signals from the launcher into Jupyter, introducing a layer of complexity and is brittle to changes in Jupyter protocol/underlying OS.
  3. Implicit dependency on ipykernel, and may fail to start without it.

In contrast, this project installs one kernelspec per virtualenv and leaves it up to Jupyter to launch the kernel normally without interception. This design decision also allows multiple projects to be based out of one kernel. Additionally, the tool checks for the existence of ipykernel to make sure that the kernel can be installed properly.

who?

This was written by patrick kage.

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

poetry_jupyter_plugin-0.2.2.tar.gz (119.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_jupyter_plugin-0.2.2-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

Details for the file poetry_jupyter_plugin-0.2.2.tar.gz.

File metadata

  • Download URL: poetry_jupyter_plugin-0.2.2.tar.gz
  • Upload date:
  • Size: 119.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.4 Darwin/24.1.0

File hashes

Hashes for poetry_jupyter_plugin-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2266c96d5df294eeb1dce10469c4a23d191d8e24922c0c8d7c79064c8e3f4349
MD5 792392791b22c55d405281fd83ea9c77
BLAKE2b-256 cbe5cd8c425e82e251852094f8aa916f7de766c561ddf8e8ac7273703a65d883

See more details on using hashes here.

File details

Details for the file poetry_jupyter_plugin-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_jupyter_plugin-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 27aaed58f6ee1dc21c42491c8975cb27eb6abf9b7b310856ddb8ae23434f2561
MD5 7e1892635a73f6483e777819034b4c9f
BLAKE2b-256 2f71b636ab526db7910570e0d5e0c8a213dd76a44b924d5672ca640ce23dcec6

See more details on using hashes here.

Supported by

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