Skip to main content

Tools to support use of Google Colab + GitHub Classroom for physics lab instruction

Project description

Tools for Colab in the Physics Lab

License: MIT PyPI PyPI - Downloads GitHub last commit

Tools to support the use of Google Colab + GitHub for teaching undergraduate physics labs. Support for private repositories enables the use of GitHub Classroom.

Installation

This package is primarily intended for use within Google Colab. To install in a Colab notebook:

!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.

  1. Create a file with the name .env or dotenv using the plain text editor of your choice.
  2. This file should have the following format:
    # for git
    user_email = "yourname@host"
    user_name = "your_GitHub_user_name"
    gh_token = "GitHub_personal_access_token"
    
    In my case "yourname@host" was "jlarkin@whitworth.edu" and "your_GitHub_user_name" was "JohnMLarkin".
  3. Next, login to GitHub and select Settings from the menu hiding under your profile picture.
  4. Select Developer settings from the sidebar and then Personal access tokens.
  5. Click on the Generate new token button.
  6. Note is your name for this token so you can remember what it does and where it is used. Picking something like Colab repo link makes that clear.
  7. Check the repo box and then the Generate token button.
  8. Copy this token and paste it into your .env/dotenv file in place of GitHub_personal_access_token.
  9. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whit_phys_util-1.0.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

whit_phys_util-1.0.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file whit_phys_util-1.0.2.tar.gz.

File metadata

  • Download URL: whit_phys_util-1.0.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for whit_phys_util-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b4eee5b7b7b75086357a245d7932cb0f97b53131f46618181dfaae90f95ff53a
MD5 c7f2de8ecea0ed6d5c640ed1cf6c1216
BLAKE2b-256 8bfd2d8786854b4949d476516090bacf214532baa46098c6b0e1debe9e47f968

See more details on using hashes here.

File details

Details for the file whit_phys_util-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for whit_phys_util-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad22e7bdb45fbdb6668157d7f0a8810999b643b90672125e2de6df96815bea92
MD5 b61b558d4fb0cbb88c0fa754ff404083
BLAKE2b-256 8f51f079fc9c0ea8e7cb533b62fe12ba175eae6ca7af735e7613933de899cf89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page