Skip to content

Welcome to my personal notes

Multiple times I've managed to solve a new problem using an old solution, pleased to notice how much time I saved and how the quality of the final result has increased since the first time I had struggled with the original problem.

I know, it's simply the definition of the learning curve, but I've always been fascinated by how good the brain is in learning and storing new stuff!

In my daily work I often tend to go back and take a look at some old code that I or my colleges have written. Unfortunately this is not always possible, especially if your code is in your company's protected repositories and you are just sitting confortably on the couch, with your personal laptop on the lap, and the work laptop is in your work bag in the other room, or (much more reasonably) if you just changed job.

For this reason I've decide to collect here some guides, tutorials and personal notes that could be useful in the future.

Enjoy your reading! 📖

How to create an Azure Batch's Application Package automatically

While using Azure Batch, you may need to create an application package to run your applications in the cloud.

The creation can be done manually, generating and uploading a .zip file to the Azure Batch resource Portal. However, this process can be tedious and time-consuming, especially if you have multiple applications or need to update the package frequently, for instance at every new release (or hotfix!).

In this post we will cover how to automate the creation of an Azure Batch application package using a Python script.

Create a Comand line interface in few minutes

cli title

A command line interface could seem an ancient tool to all non expert users, nowadays used to fancy click and drop user interfaces. Nothing more wrong! It is also a valid tool to enhance your libraries and projects, reusable in bash scripts and ci/cd pipelines.

In this tutorial we will deep dive into the python click library and create a simple command line interface (CLI) to manage the settings value and interact with our project.

Manage settings with Pydantic

pydantic-image Pydantic is a wonderful library that allows to easily validate your data, simply defining a schema. It is highly customizable and can be used, for instance, to validate data coming from a POST request.

In this tutorial we will use it to create a Settings class whose fields can be changed in different ways, triggering any time the validation.