oncolab 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oncolab-0.2.0/PKG-INFO +101 -0
- oncolab-0.2.0/README.md +93 -0
- oncolab-0.2.0/pyproject.toml +14 -0
- oncolab-0.2.0/pyproject.toml.orig +14 -0
- oncolab-0.2.0/src/oncolab/__init__.py +0 -0
- oncolab-0.2.0/src/oncolab/cli.py +528 -0
- oncolab-0.2.0/src/oncolab/config.py +278 -0
- oncolab-0.2.0/src/oncolab/copy.py +412 -0
- oncolab-0.2.0/src/oncolab/env.py +32 -0
- oncolab-0.2.0/src/oncolab/progress.py +71 -0
- oncolab-0.2.0/src/oncolab/remote.py +720 -0
oncolab-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oncolab
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Run a terminal command on a fresh Google Colab VM.
|
|
5
|
+
Requires-Dist: prompt-toolkit>=3,<4
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# oncolab
|
|
10
|
+
|
|
11
|
+
[](https://github.com/progbeat/oncolab/actions/workflows/tests.yml)
|
|
12
|
+
[](https://github.com/progbeat/oncolab/releases/latest)
|
|
13
|
+
[](https://github.com/progbeat/oncolab/blob/master/pyproject.toml)
|
|
14
|
+
|
|
15
|
+
Run a terminal command on a fresh Google Colab VM, without writing a notebook.
|
|
16
|
+
`oncolab` creates the VM, runs your command, and normally releases the VM when it exits. A profile can
|
|
17
|
+
install tools and mount Google Drive before the command starts.
|
|
18
|
+
|
|
19
|
+
[Quick start](https://github.com/progbeat/oncolab/blob/master/README.md#quick-start) · [Run a command](https://github.com/progbeat/oncolab/blob/master/README.md#run-a-command) · [Configure the VM](https://github.com/progbeat/oncolab/blob/master/README.md#configure-the-vm) · [Troubleshooting](https://github.com/progbeat/oncolab/blob/master/README.md#troubleshooting)
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
[Open the terminal demo](https://github.com/progbeat/oncolab/blob/demo-media/demo.webp)
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
On macOS or Linux, you need [uv](https://docs.astral.sh/uv/), OpenSSH, and a
|
|
28
|
+
Colab account.
|
|
29
|
+
|
|
30
|
+
1. If you don't already have the official Colab CLI, install it:
|
|
31
|
+
`uv tool install google-colab-cli`.
|
|
32
|
+
2. If you're not signed in to Colab, run `colab sessions` and complete the Google
|
|
33
|
+
sign-in. For the **Colab** connection you need a supported local SSH key, such
|
|
34
|
+
as `~/.ssh/id_ed25519` with its matching `.pub`.
|
|
35
|
+
[SSH setup and key selection](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#ssh).
|
|
36
|
+
3. Install `oncolab` and run your first command:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
uv tool install oncolab
|
|
40
|
+
oncolab echo hello
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Expect `hello`. No config or Drive mount is needed.
|
|
44
|
+
To update later, run `uv tool upgrade oncolab`.
|
|
45
|
+
|
|
46
|
+
## Run a command
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
oncolab bash # interactive shell; exit when done
|
|
50
|
+
oncolab --gpu T4 nvidia-smi # request a GPU, subject to availability
|
|
51
|
+
oncolab -- bash -c 'uname -m && pwd' # evaluate the shell expression on Colab
|
|
52
|
+
oncolab python3 - < train.py # send a standalone local script over stdin
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Commands start in `/content`. Local files aren't copied automatically. Save
|
|
56
|
+
outputs to persistent storage before the VM is released.
|
|
57
|
+
|
|
58
|
+
Set `workdir` in your profile to change the VM
|
|
59
|
+
working directory, use `--copy` to stage files for the run, or use
|
|
60
|
+
`-e NAME=VALUE` to set variables for the command (`-e NAME` forwards an
|
|
61
|
+
exported local variable):
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
oncolab --gpu T4 --copy train.py --env MODE=train -- python3 train.py
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Put `oncolab` flags before the
|
|
68
|
+
command. See `oncolab --help` for accelerator and memory options.
|
|
69
|
+
Use [`-p LOCAL_PORT:REMOTE_PORT`](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#local-access-to-vm-ports)
|
|
70
|
+
to access a VM service from local loopback.
|
|
71
|
+
|
|
72
|
+
## Configure the VM
|
|
73
|
+
|
|
74
|
+
Pass `--config path/to/profile.toml`, or save your default profile as
|
|
75
|
+
`~/.config/oncolab/config.toml`. Start with the example that matches your task:
|
|
76
|
+
|
|
77
|
+
- [Install or prepare something before your command](https://github.com/progbeat/oncolab/blob/master/examples/setup.toml): no Drive required.
|
|
78
|
+
- [Mount one Google Drive folder](https://github.com/progbeat/oncolab/blob/master/examples/work.toml): use your existing
|
|
79
|
+
rclone config, or [install rclone and run `rclone config`](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#google-drive-mounts)
|
|
80
|
+
once to create one. oncolab installs rclone and FUSE on the VM if needed;
|
|
81
|
+
it does not require rclone locally once you have a config. Use an unencrypted
|
|
82
|
+
file unless rclone can unlock it noninteractively on the VM. Local password
|
|
83
|
+
helpers and `-e RCLONE_CONFIG_PASS` do not configure the mount.
|
|
84
|
+
- [Advanced profiles](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#examples): multiple mounts with
|
|
85
|
+
separate read/write settings, Git-on, or a wrapper that changes `HOME`.
|
|
86
|
+
- [Configuration showcase](https://github.com/progbeat/oncolab/blob/master/examples/showcase.toml): task dependencies,
|
|
87
|
+
file inputs, managed processes, and teardown. The `-v` / `--volume` comment
|
|
88
|
+
describes [future local bind mounts](https://github.com/progbeat/oncolab/issues/4).
|
|
89
|
+
|
|
90
|
+
[Configuration reference](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md) ·
|
|
91
|
+
[Drive permissions and safety](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#security-and-cleanup)
|
|
92
|
+
|
|
93
|
+
## Troubleshooting
|
|
94
|
+
|
|
95
|
+
- **Command not found:** run `uv tool update-shell` and reopen your terminal.
|
|
96
|
+
- **SSH fails:** check [key selection](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#ssh); `oncolab`
|
|
97
|
+
doesn't read `~/.ssh/config` for the Colab connection.
|
|
98
|
+
- **VM cleanup wasn't confirmed:** check `colab sessions`. If the VM is still
|
|
99
|
+
there, use `colab stop -s <session>` only once you know no writes are pending.
|
|
100
|
+
|
|
101
|
+
[Development](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#development) · Unofficial; not affiliated with Google.
|
oncolab-0.2.0/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# oncolab
|
|
2
|
+
|
|
3
|
+
[](https://github.com/progbeat/oncolab/actions/workflows/tests.yml)
|
|
4
|
+
[](https://github.com/progbeat/oncolab/releases/latest)
|
|
5
|
+
[](https://github.com/progbeat/oncolab/blob/master/pyproject.toml)
|
|
6
|
+
|
|
7
|
+
Run a terminal command on a fresh Google Colab VM, without writing a notebook.
|
|
8
|
+
`oncolab` creates the VM, runs your command, and normally releases the VM when it exits. A profile can
|
|
9
|
+
install tools and mount Google Drive before the command starts.
|
|
10
|
+
|
|
11
|
+
[Quick start](https://github.com/progbeat/oncolab/blob/master/README.md#quick-start) · [Run a command](https://github.com/progbeat/oncolab/blob/master/README.md#run-a-command) · [Configure the VM](https://github.com/progbeat/oncolab/blob/master/README.md#configure-the-vm) · [Troubleshooting](https://github.com/progbeat/oncolab/blob/master/README.md#troubleshooting)
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
[Open the terminal demo](https://github.com/progbeat/oncolab/blob/demo-media/demo.webp)
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
On macOS or Linux, you need [uv](https://docs.astral.sh/uv/), OpenSSH, and a
|
|
20
|
+
Colab account.
|
|
21
|
+
|
|
22
|
+
1. If you don't already have the official Colab CLI, install it:
|
|
23
|
+
`uv tool install google-colab-cli`.
|
|
24
|
+
2. If you're not signed in to Colab, run `colab sessions` and complete the Google
|
|
25
|
+
sign-in. For the **Colab** connection you need a supported local SSH key, such
|
|
26
|
+
as `~/.ssh/id_ed25519` with its matching `.pub`.
|
|
27
|
+
[SSH setup and key selection](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#ssh).
|
|
28
|
+
3. Install `oncolab` and run your first command:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
uv tool install oncolab
|
|
32
|
+
oncolab echo hello
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Expect `hello`. No config or Drive mount is needed.
|
|
36
|
+
To update later, run `uv tool upgrade oncolab`.
|
|
37
|
+
|
|
38
|
+
## Run a command
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
oncolab bash # interactive shell; exit when done
|
|
42
|
+
oncolab --gpu T4 nvidia-smi # request a GPU, subject to availability
|
|
43
|
+
oncolab -- bash -c 'uname -m && pwd' # evaluate the shell expression on Colab
|
|
44
|
+
oncolab python3 - < train.py # send a standalone local script over stdin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Commands start in `/content`. Local files aren't copied automatically. Save
|
|
48
|
+
outputs to persistent storage before the VM is released.
|
|
49
|
+
|
|
50
|
+
Set `workdir` in your profile to change the VM
|
|
51
|
+
working directory, use `--copy` to stage files for the run, or use
|
|
52
|
+
`-e NAME=VALUE` to set variables for the command (`-e NAME` forwards an
|
|
53
|
+
exported local variable):
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
oncolab --gpu T4 --copy train.py --env MODE=train -- python3 train.py
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Put `oncolab` flags before the
|
|
60
|
+
command. See `oncolab --help` for accelerator and memory options.
|
|
61
|
+
Use [`-p LOCAL_PORT:REMOTE_PORT`](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#local-access-to-vm-ports)
|
|
62
|
+
to access a VM service from local loopback.
|
|
63
|
+
|
|
64
|
+
## Configure the VM
|
|
65
|
+
|
|
66
|
+
Pass `--config path/to/profile.toml`, or save your default profile as
|
|
67
|
+
`~/.config/oncolab/config.toml`. Start with the example that matches your task:
|
|
68
|
+
|
|
69
|
+
- [Install or prepare something before your command](https://github.com/progbeat/oncolab/blob/master/examples/setup.toml): no Drive required.
|
|
70
|
+
- [Mount one Google Drive folder](https://github.com/progbeat/oncolab/blob/master/examples/work.toml): use your existing
|
|
71
|
+
rclone config, or [install rclone and run `rclone config`](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#google-drive-mounts)
|
|
72
|
+
once to create one. oncolab installs rclone and FUSE on the VM if needed;
|
|
73
|
+
it does not require rclone locally once you have a config. Use an unencrypted
|
|
74
|
+
file unless rclone can unlock it noninteractively on the VM. Local password
|
|
75
|
+
helpers and `-e RCLONE_CONFIG_PASS` do not configure the mount.
|
|
76
|
+
- [Advanced profiles](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#examples): multiple mounts with
|
|
77
|
+
separate read/write settings, Git-on, or a wrapper that changes `HOME`.
|
|
78
|
+
- [Configuration showcase](https://github.com/progbeat/oncolab/blob/master/examples/showcase.toml): task dependencies,
|
|
79
|
+
file inputs, managed processes, and teardown. The `-v` / `--volume` comment
|
|
80
|
+
describes [future local bind mounts](https://github.com/progbeat/oncolab/issues/4).
|
|
81
|
+
|
|
82
|
+
[Configuration reference](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md) ·
|
|
83
|
+
[Drive permissions and safety](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#security-and-cleanup)
|
|
84
|
+
|
|
85
|
+
## Troubleshooting
|
|
86
|
+
|
|
87
|
+
- **Command not found:** run `uv tool update-shell` and reopen your terminal.
|
|
88
|
+
- **SSH fails:** check [key selection](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#ssh); `oncolab`
|
|
89
|
+
doesn't read `~/.ssh/config` for the Colab connection.
|
|
90
|
+
- **VM cleanup wasn't confirmed:** check `colab sessions`. If the VM is still
|
|
91
|
+
there, use `colab stop -s <session>` only once you know no writes are pending.
|
|
92
|
+
|
|
93
|
+
[Development](https://github.com/progbeat/oncolab/blob/master/docs/configuration.md#development) · Unofficial; not affiliated with Google.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "oncolab"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Run a terminal command on a fresh Google Colab VM."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = ["prompt-toolkit>=3,<4"]
|
|
8
|
+
|
|
9
|
+
[project.scripts]
|
|
10
|
+
oncolab = "oncolab.cli:main"
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["uv_build>=0.10,<0.15"]
|
|
14
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "oncolab"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Run a terminal command on a fresh Google Colab VM."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = ["prompt-toolkit>=3,<4"]
|
|
8
|
+
|
|
9
|
+
[project.scripts]
|
|
10
|
+
oncolab = "oncolab.cli:main"
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["uv_build>=0.10,<0.15"]
|
|
14
|
+
build-backend = "uv_build"
|
|
File without changes
|