Neptune API index

Index of all Neptune classes, functions, and parameters.

This page lists all functions, parameters, and constants exposed by the Neptune Python client library.

Sections:

  • Functions
  • Constants

Functions

runfield_name

Use to access the field of an object through a dict-like path lookup:

import neptune

run = neptune.init_run()

field_handler = run["namespace/subnamespace/field"]

=

Convenience alias for assign().

add()

StringSet method.

-- When called on run["sys/tags"], adds the provided strings to the run's tags.
-- When called on run["sys/group_tags"], assigns the run to the provided groups.

  • Adding tags
  • Groups

add_project_member()

managementfunction for adding a user to a project.

add_project_service_account()

managementfunction for assigning a service account to a project.

append()

Depending on the type of the logged metadata, creates aFileSeries,FloatSeries, orStringSeriesfield. Iteratively appends the provided value to the series.

import neptune

run = neptune.init_run()

for epoch in range(parameters["n_epochs"]):
 ... # My training loop
 run["train/epoch/loss"].append(loss) # (1)!
  1. train/epoch/loss is now a FloatSeries field.

Logging a series of values or files

as_html()

Filemethod.

Converts an object to a File value object.

Use to upload interactive charts or data frames.

as_image()

Filemethod.

Static method for converting image-like objects to a File value object.

Use to upload figures, arrays, and tensors as static images.

as_pickle()

Filemethod.

Pickles a Python object and stores it in a File value object.

assign()

Assigns the provided value or dictionary to a field or namespace.

Works for the following Neptune field types:

  • Artifact (to assign an artifact object fetched from an existing Artifact field)
  • Namespace handler

clear()

StringSetmethod.

  • When called on the object["sys/tags"] field of a run, removes all tags from the object.
  • When called on the object["sys/group_tags"] field of a run, removes the run from all groups.

clear_trash()

managementfunction for emptying the trash of the specified project.

create_project()

managementfunction for creating a new project.

del

Command that completely removes the field or namespace and all associated metadata stored under the path.

import neptune

run = neptune.init_run(with_id="NLI-8") # (1)!
del run["nlp-dataset"]
  1. NLI-8 is the ID of an existing run that has something stored in the field nlp-dataset

delete_files()

FileSetmethod.

Deletes the specified files from the field.

delete_objects_from_trash()

managementfunction for deleting items from a project's trash.

delete_project()

managementfunction for deleting a project.

download()

Downloads the file(s) stored in the field when called on an object path.

Available for the following field types:

  • Artifact
  • FileSet

download_last()

Downloads the last file stored in aFileSeriesfield and saves it locally.

exists()

Object-level method that checks if there is a field or namespace under the specified path.

>>> import neptune
>>> run = neptune.init_run(with_id="NLI-8") # (1)!
>>> run.exists("nlp-dataset")
True
  1. NLI-8 is the ID of an existing run that has something stored in the field nlp-dataset

extend()

Depending on the type of the logged metadata, creates aFileSeries,FloatSeries, orStringSeriesfield. Iteratively appends the provided collection of values to the series.

fetch()

Fetches the field value.

Available for the following Neptune field types:

  • Artifact (to copy an artifact object from an existing Artifact field)
  • StringSet (fetches the tags of a run)

fetch_extension()

Filemethod.

Returns the extension of a stored file.

fetch_files_list()

Artifactmethod.

Fetches a list of artifact files.

fetch_hash()

Artifactmethod.

Fetches the hash of the artifact.

fetch_last()

FloatSeriesandStringSeriesmethod.

Fetches the last value stored in the series.

fetch_runs_table()

Projectmethod for listing the metadata of all runs as a table.

fetch_values()

FloatSeriesandStringSeriesmethod.

Fetches all values stored in the series.

from_content()

Filemethod.

Factory method for creatingFilevalue objects directly from binary and text content.

from_path()

Filemethod.

Creates a File value object from a given path.

Equivalent toFile(path), but you can specify the extension separately.

from_stream()

Filemethod.

Factory method for creatingFilevalue objects directly from binary and text streams.

