Neptune Fetcher

0.23.0 · deprecated · verified Sun Apr 12

Neptune Fetcher was a Python library designed to efficiently retrieve experiment metadata, metrics, and logs from Neptune.ai projects, allowing users to query and organize data into Pandas DataFrames. It is currently at version 0.23.0, but the library is officially deprecated, with `neptune-query` being its recommended successor. Development is minimal, focusing on critical fixes and dependency updates, with no new features planned.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a Neptune project using `neptune-client` and then use `neptune-fetcher`'s `get_project` to fetch run data. It explicitly warns about the library's deprecation and recommends `neptune-query`.

import neptune
from neptune_fetcher import get_project
import os

# NOTE: This library is deprecated. Use `neptune-query` instead.
# Ensure NEPTUNE_API_TOKEN and NEPTUNE_PROJECT are set as environment variables

# Initialize a Neptune project session (from neptune-client)
project_name = os.environ.get('NEPTUNE_PROJECT', 'common/quick-start') # Replace with your project
project_api_token = os.environ.get('NEPTUNE_API_TOKEN', 'ANONYMOUS')

if project_api_token == 'ANONYMOUS':
    print("Warning: Using anonymous access. Please set NEPTUNE_API_TOKEN for full functionality.")

# The neptune.init_project call is from neptune-client, required to authenticate
neptune_project = neptune.init_project(
    project=project_name,
    api_token=project_api_token, 
    mode="read-only"
)

print(f"Initialized Neptune Project: {neptune_project.full_id}")

# Use neptune-fetcher to get the project handler
fetcher_project = get_project(project=neptune_project.full_id)

# Fetch runs data as a Pandas DataFrame
runs_df = fetcher_project.fetch_runs_df(columns=['sys/name', 'training/acc'], states=['succeeded'])

print(f"Fetched {len(runs_df)} runs.")
if not runs_df.empty:
    print(runs_df.head())

# Stop the Neptune project session
neptune_project.stop()

view raw JSON →