The setup package bundles helpers that prepare a private GitHub project to run smoothly inside Google Colab. These routines remove repetitive manual steps around authentication, repository synchronization, dependency installation, and notebook execution.
setup/__init__.pyre-exports the public helper functions for concise imports, for examplefrom setup import clone_or_update_repo.setup/project.pycontains the implementations described in this document.
- store_credentials_from_env: Reads GitHub credentials from environment variables (defaults
GITHUB_USERNAME,GITHUB_TOKEN), writes them to~/.netrc, and applies strict file permissions so authenticated git operations can proceed non-interactively. - ensure_project_name: Retrieves the project name from the
PROJECT_NAMEenvironment variable or prompts for it once, then caches the result back into the environment for consistency across helpers. - clone_or_update_repo: Clones
https://github.com/<owner>/<project>.gitwhen absent or fast-forwards an existing checkout usinggit pull --ff-only, returning the resolved project path. - change_directory: Switches the current working directory to the provided path and returns the resolved location, useful right before running project-specific commands.
- setup_google_drive_project: Mounts Google Drive through
google.colab.drive, ensures a project directory underMyDrive/projects, manages a/projectsymlink, and exports the resulting location viaOUT_DIR. - setup_vscode_tunnel: Installs
vscode-colabon demand, authenticates, and starts a VS Code tunnel named after the project so you can connect from the desktop client. - install_project_requirements: Detects the installed PyTorch/CUDA versions, builds the matching PyTorch wheel index URL, upgrades
pip, and installs dependencies fromrequrment.txt, returning the wheel index used. - execute_notebook: Executes a notebook (default
eval.ipynb) headlessly vianbconvert, applies a configurable timeout, and writes the executed notebook toeval_output.ipynb(or a provided path).
Together these utilities let you authenticate, mount storage, sync code, configure dependencies, and run evaluation notebooks with minimal manual intervention in Colab.