Skip to main content
App version: 3.20250825

SourceTrackingConfig

Specifies what kind of source code and Git information to log to Neptune and where to store it.

Pass the SourceTrackingConfig object to the source_tracking_config argument of the Run constructor.

Parameters

namespace
str
optional
default: source_code

Path of the namespace where source code and Git infomation is stored.

repository
Path
optional
default: None

Path to the Git repository.

If None, Neptune automatically detects the repository path by searching for it in the current working directory and its parent directories.

upload_run_command
bool
optional
default: True

Whether to log the script execution command.

upload_entry_point
bool
optional
default: False

Whether to log the entry point file.

upload_diff_head
bool
optional
default: False

Whether to log the diff between your current working directory and the last commit.

upload_diff_upstream
bool
optional
default: False

Whether to log the diff between your current branch and the upstream branch.

Example

from neptune_scale import Run
from neptune_scale.api.run import SourceTrackingConfig


# Configure source code tracking
source_config = SourceTrackingConfig(
namespace="source_code",
upload_entry_point=True,
upload_diff_head=True,
upload_diff_upstream=True,
upload_run_command=True,
)

# Pass the config to the Run constructor
if __name__ == "__main__":
run = Run(
experiment_name=...,
source_tracking_config=source_config,
)