This repository contains Python scripts for fetching emails and processing email rules. Below are the instructions for setting up the virtual environment and running the provided scripts using a Makefile or from a terminal.
conf
: Holds files likeconfig.yml
,credentials.json
, andrules.json
.src
: Stores Python scripts.tests
: Includes Python unit & mocked e2e tests.Makefile
: Provides commands for convenient setup and script execution.requirements.txt
: Lists project dependencies.requirements-test.txt
: Lists test dependencies.
Make sure you have miniconda
, make
and PostgreSQL
(if you are using local server) installed on your system. Python 3.10 or above is needed.
To create a Python virtual environment using miniconda, run:
make init
The install
command installs the both project and test dependencies
make install
The test
command executes mocked tests and generates a coverage report:
make test
To avoid import errors, mark the src
directory as Sources Root
and tests
directory as Test Sources Root
.
If you are using Pycharm, right click on the directory and then choose Mark Directory As
.
- Follow the steps mentioned in Setting up OAuth 2.0
page to generate the client secret and store the json file as
credentials.json
underconf
directory. - Modify the script configurable parameters as per your need which is located in
conf/config.yml
. - If you are using local PostgreSQL server, ensure the server is running. Please store the DB password in the environment variable
POSTGRESQL_DB_PASSWORD
.
To run the fetch emails script, execute the following command.
python src/fetch_emails.py
OR
make run_fetch_emails
To run the email rule processor script, execute the following command.
python src/email_rule_processor.py
OR
make run_email_rule_processor