This project serves as a lab manager for the Levenson-Falk Lab at USC. Presently, it automates reminders for maintenance, snacks, and manages lab meeting schedules through emails, Slack and Google Calendar.
.github/
: Contains GitHub workflows for automation.calendar_manager.py
: Manages Google Calendar integration.config_loader.py
: Loads configuration from JSON files.email_notifier.py
: Handles email notifications.main.py
: The main script for managing notifications.slack_notifier.py
: Manages Slack notifications.duty_tracker.json
: Tracks the rotation of lab duties.
-
Local Setup:
- Install dependencies from
requirements.txt
. - Set up environment variables for Gmail, Slack, and Google Calendar credentials.
export GMAIL_USER=<email> export GMAIL_PASSWORD=<password> export SLACK_TOKEN=<token> export LAB_MEMBERS_INFO=<json file | base64> export GOOGLE_CALENDAR_SERVICE_KEY=<calendar service key | base64>
- Move/Generate the
token.pickle
for Google Calendar API on the local machine.
- Install dependencies from
-
PythonAnywhere Setup:
- Upload the script files to PythonAnywhere.
- Set up a scheduled task to run
main.py
daily at 7 AM using cron.- Cron file:
0 7 * * * /home/<username>/lfl-lab-manager/venv/bin/python /home/<username>/lfl-lab-manager/main.py
- Cron file:
- Ensure
client_secret.json
andtoken.pickle
are safely uploaded and handled.
-
Handling Authentication:
- The script checks the validity of
token.pickle
. - If re-authentication is required, it sends an email notification.
- Manually update
token.pickle
on PythonAnywhere after re-authenticating locally.
- The script checks the validity of
Note: For security, never store sensitive information like lab members' details and service keys in the repository.
The project can be configured to use the GitHub Action defined in .github/workflows/main.yml
to automate reminders.
Sensitive information is handled securely, and environment variables are used to store credentials.
Remember to keep the token.pickle
and client_secret.json
files secure and handle them carefully during deployment and updates.