get_project_list()

managementfunction for listing projects that a given Neptune account has access to.

get_project_member_list()

managementfunction for listing members of a project.

get_project_service_account_list()

managementfunction for listing the service accounts assigned to a project.

get_root_object()

Returns the root-level object of anamespace handler.

In other words, if called on a path inside a run, returns the run.

get_structure()

Object-level method.

Returns the metadata structure of an object in the form of a dictionary.

>>> import neptune
>>> run = neptune.init_run(with_id="NLI-8")
>>> run.get_structure()
{'data': {'val': <neptune.attributes.atoms.artifact.Artifact object at 0x0000020374B822C0>}, 'f1_score': <neptune.attributes.atoms.float.Float object at 0x0000020374B81A50>, 'monitoring': {'cpu': <neptune.attributes.series.float_series.FloatSeries object at 0x0000020374B81A80>, ... }}

See also:print_structure()

get_url()

Object-level method.

Returns a direct link to the object.

>>> import neptune
>>> run = neptune.init_run(with_id="NLI-8")
>>> run.get_url()
https://app.neptune.ai/jackie/named-entity-recognition/e/NLI-8

get_workspace_member_list()

managementfunction for listing the members of a workspace.

get_workspace_service_account_list()

managementfunction for listing the service accounts of a workspace.

get_workspace_status()

managementfunction for retrieving status information about a workspace's storage, projects, and members.

init_project()

Callingneptune.init_project()onnects to a Neptune project as a container for metadata.

Use to log metadata in theProject metadatasection.

init_run()

Callingneptune.init_run()creates anew Neptune runand an entry in theexperiments tableof the specified project.

To reinitialize an existing run for logging or fetching metadata:

  • Pass the run's auto-generated Neptune ID to the with_id argument.
  • If set, pass the run's custom ID to the custom_run_id argument.

invite_to_workspace()

managementfunction for inviting a user to a workspace.

list_fileset_files()

FileSetmethod.

Fetches metadata on the file set. If the top-level artifact of the field is a directory, only metadata on this directory is returned.

log()

Seeappend()(append one value at a time) orextend()(append a collection of values at once).

pop()

Object- or field-level method that completely removes a field or namespace and all associated metadata stored under the path.

If called on the root object, pass the field to remove as the argument.

# The following line
run.pop("parameters/learninggg_rata")
# is equiavlent to this line
run["parameters/learninggg_rata"].pop()
# and this line
run["parameters"].pop("learninggg_rata")

See alsodel.

Object-level method.

Pretty-prints the metadata structure of the run or project.

>>> import neptune
>>> run = neptune.init_run(with_id="NER-35")
>>> run.print_structure()
'data':
 'val': Artifact
'f1_score': Float
...

See also:get_structure()

remove()

StringSetmethod.

  • When called on the object["sys/tags"] field of a run, removes the specified tags from the object.
  • When called on the object["sys/group_tags"] field of a run, removes the run from the specified groups.

remove_project_member()

managementfunction for removing a member from a project.

remove_project_service_account()

managementfunction for removing a service account from a project.

stop_synchronization_callback()

utilsfunction. Default callback function that is called if the synchronization lags too much or has not progressed at all.

For details, seeHow to use callbacks when sync is interrupted.

stop()

Object-level method. Stops the connection to Neptune and synchronizes all data with the Neptune servers.

If you're running Neptune in a Python script, Neptune stops any initialized objects automatically when the script finishes execution.

Always callstop()in interactive environments, such as a Python interpreter or Jupyter notebook. The connection to Neptune is not stopped when the cell has finished executing, but rather when the entire notebook stops.

If you're running a script, the connection is stopped automatically when the script finishes executing. However, it's a best practice to callstop()when the connection is no longer needed.

import neptune

run = neptune.init_run()

[...] # Your training or monitoring code

# stop() is automatically called at the end for every Neptune object

Usingwithstatement and context manager:

for config in configs:
 with neptune.init_run() as run:
 [...] # Your training or monitoring code
 # stop() is automatically called when code execution exits the with statement

