12 Must‑Try Python Libraries That Turn Boring Scripts into Fun Projects
Discover twelve addictive Python libraries—from tqdm progress bars to PyWhatKit automation—that the author used to transform late‑night experiments into powerful scripts, illustrating how each tool can boost productivity, simplify tasks, and make coding feel like an endless, rewarding rabbit‑hole.
I still remember that late night when I just wanted to "try" a new Python library. What started as a simple test turned into an all‑night coding session, adding features to a tool I never intended to build. That’s the magic of Python—it’s more than a language, it’s a rabbit hole you can’t stop exploring.
1. TQDM: A Hacker‑Style Progress Bar
Seeing a progress bar slide across the screen gives a satisfying feeling. With tqdm, even the most boring loops feel cinematic.
from tqdm import tqdm
import time
for i in tqdm(range(100)):
time.sleep(0.05)The first time I used tqdm was in a file‑copy script, just for fun. Since then, every long‑running script gets a cool progress bar, providing instant feedback that makes you never tolerate a loop without one.
2. Arrow: Easy Date and Time Handling
Handling dates and times in Python used to give me headaches—time zones, formats, parsing…a mess. Then I discovered arrow, which turned date‑time work into a breeze.
import arrow
dt = arrow.utcnow()
print(dt.shift(hours=5).format('YYYY-MM-DD HH:mm'))Now I automate reminders, schedule backups, and even rename files with timestamps. If you struggle with datetime, arrow feels like a fresh breeze.
3. Faker: Realistic Fake Data
In my first Django project I needed test users. Copy‑pasting "John Doe" a hundred times isn’t fun, so I turned to faker.
from faker import Faker
fake = Faker()
for _ in range(3):
print(fake.name(), fake.email())I started populating databases with fake addresses, credit cards, and company names. Testing became enjoyable rather than boring.
4. Fire: Turn Scripts into CLI Tools
I wrote a script to clean duplicate files on my laptop. Wanting to run it with different parameters without editing code led me to fire.
import fire
def greet(name="World"):
return f"Hello {name}!"
if __name__ == '__main__':
fire.Fire(greet)One line of code turns the script into a full command‑line interface, and I began writing mini‑CLIs for all my automation tasks.
5. Playwright Sync: Smooth Web Automation
Selenium is powerful but can be frustrating. Switching to Playwright sync made browser automation buttery smooth.
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
print(page.title())I went from crawling pages to auto‑filling forms and testing my own apps. The browser became a playground, not an obstacle.
6. PyInputPlus: Smarter User Input
Ever written a CLI script where users keep entering garbage? PyInputPlus solves that.
import pyinputplus as pyip
age = pyip.inputInt("Enter your age: ", min=1)
print(f"You are {age} years old.")No need to write validation logic yourself; the library handles it, making CLI tools robust.
7. PDFPlumber: Make PDFs Behave
I once needed to extract tables from a 200‑page PDF report. Manual copying was impossible, regex a nightmare. PDFplumber solved it.
import pdfplumber
with pdfplumber.open("report.pdf") as pdf:
first_page = pdf.pages[0]
text = first_page.extract_text()
print(text)What started as a one‑off task turned into PDF search tools, auto‑summary scripts, and even invoice analyzers.
8. Tenacity: Retry Until Success
APIs fail, networks drop. Without retries, scripts crash. tenacity makes retrying painless.
from tenacity import retry, stop_after_attempt
import random
@retry(stop=stop_after_attempt(3))
def flaky_task():
if random.random() < 0.7:
raise Exception("Failed!")
return "Success!"
print(flaky_task())In a crawler that kept disconnecting, tenacity rescued me—no more frustration.
9. IceCream: Cool Debug Printing
Print‑debugging is underrated. With icecream, it becomes addictive.
from icecream import ic
x = 42
ic(x * 2)It prints the expression and its value, turning debugging into a pleasant experience.
10. Schedule: Automate Your Life
I used schedule to create my first cron replacement. Simple and readable, it makes automation scripts effortless.
import schedule, time
def job():
print("Running task...")
schedule.every(10).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)From backups to reminders to health checks, my computer became a personal assistant running mini daemons.
11. Humanize: Make Numbers Talk
Raw numbers are boring. Humanize makes them readable.
import humanize
print(humanize.intcomma(1234567))
print(humanize.naturaltime(3600))In a logging script, it turned "3600 seconds" into "an hour ago", clarifying logs.
12. PyWhatKit: Automation Like Magic
Want to send a WhatsApp message or play a YouTube video from Python? PyWhatKit does it in one line.
import pywhatkit
pywhatkit.playonyt("Python automation tutorials")I once wrote a script that sent a random motivational quote via WhatsApp every morning at 9 am. Half‑joking, half‑serious, but it actually ran.
Summary
These libraries not only make me more efficient; they bring code to life. Every new library sparks an unplanned project, proving that Python’s ecosystem pushes you to experiment, automate, and tinker until you create something new.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
