Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Pyinfra: Turns Python code into shell commands and runs them on your servers (github.com/pyinfra-dev)
12 points by klaussilveira 6 months ago | hide | past | favorite | 8 comments


Despite not using it in production yet, I sponsor this project as I want it to succeed - I just need to find the time to move years of carefully crafted Ansible roles over and above way of making our internal modules nicely composable.


I don't have anything insightful to add but I do want to say that after years of ansible et al, pyinfra is an absolute breath of fresh air.


How does it compare to fabric ? I used neither of those. I'm quite proficient in ansible and fine with it but always interested in alternatives.


They're sort of different things. I think of fabric as more of a remote shell, but pyinfra is exactly analogous to ansible.


Is the shell faster than Python

I don't use Python as it's too slow for me, e.g., the startup time for the interpreter


pyinfra is for running things across a number of machines and/or containers. For example to provision them, much like Ansible. So Python's startup time isn't terribly relevant.

Also, have you tried Python's startup time in the last decade or so? On my 2-year old, $150 computer with an Intel N100 (a very low-end CPU) running Ubuntu, `python3 -c "print('hello')"` takes 15ms. On my 8-year old Mac mini, it's 35ms. Both are significantly faster than what humans perceive as instantaneous, so Python's startup time is more than fast enough for many things.


When I use the phrase "too slow" I am referring to being slow _relative to other interpreters_ I use, such as the Almquist shell intepreter (NetBSD sh or Debian's dash), the ngn-k interpreter, the spitbol interpreter, the dino interpreter, the lua interpeter, etc.

HN commenters often state that "Python is (pre)installed everywhere"

This is not true on the computers I operate. For example, there is no python interpreter in NetBSD's base.tgz

Here we see a project that uses Python to run the shell, even though, if HN commenters are correct, "Python is (pre)installed everywhere"

Of course, the shell _is_ preinstalled everywhere and this project relies on that fact

IME, the shell and other interpreters are much faster than Python for what I need to do

I am aware of Python's current speed as it is sometimes a compile-time requirement for third party software that I am compiling. I remove Python after I am done


Also, Python versus sed and AWK intepreters




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: