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>=1.5.1,<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.7.0.tar.gz (61.9 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.7.0-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neptune_query-1.7.0.tar.gz
  • Upload date:
  • Size: 61.9 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.7.0.tar.gz
Algorithm Hash digest
SHA256 e7770ac8bb289868a66589a56c49a62452eb52065632cde44208775dd6d9d5d0
MD5 b35b21664fc3a66e18362ee62b6254bc
BLAKE2b-256 57f3508c95fbcc498acf461268bb6676bec594339a9b6ecd3ebc287e0acbf979

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neptune_query-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 100.4 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f76024df6bcd3de072cc55161dcf0a1aa7a01db50c8ff4da2576aeb72aa7f782
MD5 3e07bb67f63edbf632589f479a0b8b1f
BLAKE2b-256 25003a3323089d7560a1a99afec66f74fbe3a2fc3eb5c57a243e0bdc5d5a2a36

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