|
|
|
|
|
by karlicoss
1500 days ago
|
|
I stopped worrying and in most cases just write configs for my tools in python. Then you can just import/exec it and you're done.
I can use all the operations/primitives I already know in Python: string interpolation & operations, loops, Pathlib, imports etc.
I can use mypy and all the other existing linting tools to make sure my configuration is correct without having to write a custom linter (and basically reimplement 10% of mypy). Shameless plug if you wanna read a longer analysis: https://beepb00p.xyz/configs-suck.html A great example is pyinfra https://github.com/Fizzadar/pyinfra#readme Think Ansible but instead of YAML you write Python. It provides a set of primitives/DSL and some rules you need to adhere to, but otherwise you just write regular python code. |
|