# Neptune + Jupyter Lab and Jupyter Notebook Integration
[![Build Status](https://travis-ci.org/neptune-ai/neptune-notebooks.svg?branch=master)](https://travis-ci.org/neptune-ai/neptune-notebooks)

Neptune is a tool for experiment tracking, model registry, data versioning, and live model monitoring. 

This Jupyter Notebooks extension lets you version, manage, and share notebook checkpoints in your projects.

## What will you get with this integration? 

* log and display notebook checkpoints either manually or automatically during model training
* connect notebook checkpoints with model training Runs in Neptune
* organize checkpoints with names and descriptions 
* browse checkpoints history across all Notebooks in the project
* compare Notebooks side-by-side, with diffs for source, markdown, output, and execution count cells
* share Notebook checkpoints or diffs with persistent links
* download Notebook checkpoints directly from the UI or Jupyter 

![image](https://user-images.githubusercontent.com/97611089/160645173-d42d4436-f309-4b51-b583-518ce19948f1.png)
*The Notebooks tab in the Neptune UI provides a table of all the Notebooks in the current project.*

Technically Neptune + Jupyter integration is implemented as a neptune-notebooks Python package which includes:
* Standard Jupyter extension - The extension is written in Javascript and is visible in the web-based Jupyter UI. 
* JupyterLab extension - The extension is written in Javascript and is visible in the web-based Jupyter UI.
* A very basic CLI (command line interface) for uploading notebooks.

## Resources

* [Documentation](https://docs.neptune.ai/integrations-and-supported-tools/ide-and-notebooks/jupyter-lab-and-jupyter-notebook)
* [Example notebook in the Neptune app](https://app.neptune.ai/neptune-ai/credit-default-prediction/n/exploring-application-table-ac75c237-1630-4109-b532-dd125badec0e/ca1df3be-b2e4-4b26-99d6-b7e98a3d4273)

## Example

```python
# On the command line, install the neptune-notebooks extension
pip install neptune-notebooks

# Enable the extension for Jupyter
jupyter nbextension enable --py neptune-notebooks


# Install the Neptune client
pip install neptune-client
```

In your Jupyter Notebook environment, some Neptune items appear in your toolbar.
1. Click the Neptune icon to connect with Neptune.
2. Click **Upload** to create a first notebook checkpoint in Neptune.
3. In the Jupyter notebook, import Neptune and start a run:

```python
import neptune.new as neptune
run = neptune.init(
    api_token="NEPTUNE_API_TOKEN",
    project="WORKSPACE_NAME/PROJECT_NAME"
)

# Log metadata
run["f1_score"] = 0.66

# Stop the run
run.stop()

# See notebook snapshots in Neptune under "Source code"
```

## Support

If you got stuck or simply want to talk to us, here are your options:

* Check our [FAQ page](https://docs.neptune.ai/getting-started/getting-help#frequently-asked-questions)
* You can submit bug reports, feature requests, or contributions directly to the repository.
* Chat! When in the Neptune application click on the blue message icon in the bottom-right corner and send a message. A real person will talk to you ASAP (typically very ASAP),
* You can just shoot us an email at support@neptune.ai


