Xet CLI
Xet CLI provides a versioned object-store view of XetHub, with the ability to easily copy, move, remove, and list repository files. As you develop and write files, Xet CLI automatically commits changes on every write operation, enabling XetHub users to easily rewind and replay their files for comparison and reproducibility.
Unlike with Git, getting a single file with Xet CLI is just as simple as getting the full repository. All <dest>
references can be a local path or Xet URL. Xet URLs are in the format of:
xet://user/repo/branch/path/to/file
Install Xet CLI with PyXet
-
Using a supported version of Python (3.7+), set up a virtualenv:
python -m venv .venv
source .venv/bin/activate -
Install PyXet, which includes Xet CLI, with:
pip install pyxet
-
Create your personal access token (PAT) by clicking "Create Token" from your Settings page.
-
Authenticate by copying the login string, starting with
xet login
, and running it from your terminal:xet login -u <username> -e <email> -p <PAT>
Developing with Xet CLI
Write files to your repository as you would an object store. By committing changes on every write operation, Xet CLI's background versioning ensures confident changes and unlimited reverts.
Create a Xet repository
If starting new development, create a new repository from your terminal.
For a private repository:
xet repo make --private xet://user/repo
For a public repository:
xet repo make --public xet://user/repo
Basic commands
Use Xet CLI to move files around at your leisure, with confidence that all your changes are versioned.
Copy files from remote to local
xet cp xet://user/repo/main/file file
Copy files from local to remote
xet cp myfile xet://user/repo/main -m "Add my file"
Create a branch
xet cp xet://user/repo/main xet://user/repo/test_branch
Move assets from outside sources
xet cp s3://user/file xet://user/repo/test_branch
Move files around in your remote
xet mv xet://user/repo/branch/folder/file xet://user/repo/branch/file -m "Move up a directory"
Other operations like mv, rm, and more are also supported.
Time travel commands
Background commits means that we have a record of everything at every time, so we can easily pull a file or repository at a certain absolute or relative time.
By commit
Show file information at a tag v0.1.0 or commit 261d82962a (no branch needed):
xet ls xet://user/repo/v0.1.0/path
xet ls xet://user/repo/261d82962a/path
By relative commit
Show file information on main from 2 commits ago:
xet ls xet://user/repo/main~2/path
By date
Show file information on main from any date:
xet ls "xet://user/repo/main@{2023-07-04 12:00}/path"
By relative date
Show repository contents on main from 2 days ago:
xet ls xet://user/repo/main@{2.days.ago}
You can also easily move versions around for easy comparison:
xet cp "xet://user/repo/main@{1 month 2 weeks 1 second ago}/file" xet://user/compare_repo/file_1