-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathresume_builder.py
More file actions
300 lines (257 loc) · 9.5 KB
/
resume_builder.py
File metadata and controls
300 lines (257 loc) · 9.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
from prompt_toolkit import prompt
from prompt_toolkit.shortcuts import button_dialog
from fpdf import FPDF
import os
# To clear the terminal after selecting a section
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
# Resume data storage
resume_data = {
"contact_info": {},
"experience": [],
"education": [],
"skills": [],
"projects": [],
"certifications": [],
"achievements": [],
"internships":[]
}
# Function to navigate back to the main menu
def back_to_menu():
print("\nReturning to main menu...")
# Add contact information
def add_contact_info():
clear_screen()
print("Enter Contact Information")
resume_data["contact_info"]["name"] = prompt("Name: ")
resume_data["contact_info"]["email"] = prompt("Email: ")
resume_data["contact_info"]["phone"] = prompt("Phone: ")
resume_data["contact_info"]["address"] = prompt("Address: ")
resume_data["contact_info"]["linkedin"] = prompt("LinkedIn URL: ")
resume_data["contact_info"]["github"] = prompt("GitHub URL: ")
back_to_menu()
# Add work experience
def add_experience():
while True:
clear_screen()
print("Enter Work Experience")
experience = {
"title": prompt("Job Title: "),
"company": prompt("Company: "),
"start_date": prompt("Start Date (e.g., June 2024): "),
"end_date": prompt("End Date (or type 'Present' if still working): "),
"details": prompt("Details (comma-separated): ").split(',')
}
resume_data["experience"].append(experience)
# Ask user if they want to add more experience entries
more = prompt("Do you want to add more work experience? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# Add education details
def add_education():
while True:
clear_screen()
print("Enter Education Information")
education = {
"degree": prompt("Degree (e.g., B.Tech in CSE): "),
"institution": prompt("Institution: "),
"start_year": prompt("Start Year: "),
"end_year": prompt("End Year: ")
}
resume_data["education"].append(education)
# Ask user if they want to add more education entries
more = prompt("Do you want to add more education? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# Add skills
def add_skills():
clear_screen()
print("Enter Skills (comma-separated): ")
resume_data["skills"] = prompt("Skills: ").split(',')
back_to_menu()
# Add projects
def add_projects():
while True:
clear_screen()
print("Enter Projects Information")
project = {
"name": prompt("Project Name: "),
"description": prompt("Description: "),
"technologies": prompt("Technologies Used: ")
}
resume_data["projects"].append(project)
# Ask if they want to add more projects
more = prompt("Do you want to add more projects? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# Add certifications
def add_certifications():
while True:
clear_screen()
print("Enter Certifications")
certification = {
"name": prompt("Certification Name: "),
"provider": prompt("Provider: "),
"year": prompt("Year: ")
}
resume_data["certifications"].append(certification)
more = prompt("Do you want to add more certifications? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# Add achievements
def add_achievements():
while True:
clear_screen()
print("Enter Achievements")
achievement = prompt("Achievement: ")
resume_data["achievements"].append(achievement)
more = prompt("Do you want to add more achievements? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# Add internships
def add_internships():
while True:
clear_screen()
print("Enter Internship Information")
internship = {
"role": prompt("Role/Title: "),
"company": prompt("Company: "),
"location": prompt("Location (optional): "),
"start_date": prompt("Start Date (e.g., Jun 2024): "),
"end_date": prompt("End Date (e.g., Aug 2024 or 'Present'): "),
"details": [s.strip() for s in prompt("Highlights (comma-separated): ").split(",") if s.strip()]
}
resume_data["internships"].append(internship)
more = prompt("Add another internship? (yes/no): ").strip().lower()
if more == "no":
break
back_to_menu()
# PDF Generation class
class ResumePDF(FPDF):
def header(self):
self.set_font('Arial', 'B', 14)
self.cell(0, 10, resume_data["contact_info"]["name"], 0, 1, 'C')
self.set_font('Arial', 'I', 12)
self.cell(0, 10, resume_data["contact_info"]["email"], 0, 1, 'C')
self.cell(0, 10, resume_data["contact_info"]["phone"], 0, 1, 'C')
self.cell(0, 10, resume_data["contact_info"]["address"], 0, 1, 'C')
def add_section(self, title, content):
self.set_font('Arial', 'B', 12)
self.cell(0, 10, title, 0, 1)
self.set_font('Arial', '', 11)
for line in content:
self.cell(0, 10, line, 0, 1)
# PDF Generation
def generate_pdf():
pdf = ResumePDF()
pdf.add_page()
# Contact Information
contact = resume_data["contact_info"]
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, f"{contact['name']} - {contact['email']}", 0, 1)
pdf.cell(0, 10, f"Phone: {contact['phone']} - Address: {contact['address']}", 0, 1)
pdf.cell(0, 10, f"LinkedIn: {contact.get('linkedin', 'N/A')} - GitHub: {contact.get('github', 'N/A')}", 0, 1)
# Work Experience
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Experience", 0, 1)
pdf.set_font('Arial', '', 11)
for exp in resume_data["experience"]:
details = ', '.join(exp["details"])
pdf.cell(0, 10, f"{exp['title']} at {exp['company']} ({exp['start_date']} - {exp['end_date']})", 0, 1)
pdf.multi_cell(0, 10, f"Responsibilities: {details}")
# Education
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Education", 0, 1)
pdf.set_font('Arial', '', 11)
for edu in resume_data["education"]:
pdf.cell(0, 10, f"{edu['degree']} from {edu['institution']} ({edu['start_year']} - {edu['end_year']})", 0, 1)
# Skills
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Skills", 0, 1)
pdf.multi_cell(0, 10, ', '.join(resume_data["skills"]))
# Projects
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Projects", 0, 1)
pdf.set_font('Arial', '', 11)
for proj in resume_data["projects"]:
pdf.cell(0, 10, proj["name"], 0, 1)
pdf.multi_cell(0, 10, proj["description"])
pdf.cell(0, 10, f"Technologies Used: {proj['technologies']}", 0, 1)
# Internships
if resume_data["internships"]:
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Internships", 0, 1)
pdf.set_font('Arial', '', 11)
for it in resume_data["internships"]:
hdr = f"{it['role']} at {it['company']}"
if it.get("location"):
hdr += f" — {it['location']}"
pdf.cell(0, 10, f"{hdr} ({it['start_date']} - {it['end_date']})", 0, 1)
if it.get("details"):
pdf.multi_cell(0, 10, "Highlights: " + ", ".join(it["details"]))
# Certifications
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Certifications", 0, 1)
pdf.set_font('Arial', '', 11)
for cert in resume_data["certifications"]:
pdf.cell(0, 10, f"{cert['name']} by {cert['provider']} ({cert['year']})", 0, 1)
# Achievements
pdf.set_font('Arial', 'B', 12)
pdf.cell(0, 10, "Achievements", 0, 1)
pdf.set_font('Arial', '', 11)
for ach in resume_data["achievements"]:
pdf.cell(0, 10, ach, 0, 1)
# Save PDF
pdf_output_path = "generated_resume.pdf"
pdf.output(pdf_output_path)
# Auto-open PDF after generation
os.system(f"start {pdf_output_path}" if os.name == "nt" else f"open {pdf_output_path}")
print(f"Resume generated: {pdf_output_path}")
# Main Menu using button_dialog from prompt_toolkit
def interactive_menu():
while True:
clear_screen()
choice = button_dialog(
title="Interactive Resume Builder",
text="Please choose a section to modify:",
buttons=[
("Contact Info", 1),
("Work Experience", 2),
("Education", 3),
("Skills", 4),
("Projects", 5),
("Internships", 6),
("Certifications", 7),
("Achievements", 8),
("Generate PDF", 9),
("Exit", 10)
]
).run()
if choice == 1:
add_contact_info()
elif choice == 2:
add_experience()
elif choice == 3:
add_education()
elif choice == 4:
add_skills()
elif choice == 5:
add_projects()
elif choice == 6:
add_internships()
elif choice == 7:
add_certifications()
elif choice == 8:
add_achievements()
elif choice == 9:
generate_pdf()
elif choice == 10:
break
# Start the program
if __name__ == "__main__":
interactive_menu()