stringify_unsupported()

utilsfunction. Converts unsupported values in a dictionary or collection to strings.

sync()

Object-level method.

Synchronizes the local representation of the object with the representation on the Neptune servers.

# Connect to a run from Worker #3
worker_id = 3
run = neptune.init_run(
 with_id="DIST-43",
 monitoring_namespace=f"monitoring/{worker_id}",
)

# Try to access logs that were created in the meantime by Worker #2
worker_2_status = run["status/2"].fetch()
# Error if this field was created after this script starts

run.sync() # Synchronize local representation with Neptune servers
worker_2_status = run["status/2"].fetch() # No error

to_pandas()

Tablemethod. Converts the object returned byfetch_runs_table()to a pandas DataFrame.

track_files()

Creates anArtifactfield when called on an object path.

Iteratively adds references to new files if called on an existing Artifact field.

import neptune

run = neptune.init_run()

run["nlp-dataset"].track_files("path/to/dir/")
...
run["nlp-dataset"].track_files("path/to/another/file")

trash_objects()

managementfunction for moving objects to the project trash.

Note

Emptying the trash is a separate action. A trashed item is permanently deleted only when the trash is emptied.

upload()

Creates aFilefield when called on an object path.

Uploads the provided file under the specified field path.

upload_files()

Creates aFileSetfield when called on an object path.

Uploads the provided directory or file(s) and stores them under theFileSetfield.

wait()

Object-level method.

Wait for all the logging calls (queued operations) to reach the Neptune servers before continuing execution.

import neptune

run = neptune.init_run()
run["parameters"] = PARAMS

run.wait()

The logged metadata can now be fetched from the Neptune server:

fetched_params = run["parameters"].fetch()

Parameters

api_token

Neptune initialization parameter that takes theAPI tokenof a user or service account as the argument.

Used to ensure that the account which performs the logging has access to the target project.

To keep your token secure, avoid placing it in source code. Instead,save it as an environment variable.

ascending

Parameter for controlling the sorting order when fetching a project's runs withfetch_runs_table().

async_lag_callback

Neptune initialization parameter that takes a callback function as the argument.

If alag callback is enabled, it's triggered if the lag between a queued operation and its synchronization with the server exceeds the duration defined byasync_lag_threshold.

async_lag_threshold

Neptune initialization parameter that represents a threshold for the duration between the queueing and synchronization of an operation (in seconds).

If alag callbackis enabled, the callback is called when this duration is exceeded.

async_no_progress_callback

Neptune initialization parameter that takes a callback function as the argument.

If ano-progress callback is enabled, it's triggered if no data has been synchronized with the server for a duration defined byasync_lag_threshold.

async_no_progress_threshold

Neptune initialization parameter that represents a threshold for the duration of no data being synchronized to the server.

If ano-progress callbackis enabled, the callback is called when this duration is exceeded.

autoscale

File.as_image()parameter for controlling whether Neptune should try to scale image pixel values, to better render them in the web app.

chart

File.as_html()parameter for converting interactive charts to HTML. Takes an Altair, Bokeh, Plotly, Matplotlib, Seaborn, or pandas DataFrame object as the argument.

content

File.from_content()parameter that takes binary or text content as the argument.

custom_run_id

Setting custom run ID

Neptune run initialization parameter that takes a unique, user-defined identifier as the argument.

Can be used to log metadata to a single run from multiple locations.

description

  • When creating a new run, an editable description of the object, stored in sys/description . Can be added as a column in the experiments table.
  • Series parameter used to set a custom name for an entry.

destination

Available for fetching methods that download metadata from the Neptune servers to the local machine.

disk_only

wait()parameter. Controls whether the process should wait only for the data to be saved locally from memory and not for it to reach Neptune servers.

expand

stringify_unsupported()parameter, to help log series values in a proper folder structure instead of a string.

extension

Parameter for setting or interpreting file types when creatingFilefields.

flush_period

Neptune initialization parameter. Controls how often Neptune should triggerdisk flushingin asynchronous mode.

Note

