Skip to main content

Useful abstractions and CLI to make teaching more scriptable.

Project description

Overview

This is a library of stuff that I have, used to automate my work as a teacher. For the most part, it's been the primary means for me learning object oriented programming, and has had a history of massive revision as I continue to learn and fix my mistakes. Most recently, in late summer 2021, I deleted most of the project except the parts I actually use, and I plan to continue adding to it throughout this school year; hopefully adding some things that are actually useful!

Installation

You can install this package via pip:

pip install teacherhelper

Of course, there is some additional work involved in importing your school data. See CORE.md.

Usage

Once installed, the th command provides the following CLI utility:

usage: th [-h] [--student STUDENT] [--parent PARENT] [--new]

optional arguments:
  -h, --help            show this help message and exit
  --student STUDENT, -s STUDENT
                        Lookup a student and print the result
  --parent PARENT, -p PARENT
                        Lookup a parent and print the result
  --new                 Regenerate the database by parsing student.csv and parent.csv in the $HELPER_DATA directory.

API

The Helper object provides an object oriented interface for accessing the imported data as well as sending emails if the optional EMAIL_USERNAME and EMAIL_PASSWORD environment variables are set. This makes any kind of scripting involving school information much more accessible.

from teacherhelper import Helper

name = 'tommey'  # Timmy needs a typing lesson, but this library is great for
                 # data bunging!

# **************************************************
# ==== Student Information System inside Python ====
# **************************************************

# after following the setup steps in ./docs/CORE.md, this "just works," making
# it super easy to interact with student information from any python script
helper = Helper.read_cache()

result = helper.find_nearest_match(name)  # -> Union[Student, None]
if result:
    print(result)
else:
    print(f'{name} not found')

# there is also an `exhaustive_search` method which allows you to search within
# subgroups of students at a lower confidence level, allowing dirtier data to
# be more usable if you know that you are looking at a particular homeroom,
# for example
name = 'toezmmy'  # come on Tommy
tommy_homeroom = helper.homerooms["Tommy's Teacher"].students
result = helper.exhaustive_search(name, tommy_homeroom, threshold=40)
if result:
    print(result)
else:
    print(f'{name} not found')

# the find_parent method, returns a *student* searched for by parent name
parent = 'Lisa Tommymom'
result = helper.find_parent(name)
if result:
    # you can still refer back to the parent from the student, if needed
    parent_name = result.primary_contact.name
    parent_email = result.primary_contact.email


# **************************************************
# ==== Send Emails Easily ====
# **************************************************

from teacherhelper import Email

# don't forget our variables defined above
tommy = result

with Email(username="me@site.com", password="supersecret") as eml:
    eml.send(
        to=tommy.primary_conteact.email,
        subject="Tommy Needs Spelling Help",

        # the emailer supports markdown input, and will inject the resulting
        # html into a default template, or a template that you can create!
        message=f"""Hello Ms. {tommy.primary_contact.name},

I noticed that {tommy.first_name} spelled his name like "tommey" on an
assignment recently. Here are some spelling tools I would recommend:

## List of Spelling Tools

| Name                      | Website                          |
| ------------------------- | -------------------------------- |
| Khan Academy              | https://www.khanacademy.org/     |
| Grammarly                 | https://www.grammarly.com/       |
| Webster Dictionary Online | https://www.merriam-webster.com/ |
"""
        cc=result.email
    )

Setup and Additional Docs

See ./docs

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

teacherhelper-1.0.0.tar.gz (16.3 kB view hashes)

Uploaded Source

Built Distribution

teacherhelper-1.0.0-py3-none-any.whl (17.8 kB view hashes)

Uploaded Python 3

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