Skip to main content
Marcel Krčah

Generating tax reports with Python, Jinja, and Click

Published on , in ,

Every month I need to create a tax report using this ancient government website. Facing the choir, I found myself procrastinating every month, and this procrastination had been draining my energy. So I decided to face my daemons.

Encouraged by my last automation project, I discovered it is possible to semi-automate the choir. It turned out the website supports uploading the reports in XML format. It also turned out that my invoicing system provides REST API. I was onto something.

So I summoned my favorite tools for file generation—Python and Jinja —and added Click to the mix. The result is a CLI tool that extracts invoices from the API and generates the XML report.

While coding, I discovered new delightful things about Jinja and Click:

I spent two evenings coding. Strictly from the time perspective, it was probably not an optimal investment. But when I generated my first report, I noticed a stark difference in my mood: I enjoyed the choir.

This blog is written by Marcel Krcah, an independent consultant for product-oriented software engineering. If you like what you read, sign up for my newsletter