Skip to main content

pyinfra

pyinfra automates infrastructure super fast at massive scale

PyPI version PyPi downloads Docs status Execute tests status Codecov Coverage MIT Licensed


Documentation • Getting Started • Examples • Help & Support • Contributing


pyinfra automates/provisions/manages/deploys infrastructure. It can be used for ad-hoc command execution, service deployment, configuration management and more. Design features include:

  • 🚀 Super fast execution over thousands of hosts with predictable performance.
  • 🚨 Instant debugging with stdout & stderr output on error or as required (-v|-vv|-vvv).
  • 📦 Extendable with any Python package as configured & written in standard Python.
  • 💻 Agentless execution against SSH/Docker/subprocess/winrm hosts.
  • ❗️ Two stage process that enables --dry runs before executing any changes.
  • 🔌 Integrated with Docker, Vagrant/Mech & Ansible out of the box.

When you run pyinfra you'll see something like (non animated version):

Quickstart

Install pyinfra with pipx (recommended) or pip:

pipx install pyinfra

Now you can execute commands on hosts via SSH:

pyinfra my-server.net exec -- echo "hello world"

Or execute in Docker, on the local machine, and other connectors:

pyinfra @docker/ubuntu exec -- echo "Hello world"
pyinfra @local exec -- echo "Hello world"

As well as executing commands you can define state using operations:

# Install iftop apt package if not present
pyinfra @docker/ubuntu apt.packages iftop update=true _sudo=true

Which can then be saved as a Python file like deploy.py:

from pyinfra.operations import apt

apt.packages(
    name="Ensure iftop is installed",
    packages=['iftop'],
    update=True,
    _sudo=True,
)

The hosts can also be saved in a file, for example inventory.py:

targets = ["@docker/ubuntu", "my-test-server.net"]

And executed together:

pyinfra inventory.py deploy.py

Now you know the building blocks of pyinfra! By combining inventory, operations and Python code you can deploy anything.

See the more detailed getting started or using operations guides. See how to use inventory & data, global arguments and the CLI or check out the documented examples.

Metadata

Release files for pyinfra 2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyinfra 2.5
File Size Uploaded Provenance Actions
pyinfra-2.5.tar.gz 191.3 kB Without provenance Details for pyinfra-2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyinfra 2.5
File Interpreter ABI Platform Actions
pyinfra-2.5-py2.py3-none-any.whl Python 2, Python 3 none any Details for pyinfra-2.5-py2.py3-none-any.whl

Total release size: 434.4 kB

Release files / pyinfra-2.5.tar.gz

Download URL pyinfra-2.5.tar.gz
Size 191.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7e60da726efb4cbe45f6ce5a483c1cf4cdc9680de3fa433dd6e2662c777decc9
BLAKE2b-256 checksum
How to use checksums
dcf50c124126d4a005ac99f5caefa285543fb7c2ed753dfb0ce5caa183dda190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / pyinfra-2.5-py2.py3-none-any.whl

Download URL pyinfra-2.5-py2.py3-none-any.whl
Size 243.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5cb10e92c876f7ce106e669bf359580aae65ad263a90953e6ebe315574d4297a
BLAKE2b-256 checksum
How to use checksums
0cb458424895a6169daf3ba647b2e5d20edccc1a3ff6f231d93d9dc6e97e574a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for pyinfra 2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.5 This release

2 release files No provenance

0.2.dev1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page