Remote Repo#

class oxen.RemoteRepo(path: str, host: str = 'hub.oxen.ai', revision: str = 'main')#

Remote repository object that allows you to interact with a remote oxen repository.

add(local_path: str, remote_directory: str = '')#

Stage a file to the remote workspace

Parameters:
  • path (str) – The path to the local file to be staged

  • remote_directory (str) – The path in the remote repo where the file will be added

add_df_row(path: str, row: dict)#

Adds a row to the dataframe at the specified path on the remote repo

Parameters:
  • path (str) – Path to the dataframe on the remote repo

  • row (dict) – A dictionary representing the row to be added to the dataframe, where keys are column names and values are the values to be inserted. Schema must exactly match DF on remote repo.

checkout(revision: str, create=False)#

Switches the remote repo to the specified revision.

Parameters:
  • revision (str) – The name of the branch or commit id to checkout.

  • create (bool) – Whether to create a new branch if it doesn’t exist. Default: False

commit(message: str)#

Commit the staged data in the remote repo with a message.

Parameters:

message (str) – The commit message.

create()#

Will create the repo on the remote server.

create_branch(new_branch: str)#

Return a branch by name on this repo, creating it from the currently checked out branch if it doesn’t exist

Parameters:

new_branch (str) – The name to assign to the created branch

delete()#

Delete this remote repo from the server.

download(remote_path: str, local_path: str | None = None)#

Download a file or directory from the remote repo.

Parameters:
  • remote_path (str) – The path to the remote file

  • local_path (str | None) – The path to the local file. If None, will download to the same path as remote_path

exists() bool#

Checks if this remote repo exists on the server.

get_branch(branch: str)#

Return a branch by name on this repo, if exists

Parameters:

branch (str) – The name of the branch to return

list_branches()#

List all branches for a remote repo

log()#

Get the commit history for a remote repo

ls(directory: str | None = None, page_num: int = 1, page_size: int = 100)#

Lists the contents of a directory in the remote repo.

Parameters:
  • directory (str) – The directory to list. If None, will list the root directory.

  • page_num (int) – The page number to return. Default: 1

  • page_size (int) – The number of items to return per page. Default: 100

property name: str#

The name of the repo.

property namespace: str#

The namespace for the repo.

remove(path: str)#

Unstage a file from the remote workspace

Parameters:

path (str) – The path to the file on remote to be removed from staging

restore_df(path: str)#

Unstage any changes to the schema or contents of a dataframe file on the remote repo

Parameters:

path (str) – The path to the df on the remote to be restored

property revision: str#

The branch or commit id for the repo

status(path: str = '')#

Get the status of the remote repo. Returns a StagedData object.

Parameters:

path (str) – The directory or file path on the remote that will be checked for modifications

property url: str#

The remote url for the repo.