pyinfra-dev / pyinfra

pyinfra turns Python code into shell commands and runs them on your servers. Execute ad-hoc commands and write declarative operations. Target SSH servers, local machine and Docker containers. Fast and scales from one server to thousands.
https://pyinfra.com
MIT License
3.91k stars 382 forks source link

Decide & document what operations/facts should/should-not cover #906

Open Fizzadar opened 2 years ago

Fizzadar commented 2 years ago

An always expanding builtin set of operations/facts is unmaintainable, it makes sense to decide where this should end and where operations as external packages should begin. Looking at the current set of operations I've roughly divided them as below, will discuss in separate comment:

Base System

Manage builtin system components ie file management, system package managers, system service managers, selnux. Anything considered the "core" of a target system/OS.

Extended System

Manage what are considered system components but that require installing ontop of a base system (ie brew on MacOS).

Both of the above could be grouped as "system" for simplicity.

User Software

Manage specific softwares that get installed in a system.

Other

Just the python.* operations which provide Python callback support.

Fizzadar commented 2 years ago

Looking at the list, one option would just be to say "system operations in, everything else out". But having things like postgresql builtin to pyinfra do seem very handy to have, if these were part of a pyinfra-database-operations package suddenly the barrier to entry is much greater. Likewise the git.* operations are such a common use-case it seems foolish to remove them from the "pyinfra stdlib".

The reason I bring this issue is because of https://github.com/Fizzadar/pyinfra/issues/904 which feels like it should not be part of the core, but then were do we draw the line? I have no answers :)

fliepeltje commented 1 year ago

I think with good documentation and a sane API for writing operations and fact definitions, you could experiment with community driven addons, a bit inspired by something like faker: https://faker.readthedocs.io/en/master/communityproviders.html

You could also consider subdividing feature sets into extras: https://peps.python.org/pep-0508/#extras

so it would be more like pip install pyinfra[postgres, nginx]