Posts
-
How to reuse Pydantic model_validator across multiple models without boilerplate code?
Recently I’ve been working with Pydantic models quite a lot. And I mean multiple models with multiple fields and validators. I noticed that in some cases, reusing validators in some smart way would reduce my codebase by even hundredths of lines of code. So I tried to come up with a solution for that problem…

-
How to check whether Python script has elevated privileges?
It may happen that a Python script needs
rootprivileges on Linux / macOS oradminprivileges on Windows to run properly. If it does not have them, there is no point in continuing. Let’s see how to quickly check whether the current runtime has those privileges. -
>>> print("Hello World!")
subscribe via RSS