# Tools for Colab in the Physics Lab
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![PyPI](https://img.shields.io/pypi/v/whit-phys-util)
![PyPI - Downloads](https://img.shields.io/pypi/dm/whit-phys-util)
![GitHub last commit](https://img.shields.io/github/last-commit/JohnMLarkin/Colab-for-Physics-Lab-Tools)
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:
```python
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:
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/JohnMLarkin/Colab-for-Physics-Lab-Tools",
"name": "whit-phys-util",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "John Larkin",
"author_email": "jlarkin@whitworth.edu",
"download_url": "https://files.pythonhosted.org/packages/8b/fd/2d8786854b4949d476516090bacf214532baa46098c6b0e1debe9e47f968/whit_phys_util-1.0.2.tar.gz",
"platform": null,
"description": "# Tools for Colab in the Physics Lab\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n![PyPI](https://img.shields.io/pypi/v/whit-phys-util)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dm/whit-phys-util)\r\n![GitHub last commit](https://img.shields.io/github/last-commit/JohnMLarkin/Colab-for-Physics-Lab-Tools)\r\n\r\nTools to support the use of Google Colab + GitHub for teaching undergraduate physics labs. Support for private repositories enables the use of GitHub Classroom.\r\n\r\n## Installation\r\n\r\nThis package is primarily intended for use within Google Colab. To install in a Colab notebook:\r\n```\r\n!pip install whit-phys-util\r\n```\r\n\r\n## Importing\r\n\r\nTo import the package after installation:\r\n```python\r\nimport whit_phys_util\r\n```\r\n\r\n## Creating a GitHub credentials file\r\n\r\nIf 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.\r\n\r\n1. Create a file with the name `.env` or `dotenv` using the plain text editor of your choice.\r\n2. This file should have the following format:\r\n ```\r\n # for git\r\n user_email = \"yourname@host\"\r\n user_name = \"your_GitHub_user_name\"\r\n gh_token = \"GitHub_personal_access_token\"\r\n ```\r\n In my case `\"yourname@host\"` was `\"jlarkin@whitworth.edu\"` and `\"your_GitHub_user_name\"` was `\"JohnMLarkin\"`.\r\n3. Next, login to GitHub and select **Settings** from the menu hiding under your profile picture.\r\n4. Select **Developer settings** from the sidebar and then **Personal access tokens**.\r\n5. Click on the **Generate new token** button.\r\n6. **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.\r\n7. Check the **repo** box and then the **Generate token** button.\r\n8. Copy this token and paste it into your `.env`/`dotenv` file in place of `GitHub_personal_access_token`.\r\n9. Move this file to the top-level folder of your Google Drive.\r\n\r\n## Working with a GitHub repository\r\n\r\n### Clone a repository to Colab session storage\r\n\r\nReplace `REPO_URL` with the URL to your private GitHub repository:\r\n```python\r\nrepo = whit_phys_util.local_repository(\"REPO_URL\")\r\n```\r\n\r\nIf 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.\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Tools to support use of Google Colab + GitHub Classroom for physics lab instruction",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/JohnMLarkin/Colab-for-Physics-Lab-Tools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8f51f079fc9c0ea8e7cb533b62fe12ba175eae6ca7af735e7613933de899cf89",
"md5": "b61b558d4fb0cbb88c0fa754ff404083",
"sha256": "ad22e7bdb45fbdb6668157d7f0a8810999b643b90672125e2de6df96815bea92"
},
"downloads": -1,
"filename": "whit_phys_util-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b61b558d4fb0cbb88c0fa754ff404083",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 13882,
"upload_time": "2024-09-06T02:32:41",
"upload_time_iso_8601": "2024-09-06T02:32:41.707846Z",
"url": "https://files.pythonhosted.org/packages/8f/51/f079fc9c0ea8e7cb533b62fe12ba175eae6ca7af735e7613933de899cf89/whit_phys_util-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8bfd2d8786854b4949d476516090bacf214532baa46098c6b0e1debe9e47f968",
"md5": "c7f2de8ecea0ed6d5c640ed1cf6c1216",
"sha256": "b4eee5b7b7b75086357a245d7932cb0f97b53131f46618181dfaae90f95ff53a"
},
"downloads": -1,
"filename": "whit_phys_util-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c7f2de8ecea0ed6d5c640ed1cf6c1216",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 12937,
"upload_time": "2024-09-06T02:32:43",
"upload_time_iso_8601": "2024-09-06T02:32:43.300035Z",
"url": "https://files.pythonhosted.org/packages/8b/fd/2d8786854b4949d476516090bacf214532baa46098c6b0e1debe9e47f968/whit_phys_util-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 02:32:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JohnMLarkin",
"github_project": "Colab-for-Physics-Lab-Tools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pydantic-settings",
"specs": [
[
">=",
"2.4.0"
]
]
},
{
"name": "ipydatagrid",
"specs": [
[
">=",
"1.3.2"
]
]
}
],
"lcname": "whit-phys-util"
}