Tools for Colab in the Physics Lab
Tools to support the use of Google Colab + GitHub for teaching undergraduate physics labs. Support for private repositories enables the use of GitHub Classroom.
Starting in version 2.0 the conditional importation of Colab-specific components was enabled, allowing the more general tools to be used in other environments (such as in a VS Code notebook running locally).
Installation
!pip install whit-phys-util
Importing
To import the package after installation:
import whit_phys_util
Creating a GitHub credentials file
If you will be regularly connecting GitHub private repositories to Colab sessions, the recommendation is to create a file containing your GitHub info and store it in your Google Drive.
- Create a file with the name
.envordotenvusing the plain text editor of your choice. - This file should have the following format:
In my case# for git user_email = "yourname@host" user_name = "your_GitHub_user_name" gh_token = "GitHub_personal_access_token""yourname@host"was"jlarkin@whitworth.edu"and"your_GitHub_user_name"was"JohnMLarkin". - Next, login to GitHub and select Settings from the menu hiding under your profile picture.
- Select Developer settings from the sidebar and then Personal access tokens.
- Click on the Generate new token button.
- Note is your name for this token so you can remember what it does and where it is used. Picking something like
Colab repo linkmakes that clear. - Check the repo box and then the Generate token button.
- Copy this token and paste it into your
.env/dotenvfile in place ofGitHub_personal_access_token. - Move this file to the top-level folder of your Google Drive.
Working with a GitHub repository
Clone a repository to Colab session storage
Replace REPO_URL with the URL to your private GitHub repository:
repo = whit_phys_util.local_repository("REPO_URL")
If your Google Drive is not already mounted to this Colab session, you will be prompted to do so. If you created the GitHub credentials file as described above, this will then create a clone of the repository located in /content/REPO_NAME. Your current working directory will also be changed to this folder.
Metadata
Release files for whit-phys-util 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| whit_phys_util-2.0.0.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whit_phys_util-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.1 kB
Release files / whit_phys_util-2.0.0.tar.gz
| Download URL | whit_phys_util-2.0.0.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebe91cc20a46d81d1074d02d5fc86f5f3cdc34af1d1124562b41394c246d8ace
|
|
BLAKE2b-256 checksum How to use checksums |
2f3d604dc9e331e5afe4844b09a74ae24c26d6f2d54d2a53d44519a7fcc91de4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / whit_phys_util-2.0.0-py3-none-any.whl
| Download URL | whit_phys_util-2.0.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8e38e4885f9b0cf0e4e4202877918c8ac152321d1ab4c6814c7b334acfc7d28
|
|
BLAKE2b-256 checksum How to use checksums |
7b1c9235cb05fcb92fc3cc033f636bf9f8141f07e7632313fa1aec543e1a9f6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|