Skip to main content

oxen.workspace

Workspace Objects

The Workspace class allows you to interact with an Oxen workspace without downloading the data locally. Workspaces can be created off a branch and is tied to the commit id of the branch at the time of creation. You can commit a Workspace back to the same branch if the branch has not advanced, otherwise you will have to commit to a new branch and merge.

Examples

Adding Files to a Workspace

Create a workspace from a branch.

__init__

Create a new Workspace. Arguments:
  • repo - PyRemoteRepo The remote repo to create the workspace from.
  • branch - str The branch name to create the workspace from. The workspace will be tied to the commit id of the branch at the time of creation.
  • workspace_id - Optional[str] The workspace id to create the workspace from. If left empty, will create a unique workspace id.
  • workspace_name - Optional[str] The name of the workspace. If left empty, the workspace will have no name.
  • path - Optional[str] The path to the workspace. If left empty, the workspace will be created in the root of the remote repo.

id

Get the id of the workspace.

name

Get the name of the workspace.

branch

Get the branch that the workspace is tied to.

commit_id

Get the commit id of the workspace.

repo

Get the remote repo that the workspace is tied to.

status

Get the status of the workspace. Arguments:
  • path - str The path to check the status of.

add

Add a file to the workspace Arguments:
  • src - str The path to the local file to be staged
  • dst - str The path in the remote repo where the file will be added

rm

Remove a file from the workspace Arguments:
  • path - str The path to the file on workspace to be removed

commit

Commit the workspace to a branch Arguments:
  • message - str The message to commit with
  • branch_name - Optional[str] The name of the branch to commit to. If left empty, will commit to the branch the workspace was created from.

delete

Delete the workspace