Setting up Neptune Fetcher
Install neptune-fetcher
:
pip install -U neptune-fetcher
Set your Neptune API token and project name as environment variables:
- Linux
- macOS
- Windows
- Jupyter Notebook
- Google Colab
In your .profile
or other shell initialization file, use the export
commands:
export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...ifQ=="
export NEPTUNE_PROJECT="workspace-name/project-name"
In your .profile
or other shell initialization file, use the export
commands:
export NEPTUNE_API_TOKEN="h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...ifQ=="
export NEPTUNE_PROJECT="workspace-name/project-name"
-
Open a terminal app, such as PowerShell or Command Prompt.
-
Paste the
setx
commands and press :setx NEPTUNE_API_TOKEN "h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...ifQ=="
setx NEPTUNE_PROJECT "workspace-name/project-name"
-
To activate the change, restart the terminal app.
Optionally, add the variable in Settings → Edit the system environment variables.
In notebooks for your personal use, set credentials with magic commands:
%env NEPTUNE_API_TOKEN=h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...ifQ==
%env NEPTUNE_PROJECT=workspace-name/project-name
In shared notebooks, it's more secure to use the os and getpass libraries:
import os
from getpass import getpass
os.environ["NEPTUNE_API_TOKEN"] = getpass("Enter your Neptune API token: ")
os.environ["NEPTUNE_PROJECT"] = "workspace-name/project-name"
Note that these don't persist when the notebook kernel is terminated. You must declare the variables again if you restart the notebook.
In Colab notebooks for your personal use, set credentials with magic commands:
%env NEPTUNE_API_TOKEN=h0dHBzOi8aHR0cHM.4kl0jvYh3Kb8...ifQ==
%env NEPTUNE_PROJECT=workspace-name/project-name
In shared Colab notebooks, it's more secure to use the os and getpass libraries:
import os
from getpass import getpass
os.environ["NEPTUNE_API_TOKEN"] = getpass("Enter your Neptune API token: ")
os.environ["NEPTUNE_PROJECT"] = "workspace-name/project-name"
Note that these don't persist when the notebook kernel is terminated. You must declare the variables again if you restart the notebook.
For help, see Get started.
To change the token or project, you can set the context directly in the code. This way, you can set the project for individual fetching calls or globally for your session.
To start using the API, import the alpha
module:
import neptune_fetcher.alpha as npt