The OS can trigger disk flushing implicitly. As such, settingflush_period=600will flush the disk at least every 600 seconds, but it can happen more frequently for other reasons.

globs

FileSet.upload_filesparameter that takes the paths of the files to be uploaded.

include_timestamp

fetch_values()parameter used to control whether to include timestamps when fetching values from aFloatSeriesorStringSeriesfield.

limit

Parameter for limiting the number of returned entries when fetching a project's runs withfetch_runs_table().

mode

Neptune initialization parameter. Sets the connection mode in which the logging will work. Possible values areasync`,sync,offline,read-only, anddebug`.

For more, seeUsing Neptune in different modes.

name

  • When creating a new run, a custom name for the object, stored in sys/name .
  • Series parameter used to set a custom name for an entry.

obj

File.as_pickle()parameter that takes a pickleable Python object as the argument.

path

Available for several logging methods that concern tracking or uploading files.

paths

FileSet.delete_files()parameter that takes the paths of the files to be deleted from the fileset (relativ to the set root).

progress_bar

Parameter for disabling the progress bar or passing your own progress bar type when querying the API.

Available when

  • fetching runs from a project with fetch_runs_table()
  • downloading contents from individual fields: download() and fetch_values()

project

Used to specify the Neptune project wheninitializing Neptune objectsor performingmanagementactions.

Typically given in the formworkspace-name/project-name.

Formanagementfunctions, a separate optionalworkspaceargument is available. If it's provided, theprojectargument can consist of theproject-namepart alone.

proxies

Neptune initialization parameter whose argument is passed to HTTP calls made via theRequestslibrary.

query

Available when fetching runs with thefetch_runs_table()function.

Takes a rawNQLstring as the argument.

project = neptune.init_project()
project.fetch_runs_table(query="`f1_score`:float > 0.6")

repository_path

GitRefparameter for specifying where Neptune should look for a Git repository when a run is created.

seconds

stop()parameter that specifies for how long Neptune should wait before terminating the connection. (By default, Neptune waits for all logging calls and operations to finish before actually stopping the connection.)

seek

File.from_stream()parameter that takes a byte offset as the argument.

sort_by

Parameter for controlling the sorting column when fetching a project's runs withfetch_runs_table().

source_files

Available forneptune.init_run().

Used to specify which source files to upload.

Info

Files uploaded this way are displayed in theSource codedashboard in the web app.

step

Seriesparameter used to set a custom index.

steps

Seriesparameter used to set custom indexes when appending multiple values at a time with theextend()function.

stream

File.from_stream()parameter that takes a binary or text stream as the argument.

tags

Available forneptune.init_run().

Used to apply tags to a Neptune run. Takes a list of strings as the argument.

timestamp

Seriesparameter used to set custom timestamps.

timestamps

Seriesparameter used to set custom timestamps when appending multiple values at a time with theextend()function.

value

Available for logging functions that are used to assign a single value to a field.

values

Available for logging functions that are used to assign multiple values to a field at a time (or remove them).

wait

Available for all logging functions.

By default, logging calls and other Neptune operations are periodically synchronized with the server in the background. IfTrue, Neptune first waits to complete any queued operations, then executes the call and continues script execution.

with_id

Neptune initialization parameter for connecting to an existing run. Takes the Neptune ID of the object to resume (for example,NLI-8).

The Neptune ID is a unique identifier for the object. It's assigned automatically when the object is created.

In the table view, it's displayed in the leftmost column.

workspace

Used to specify the Neptune workspace when performingmanagementactions.

Constants

ANONYMOUS_API_TOKEN

API token for anonymous logging.

You can use this value for theapi_tokenargument of theinitfunctions in order to log metadata to one of Neptune's public projects.

DISABLED

Constant forGitRefthat disables Git tracking for a run.

  • Environment variables
  • Connection modes reference (async, offline, debug, etc.)
  • Field types : Complete reference and breakdown of methods per type
  • System namespace (sys) reference ( sys/name , sys/id , sys/failed , etc.)

This page is originally sourced from the legacy docs.