May 20, 2021

Enrich Test Coverage With Contexts

Hold on tight, now I expect a lot of us: We all test our code use coverage strive for 100% test coverage So, what’s missing? I miss some context 100% test coverage is great, but sometimes we need more information. e.g. which test covers line XXX? In sufficiently complex code bases, with mixed unit and integration tests, this is no longer easy to find out. Sure, you can set a breakpoint and run your tests and wait until the breakpoint has been hit....

May 12, 2021

Hugo and GitHub Pages - Welcome in the Land of Confusion

Yesterday, I migrated my blog to Hugo. GitHub Pages While the migration was straight forward, I was a bit puzzled with the deployment process to GitHub. For those who don’t know yet, GitHub enables all users to have an own website, called GitHub Pages, with a URL like https://your-user-name.github.io. Previously I used Lektor. The source code for my site lived in https://github.com/jugmac00/jugmac00.github.io.source, and was deployed by Lektor to https://github.com/jugmac00/jugmac00.github.io. Easy enough....

May 9, 2021

Bite My Shiny Type Annotated Library

How do you make type annotations available to the users of your library? Well, you just type annotate your library, right? No! But let’s step back for a moment. Flask 2.0 goes full type annotations This morning I read David Lord’s announcement that Flask, Jinja, Click, Werkzeug, MarkupSafe, and ItsDangerous are now fully type annotated, and new releases will be available next week. Ok, as I typed Flask-Reuploaded almost a year ago, I certainly noticed that Flask was not typed back then, but external type information was provided via typeshed, which I remember lively, as I had to add a missing type annotation for Werkzeug....

March 1, 2021

Testing the tox 4 Pre-Release at Scale

Every once in a while, you may read that one of your favorite used packages announces a new version. Sometimes even a so-called alpha version is announced. The maintainers then politely ask you, the user, to test the package, and give feedback if anything is broken. When the upcoming pytest version 6 had been announced, I wrote a short instruction on how to install pre-releases. This time, tox, the virtualenv management and test tool, announced a new version 4, but it is not just a new version, it is a complete rewrite by Bernát Gábor!...

October 30, 2020

Convincing an Enterprisy App to Work Behind nginx as Reverse Proxy

For simplicity, let’s the call the app Dated HR, a tool to “Simplify your HR work”, which offers support for time tracking, holiday, payroll… So far so good, and even better, as it is an enterprisy Windows software, which needs to be configured with IIS and a MSSQL database, a colleague of mine installed it on an internal Windows server. The app makes a web GUI available under http://nemesis.company.local, which would work like a charm - for our colleagues at site, but not for the colleagues from the other sites....

October 29, 2020

How to Run a Dockerized Service via systemd

Until recently, I saw no good reason to use Docker, as my deployment tool of choice produces approximately identical builds, locally on my Ubuntu laptop, on staging and on production. But time does not stand still and especially as I have to deploy a Java application, it was time to rethink my strategy, as I do not want to play the which Java runtime environment plays nicely together with which app version game....

October 28, 2020

How to Create Hundreds of Pull Requests With a Single Command

.. or “How to win #hacktoberfest”? Seriously… #hacktoberfest is no longer cool ( Hacktoberfest is Hurting Open Source ) you cannot win it anyway the mass pull requests I created (see below) went all to repositories, which do not take part at #hacktoberfest note If you are not interested in the story behind, I also created a concise “today-I-learned” post. prologue The company I work for has been using Zope, the grand-daddy of Python web application servers, for more than 15 years....

June 28, 2020

Flask Reuploaded

It all started with this error message: File "/Projects/xxx/venv/lib/python3.7/site-packages/flask_uploads.py", line 26, in <module> from werkzeug import secure_filename, FileStorage ImportError: cannot import name 'secure_filename' from 'werkzeug'' Trying to build my Flask application, the above error message was generated, as Werkzeug, a very important library in the Flask ecosystem, changed its API in version 1.0, back in February 2020. This broke a lot of plugins. Twitter thread As my app relies on Flask-Uploads, I had a look at the problem and finally provided a pull request to the Flask-Uploads repository on GitHub....

April 8, 2020

Log Rotation for Python Applications - Without killing them softly

A couple of days after a successful deployment of my Zope 4 application, I noticed something worrisome. Zope gets killed every night, shortly after midnight. I use Supervisor, which monitors the process and restarts it, so that’s not the problem. But there are two problems: I did not trigger this on purpose. The cache of my app is cold, that means that my colleagues get slow response times for the first queries in the morning....

February 23, 2020

isort and pre-commit - a friendship with obstacles

Note This post is not intended to be an exhaustive introduction to pre-commit and its hooks. Please visit pre-commit.com for a complete documentation. In a nutshell… pre-commit From its website: A framework for managing and maintaining multi-language pre-commit hooks. Very simplified this means, whenever you try to commit changes in your project (e.g. entering git commit), pre-commit runs all configured tools (e.g. linter, formatter, …), and only if they run successfully, your commit will be executed - otherwise your commit will fail....