Pacify Reference
Complete documentation for all source files in the Pacify CLI tool. Covers the data layer, login/storage module, email automation, and the full interactive menu system.
Dictionary-based local storage. Holds all user/object records as a Python list of dicts.
Interactive data entry & file persistence. Collects objects and writes them to Data.py.
Entry point. Contains all CLI functions: find, edit, email-all, email-specific, and the menu loop.
Installation #
Get started by cloning the repository from GitHub.
1. Install Dependencies
pip install prettytable
# smtplib and email are part of the Python standard library
# No extra install needed for those
2. Project Structure
├── main.py # Entry point — run this
├── Data.py # Data store (auto-managed)
├── Login_page.py # Login / data entry module
└── Background.py # ASCII art / branding assets
main.py from a different folder will cause ModuleNotFoundError.
Quick Start #
Get Pacify running in under 2 minutes.
On first run, Pacify detects empty data and prompts you to add objects.
How many object are there?: 2
Enter the name of object 0: Alice
Enter the ID of object 0: ID_001
Enter the email of object0: alice@example.com
On subsequent runs, Pacify shows your total record count and the main options table. Type a number to execute an action.
Data.py at startup and doesn't hot-reload.
The flat-file data store. This file is the single source of truth for all object records and is read + written by both Login_page.py and main.py.
Data Schema
{
'Name': 'Bob',
'ID': '88',
'E-mail': 'bob@example.com'
},
# … more records appended here automatically
]
Field Reference
Data.py while Pacify is running. The script loads this file once at startup — runtime edits will not be reflected until restart.
Defines the Login_Section class, which handles interactive data entry and persists records to Data.py.
Class: Login_Section
Prompts the user to enter N objects interactively. Each object requires a name, ID, and email. After all entries, the entire User_data_1 list (including pre-existing records) is written back to Data.py.
self.students = int(input("How many object are there?: "))
for i in range(self.students):
self.name = input(f"Enter the name of object {i}: ")
self.id = input(f"Enter the ID of object {i}: ")
self.email = input(f"Enter the email of object{i}: ")
Data.User_data_1.append({...})
# Writes updated list to Data.py after each entry
- Writes
Data.pyafter every object, so partial data is never lost mid-run. - Appends to the in-memory
User_data_1list first, then persists the whole list. - Requires a restart after saving for changes to be picked up by other functions.
Overwrites Data.py with an empty list. This is irreversible — all stored records will be permanently deleted.
with open("Data.py", "w") as file:
file.write("User_data_1 = []")
print("Your data removed successfully! Restart your software again.")
The primary script. Imports all modules, checks data state, and runs the interactive menu loop. Contains four core functions for data lookup, editing, and email dispatch.
Startup Flow
search Find_the_object() #
Searches User_data_1 for a record matching a given ID and prints it as a formatted table.
Programm = True
while Programm:
user_input = input("Type the ID of the object: ")
for object in Data.User_data_1:
if object['ID'] == user_input:
# Builds PrettyTable and prints result
Object_found = True
edit Edit_details() #
Finds a record by ID, shows its current values, and lets the user overwrite Name, ID, and Email. Persists changes to Data.py immediately using pformat.
user_id = input("Enter the Id of the person you want to edit: ")
# Step 2: Confirm via Y/N prompt
user_id = input("Did you want to edit this object? (Y/N): ").lower()
# Step 3: Accept new values and mutate in-memory dict
person['Name'] = user_name
person['ID'] = user_id
person['E-mail'] = user_email
# Step 4: Persist using pformat (preserves dict structure)
with open("Data.py", "w") as file:
file.write("User_data_1 = ")
file.write(pformat(Data.User_data_1))
programm_running = True, allowing you to edit multiple records in one session without restarting.
mail Email_all_obeject() #
Sends an identical email to every record in User_data_1 via Gmail SMTP. Uses TLS on port 587.
server.starttls() # Upgrade to TLS
server.login(Email, app_password) # Gmail + App Password
for user_sender in Data.User_data_1:
msg = EmailMessage()
msg["To"] = user_sender["E-mail"]
server.send_message(msg)
print(f"Email sent to ID: {user_sender['ID']}")
server.quit()
Inputs Collected
forward_to_inbox Email_specific_object() #
Targets a single record by ID and sends it a custom email. Prompts for confirmation before sending.
for datum in Data.User_data_1:
if datum['ID'] == user_id:
ask_user = input("Did you want to email this object? (Y/N): ")
if ask_user == "y":
# Collect sender details and dispatch
else branch prints "I didn't find the object" for every non-matching record in the loop before the match is found. This can be fixed by removing the else: break and relying on the Object_found flag.
CLI Options #
The interactive menu displayed after startup. Type the corresponding number and press Enter to execute.
Login.CLEAR_DATA(). Wipes Data.py completely. Irreversible.Email_all_obeject(). Sends one email to every record. Requires Gmail + App Password.Email_specific_object(). Prompts for an ID, shows the record, then sends on confirmation.Edit_details(). Find by ID, confirm, then update Name, ID, and Email. Persists to Data.py immediately.Find_the_object(). Loops until a matching ID is found or the user force-quits (Ctrl+C).Error Handling #
Common errors you may encounter and how to resolve them.
except block in both email functions.Background.py exports both pacify and Login_logo variables.Login_page.py appends records with the key 'Email' but main.py reads using 'E-mail'. The file writer normalizes this correctly — ensure you always use the CLI to add records, never edit Data.py manually with the wrong key.