Contributing to TeachingTools
We welcome contributions to this project! If you have an idea for a new tool, a bug fix, or any other improvement, please follow these steps:
Setting up a development environment
You should first fork this repository and then clone it to your local machine.
The easiest way to then set up a virtual environment is using the venv
module
python3.12 -m venv .venv
source .venv/bin/activate
# for windows this would is .venv/Scripts/activate
python -m pip install -r .
Creating a new tool
To create a new tool, you should copy one of the template tools from the apps
directory and modify it to your needs.
Each tool should have its own directory with the following structure:
apps/
└── MyNewTool
├── app1
| ├── app.py
| └── requirements.txt
├── app2
| ├── app.py
| └── requirements.txt
└── app.md
Writing documentation
Each tool should have a corresponding app.md
file in the same directory. This file should contain the documentation for the tool, including a description, usage instructions, and any other relevant information.
The documentation is written in Markdown, and parsed using mkdocs with the material theme.
Especially check out the latter for more information on how to use the available features.
You can use the following template to get started:
---
authors:
- <author>
categories:
- Templates
tags:
- Matplotlib
- Introduction
date: YYYY-MM-DD
hide:
- toc
---
# Matplotlib Template
Quick example for a simple matplotlib app. Matplotlib is a popular Python library that can be used to create plots.
<!-- more -->
This is a simple example to showcase different matplotlib apps using Shiny for Python.
## Default matplotlib theme
{{embed_app("100%", "500px", "default")}}
## Dark matplotlib theme
{{embed_app("100%", "500px", "dark")}}
## Seaborn matplotlib theme
{{embed_app("100%", "500px", "seaborn")}}
.authors.yml
list.
authors:
<author>:
name: string # Author name
description: string # Author description
avatar: url # Author avatar
slug: url # Author profile slug
url: url # Author website URL
mkdocs.yml
if necessary.
The tags are used to further categorize the tool and can be anything you like.
The name of the tool is generated from the title of the app.md
file, so make sure to use a descriptive title.
The <!-- more -->
tag is used to separate the introduction, which is shown as an excerpt, from the rest of the documentation.
To embed the app in the documentation, you can use the {{embed_app("width", "height")}}
macro.
The width and height can be set to any valid CSS value, such as 100%
, 500px
, or 50vw
.
If you have multiple apps in a single tool, as is the case in the example above, you can specify the app name as a third argument, e.g. {{embed_app("100%", "500px", "app1")}}
, where the app name must match the name of the subirectory containing the app.py
file.
Testing your tool locally
To test your tool locally, you should build the full documentation using the following command in the root directory of your repository:
This will create asite
directory containing the static HTML files for the documentation, including your new tool.
You can then open your browser and navigate to localhost to see the documentation and test if everything works.
If that is the case, congratulations! You have successfully created a new tool for TeachingTools and can now submit your changes.
Submitting your changes
Once you have made your changes and tested them locally, you can commit your changes and push them to your forked repository:
Then, create a pull request on the original repository. Make sure to provide a clear description of your changes and what they do.