Realesagent
A light-hearted Python package that mimics student and professor email responses in a university class. Generate student excuses, apologies, grade requests, and extension emails based on different personal factors, such as grades, deadlines, and desperation levels. You can also simulate professor responses in different tones, including strict, sympathetic, and sarcastic.
PyPI: https://pypi.org/project/realesagent/
Team members
Installation
Requires Python 3.11 or newer.
pip install realesagent
If pip isn't found, use python -m pip install realesagent.
Then import it in your own code:
import realesagent
You can also import individual modules or functions:
from realesagent import excuses
from realesagent import generate_excuse
Contributing
On Windows, use python or py in place of python3. If pipenv isn't found, run python -m pipenv.
Install Python 3.11 or newer from Python downloads.
Install Git from Git downloads.
Install pipenv from Pipenv documentation:
pip install pipenv
Clone the repository and install the development dependencies:
git clone https://github.com/software-students-fall2026/python-package-exercise-realesagent.git
cd python-package-exercise-realesagent
pipenv install --dev
pipenv run pytest
pipenv run python -m build
This installs the package in editable mode, so changes made in src/realesagent/ take effect immediately.
To run a single test file:
pipenv run pytest tests/test_emails.py
Every pull request is automatically built and tested using GitHub Actions on two Python versions.
Example Program
See examples/demo.py, which demonstrates the functions available in the package.
If you cloned the repository, run the example from the repository root:
pipenv run python examples/demo.py
Functions
Student Functions
Measure how desperate a student is, and turn the honest truth into professional language.
student.desperation_level(grade, hours_until_deadline, missing_assignments)
Calculates a desperation score from 1 (calm) to 10 (panic) based on the student's situation.
grade(int or float, 0–100): the student's current grade. Lower grades raise the score.hours_until_deadline(int or float): hours until the deadline. 48 or fewer raises the score; 0 or below (already late) raises it most.missing_assignments(int, 0 or more): number of missing assignments. Each adds 1 point, up to 3.
Returns: int from 1 to 10.
Raises:
TypeErrorifgradeorhours_until_deadlineis not a number, ormissing_assignmentsis not an integer.ValueErrorifgradeis outside 0–100, a number is infinite or NaN, ormissing_assignmentsis negative.
from realesagent import student
print(student.desperation_level(grade=90, hours_until_deadline=36, missing_assignments=7))
Output:
6
student.professionalize(truth)
Rewrites an honest explanation as a formal-sounding one. It recognizes oversleeping, forgetting, procrastinating, internet/Wi-Fi problems, and the dog eating your homework. Anything else gets a generic formal statement.
truth(str): what actually happened. Extra whitespace is ignored.
Returns: str, the professional version.
Raises:
TypeErroriftruthis not a string.ValueErroriftruthis empty or only whitespace.
from realesagent import student
print(student.professionalize(truth="My internet connectivity failed and I was too lazy to do anything about it."))
print(student.professionalize(truth="I was at a concert."))
Output:
I experienced an unexpected interruption to my digital connectivity.
I wish to formally report the following circumstance: "I was at a concert.". I respectfully request your consideration while I address this matter.
Excuses Functions
Generate excuses, grade requests, and apologies. generate_excuse and grade_beg pick a message at random, so your output may differ from the examples.
excuses.generate_excuse(assignment)
Returns a random excuse for not finishing an assignment. Some excuses mention the assignment by name.
assignment(str): the name of the assignment.
Returns: str, one randomly chosen excuse.
from realesagent import excuses
print(excuses.generate_excuse(assignment="Web Development Project"))
Output:
I was dealing with a family emergency. The family member was me, and the emergency was Web Development Project.
excuses.grade_beg(current_grade, desired_grade, professor_name)
Writes a complete email asking a professor to raise your grade, with a randomly chosen plea in the middle.
current_grade(int or float): your current grade, shown as a percentage.desired_grade(int or float): the grade you're hoping for.professor_name(str): the professor's name for the greeting.
Returns: str, the full email.
from realesagent import excuses
email = excuses.grade_beg(current_grade=70, desired_grade=100, professor_name="John Smith")
print(email)
Output:
Dear Professor John Smith,
I hope you are doing well. I am writing regarding my current grade of 70%.
I humbly ask that you consider the possibility that my grade is simply a passing grade experiencing a difficult time.
I was hoping you might consider adjusting my grade to 100%. I completely understand if this is not possible, but I figured it was worth one final attempt before I start looking into alternative career paths.
Thank you for your time, patience, and continued tolerance of my academic journey.
Best regards,
A Student Who Is This Close
excuses.apology_multiplier(email, desperation)
Adds an apology to the start of an email. The higher the desperation, the more dramatic the apology.
email(str): any message to put the apology in front of.desperation(int, 1–10): how intense the apology is. Values below 1 are treated as 1, and above 10 as 10.
Returns: str, the apology, a blank line, then the original email.
from realesagent import excuses
print(excuses.apology_multiplier(email="Can I have an extension?", desperation=7))
Output:
I sincerely, deeply, emotionally, and spiritually apologize. I have disappointed myself, my family, my ancestors, and possibly the entire academic community.
Can I have an extension?
excuses.absence_excuse(class_name)
Generates a humorous excuse for missing a class.
class_name(str): the name of the class that was missed.
Returns: str, an apology followed by a randomly selected excuse for the absence.
from realesagent import excuses
print(excuses.absence_excuse("English"))
Example output:
I am sorry I missed English. I missed class after losing an argument with my alarm, and unfortunately, it had the stronger case.
Emails Functions
Write subject lines and extension requests whose tone matches how bad the situation is.
emails.subject_line(situation, urgency)
Creates an email subject line that gets more dramatic as urgency rises.
situation(str): what the email is about.urgency(int, 1–5): 1 is a casual question, 5 is a full emergency.
Returns: str, the subject line, or "Invalid urgency level" if urgency is not 1–5.
from realesagent import emails
print(emails.subject_line(situation="the midterm", urgency=1))
print(emails.subject_line(situation="the midterm", urgency=5))
Output:
Quick Question About the midterm
PLEASE READ BEFORE I BECOME A CAMPUS URBAN LEGEND: the midterm
emails.extension_request(days_late, professor_name)
Writes an extension request email. The message changes depending on how late the assignment is: on time (0), 1–2 days, 3–5 days, 6–10 days, or more than 10.
days_late(int, 0 or more): how many days past the deadline.professor_name(str): the professor's name for the greeting.
Returns: str, the full email.
Raises: ValueError if days_late is negative or professor_name is empty.
from realesagent import emails
print(emails.extension_request(days_late=3, professor_name="Jacob Williams"))
Output:
Dear Professor Jacob Williams,
I realize this assignment was due several days ago. I've spent those days reflecting on my choices rather than making better ones.
Best,
A Student With Excellent Intentions
Responses Functions
Simulate how a professor might reply to your email.
responses.professor_reply(email, tone="strict")
Generates a professor's reply that quotes your message and responds in the chosen tone.
email(str): the student's message. Extra whitespace is collapsed.tone(str, default"strict"): one of"strict","sympathetic", or"sarcastic".
Returns: str, the professor's reply.
Raises:
TypeErrorifemailortoneis not a string.ValueErrorifemailis empty ortoneis not one of the three options.
from realesagent import responses
informal_email = "Yo prof, I have a C rn but I need an A to graduate. Can you help a brother out. Thanks man."
print(responses.professor_reply(email=informal_email))
print(responses.professor_reply(email=informal_email, tone="sarcastic"))
Output:
Dear Student,
Regarding your message: "Yo prof, I have a C rn but I need an A to graduate. Can you help a brother out. Thanks man."
As stated in the syllabus, the course policies still apply.
Best,
Your Fictional Professor
Dear Student,
Regarding your message: "Yo prof, I have a C rn but I need an A to graduate. Can you help a brother out. Thanks man."
A remarkable plot twist. Unfortunately, the syllabus has declined to rewrite itself.
Best,
Your Fictional Professor
Valid Options
Desperation levels: 1–10
Urgency levels: 1–5
Professor tones: strict, sympathetic, sarcastic
Configuration
No environment variables, databases, or secret configuration files are needed.
Metadata
Release files for realesagent 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| realesagent-0.1.1.tar.gz | 26.0 kB | Without provenance | Details for realesagent-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| realesagent-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for realesagent-0.1.1-py3-none-any.whl |
Total release size: 48.7 kB
Release files / realesagent-0.1.1.tar.gz
| Download URL | realesagent-0.1.1.tar.gz |
|---|---|
| Size | 26.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caa1964bc74cc9f8cc9910de87c1e82ff111b86edb8d4c55039e9aca0a03185c
|
|
BLAKE2b-256 checksum How to use checksums |
2c03cf66e7263bacbc74d4ef0203519667bd2b36c9dab89c8c119577bed66e24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / realesagent-0.1.1-py3-none-any.whl
| Download URL | realesagent-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6968dbd20dc84a96436d7e2aa0a9c20f2036b2499a144b454d7279be2cfd2908
|
|
BLAKE2b-256 checksum How to use checksums |
32b4ce673664b68b5ef00b6fa97f808dbf6fbed33227403badbb03697979c48e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for realesagent 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.