The pants-jupyter-plugin project provides a Jupyter plugin that can be used to load Pants targets directly into a notebook.
Jupyter plugins are typically installed using
pip directly alongside Jupyter (Lab) itself.
If you don't already have Jupyter set up somewhere, create a virtualenv for it, and then install and start it by running:
# Install jupyter and the plugin (NB: please use a virtualenv!) pip install jupyter-lab pants-jupyter-plugin # Launch JupyterLab, which will open a browser window for notebook editing. jupyter lab
For instructions on using the plugin, see its README.
An example session that loads a target from the example-python repository might look like:
Updated about a month ago