Skip to main content

Neptune Query is a Python library for retrieving data from Neptune.

Project description

Neptune Query API

The neptune_query package is a read-only API for fetching metadata tracked with the Neptune logging client.

With the Query API, you can:

  • List experiments, runs, and attributes of a project.
  • Fetch experiment or run metadata as a data frame.
  • Define filters to fetch experiments, runs, and attributes that meet certain criteria.

Installation

pip install "neptune-query<2.0.0"

Set your Neptune API token and project name as environment variables:

export NEPTUNE_API_TOKEN="ApiTokenFromYourNeptuneProfile"
export NEPTUNE_PROJECT="workspace-name/project-name"

For help, see Query metadata: Setup in the Neptune documentation.

Note: You can also pass the project path to the project argument of any querying function.

Usage

import neptune_query as nq

Available functions:

  • download_files() – download files from the specified experiments.
  • fetch_experiments_table() – runs as rows and attributes as columns.
  • fetch_metrics() – series of float or int values, with steps as rows.
  • fetch_series() – for series of strings or histograms.
  • list_attributes() – all logged attributes of the target project's experiment runs.
  • list_experiments() – names of experiments in the target project.
  • set_api_token() – set the Neptune API token to use for the session.
  • (experimental) fetch_metric_buckets() – get summary values split by X-axis buckets.

For details, see the API reference.

To use the corresponding methods for runs, import the Runs API:

import neptune_query.runs as nq_runs

You can use these methods to target individual runs by ID instead of experiment runs by name.

Example 1: Fetch metric values

To fetch values at each step, use fetch_metrics().

  • To filter experiments to return, use the experiments parameter.
  • To specify attributes to include as columns, use the attributes parameter.
nq.fetch_metrics(
    experiments=["exp_dczjz"],
    attributes=r"metrics/val_.+_estimated$",
)
                  metrics/val_accuracy_estimated  metrics/val_loss_estimated
experiment  step
exp_dczjz    1.0                        0.432187                    0.823375
             2.0                        0.649685                    0.971732
             3.0                        0.760142                    0.154741
             4.0                        0.719508                    0.504652

Example 2: Fetch metadata as one row per run

To fetch experiment metadata from your project, use the fetch_experiments_table() function:

nq.fetch_experiments_table(
    experiments=r"^exp_",
    attributes=["metrics/train_accuracy", "metrics/train_loss", "learning_rate"],
)
            metrics/train_accuracy   metrics/train_loss   learning_rate
experiment
exp_ergwq                 0.278149             0.336344            0.01
exp_qgguv                 0.160260             0.790268            0.02
exp_hstrj                 0.365521             0.459901            0.01

For series attributes, the value of the last logged step is returned.

Documentation


License

This project is licensed under the Apache License Version 2.0. For details, see Apache License Version 2.0.

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

neptune_query-1.8.0.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

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

neptune_query-1.8.0-py3-none-any.whl (106.9 kB view details)

Uploaded Python 3

File details

Details for the file neptune_query-1.8.0.tar.gz.

File metadata

  • Download URL: neptune_query-1.8.0.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neptune_query-1.8.0.tar.gz
Algorithm Hash digest
SHA256 3cb8f1c2802353b99f6bc241ff80eea934fbcfb4d545cdfcac8f031077df0e91
MD5 a46814c2c2e656fef4c01ea7a61fd204
BLAKE2b-256 aa8f9a5139c6992758fc520f61c4bbdbaad72b4e5c84bd06e7696e54c94c632c

See more details on using hashes here.

File details

Details for the file neptune_query-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: neptune_query-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 106.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neptune_query-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78f42a7f518ee65fae4e80dd447a508882f0e3cf53f189de6766b5fbfd8c3154
MD5 ab99450302ae87568685c320c63a238b
BLAKE2b-256 73102ab5273f41d935b23e48a6d7280e8be0d4e2cb1bf5f9bef9fa17660c669b

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