pyinfra automates/provisions/manages/deploys infrastructure.
Actively maintained. Last release 10 days ago, commits in 20 of the last 26 weeks. A safe choice.
pip install 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. Think ansible but Python instead of YAML, and a lot faster.
Getting Started • Examples Repo • Chat on Matrix
Documentation • Help & Support • Contributing
Why pyinfra? Design features include:
- 🚀 Super fast execution over thousands of hosts with predictable performance.
- 🚨 Instant debugging with realtime stdin/stdout/stderr output (
-vvv). - 🔄 Idempotent operations that enable diffs and dry runs before making changes.
- 📦 Extendable with the entire Python package ecosystem.
- 💻 Agentless execution against anything with shell access.
- 🔌 Integrated with connectors for Docker, Terraform, Vagrant and more.
Quickstart
Install pyinfra with uv:
uv tool install pyinfra
Now you can execute commands on hosts via SSH:
pyinfra my-server.net exec -- echo "hello world"