colab-assist
Google Colab workflow utilities
About¶
-
colab-assist is a small package that shares the utility functions that I find useful for my development workflows on Google Colab.
-
Actually, this is also a semi-mock project that I use to learn Python open-source development. Feedbacks, pointers, and feature suggestions are much appreciated!
Usage¶
Experimenting your private Python package on Colab¶
-
Develop your package any way you like and push it to your private GitHub repo.
-
Make a repo-specific personal access token (PAT).
-
Store the PAT as a Colab Secret:

-
On Colab:
import colab_assist as A-
Install → experiment → push → resintall:
# Install your private package A.install("$my_token@me/my_pkg@feat/foo") # Experiment from my_pkg import foo foo() # Update the repo # Reinstall updated package A.install("$my_token@me/my_pkg@feat/foo") # Reimport updated functions/classes without needing to restart Colab session foo = A.reload(foo) foo() -
Or clone → experiment → push → pull:
# Clone your private package and automatically add it to `sys.path` A.clone("$my_token@me/my_pkg@feat/foo", x="p") # Experiment from my_pkg import foo foo() # Update the repo # Pull the update A.pull("my_pkg") # Reimport updated functions/classes without needing to restart Colab session foo = A.reload(foo) foo() # Or restart the Colab session with `sys.path` automatically recovered A.restart() import colab_assist as A # Import `colab_assist` recovers previously extended `sys.path` from my_pkg import foo # The clone is now again importable foo() # Terminate the Colab runtime with your clones automatically cleaned up A.end()
-
Text file creation and editing¶
# Create `foo.txt` at working directory and call `google.colab.files.view()` to edit it
A.edit("foo.txt", x="c")
Dependencies & Installation¶
-
Although currently colab-assist lists no dependencies, it is intended to only be installed and used in a Google Colab environment. The reason not to explicitly list dependencies for now is that at least one depedency (
google-colab) is bespoke for Colab and not hosted on PyPI. However, colab-assist is designed to install and run just fine on a fresh Colab instance. -
You can install colab-assist very quickly with pre-installed uv on Colab:
Or with pip:!uv pip install --system -q colab-assist%pip install -q colab-assist