Import anything from a Python module
Today, thanks to Vincent Warmerdam, I discover a really neat Python trick.
You can basically import anything from a Python module i.e., any Python object, just by defining the module's __getattr__
method.
Today, thanks to Vincent Warmerdam, I discover a really neat Python trick.
You can basically import anything from a Python module i.e., any Python object, just by defining the module's __getattr__
method.
Today, thanks to PyCoder's Weekly, I discovered this blog post and more generally learned about design by contract (DbC) methodology.
Inspired from it, I decided to write down a simple snippet to implement preconditions and postconditions through Python decorators.
I am working on a super-opinionated solution to assume AWS roles via STS, both programmatically and to log into AWS Console. While searching in the Python ecosystem utilities to build CLI and GUI with, I discovered three libraries that offer a great user experience both for the end users and the developers that build with them.
Decorators are well known examples of Python syntactic sugar, which basically let you change the behaviour of a function without modifying its definition, thanks to a handy syntax based on the @
symbol followed by the decorator name, everything put just above your function definition.
Sometimes, however, you can't exploit this syntax, for example because you don't have the function definition at your disposal - let's think at the case in which the function you want to decorate lives in another codebase (the latter might be one of the libraries your project depends on).
Today I rediscover an amazing tool: pandoc, which correctly presents itself as
your swiss-army knife to convert files from one markup format into another.
In these days I am working on the redaction of a complex tender notice, which must be delivered as an editable docx
and then exported (with all the fancy stuff and theming) into pdf
. Unfortunately, I find the user experience of writing documents with Microsoft Word really unsatisfying and cluttered.
If you have an already up-and-running Typer app, you might want to extend it to some sort of GUI (Graphical User Interface).
While building a full GUI can be time-consuming, there is a really fast utility which can be adopted to get somewhere in between.
There are several recommended options to perform a cross-account full copy of a DynamoDB table.
It seems reasonable to compare these options based on several different properties: setup time (low is better), approach (serverless is better), involved resources (few is better), costs estimate (low is better) and new code possibly required (none is better).
Se si usano window functions (es. LAG
) per calcolare delta tra timestamp Unix, il risultato "ignora" eventuali switch di ora legale/solare (correttamente, dato che un timestamp Unix conta esclusivamente il tempo che scorre).
Suppose you have a CodeBuild project triggered by a push on a given branch of a linked CodeCommit repo. If the build is particularly heavy, you might want to ensure its correctness before an actual commit to the related repo - for example, you might be interested in testing the build process specified in buildspec.yml
locally.