Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Built a Python CLI Toolbox Instead of Writing One-Off Scripts

Whenever I ask an AI assistant to do a small task, it writes a quick Python script for me. Convert an image. Compress a PDF. Convert a CSV to Excel. The script works, I use it once, and then it disappears. At some point I thought: Why keep asking for one-off scripts when I could build my own reusable toolbox? So I did. Toolbox is a small Python CLI with utilities for the file and image tasks I…

A Python developer built a command-line interface (CLI) toolbox to replace one-off scripts for common file and image tasks. The project, named Toolbox, includes utilities for converting CSV files to Excel, manipulating images, and compressing PDFs. The developer, who had recently completed the freeCodeCamp Python certification, used Python's package manager, uv, to manage dependencies and create virtual environments.

This approach eliminated the need for manual lockfile generation and virtual environment setup, making the development process smoother. The CLI structure follows a simple organization, with commands, utilities, and tests in their respective folders. The developer utilized Python's standard library, argparse, for argument parsing and OpenPyXL for Excel conversions.

For image processing, Pillow was used, while PyMuPDF and Pillow were combined for PDF compression. The rasterization technique is employed when normal compression fails to reduce the file size significantly, as it converts the PDF to images, compresses them, and then rebuilds the PDF.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Migrating from crontab: five everyday schedules, translated into Kairos

If you arrived from the Kairos 1.0 announcement , this is the hands-on one: take a crontab you already have and translate it.

  • Translate crontab schedules to Kairos language for non-fixed-time repeats
  • Define calendar system and time zone before creating Kairos schedules
  • Run translated schedules with one crontab line checking for points daily

My parser reported a parse error on a file that was never malformed

A build step that reads requirement tables out of a document reported this, every run: FAIL_MAP reason=parse reason=parse has an obvious reading.

  • Parser misidentified 256 well-formed rows as paragraphs
  • Reason code should indicate zero structured forms, not file malformation
  • Derived artifacts must be regenerated from committed state

More from Sunday 13 September →