Skip to main content

pyinfra

pyinfra automates infrastructure super fast at massive scale
ad-hoc command execution, service deployment, configuration management and more


DocumentationGetting StartedExamplesHelp & SupportContributing

Chat (both bridged) ⇒ #pyinfra on MatrixDiscord


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 executing any changes.
  • 📦 Extendable with any Python package as configured & written in standard Python.
  • 💻 Agentless execution against SSH/Docker/subprocess/WinRM hosts.
  • 🔌 Integrated with Docker, Terraform, 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.


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyinfra-2.5.2.tar.gz (192.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyinfra-2.5.2-py2.py3-none-any.whl (243.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyinfra-2.5.2.tar.gz.

File metadata

  • Download URL: pyinfra-2.5.2.tar.gz
  • Upload date:
  • Size: 192.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pyinfra-2.5.2.tar.gz
Algorithm Hash digest
SHA256 955d6722ca73bcdcb07953249428cd49a7694b5cb3ff6677b46b1093b4108b8c
MD5 17eb0de94bff3814ef91d169476ef0eb
BLAKE2b-256 73ff3f3a4ef2c76f19416841f5d328fd89c3ec29541045784bdb84f335abfc04

See more details on using hashes here.

File details

Details for the file pyinfra-2.5.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pyinfra-2.5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 243.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pyinfra-2.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 502411410a925098898acddb7fe27cd925d629068097430fb5882a6121cd651a
MD5 c0f8c230c4a807339d362442b7289d60
BLAKE2b-256 1d87159ed2f325658c211cbd4384ec83daf3cd60c2e8f56ed0eac15fc9b5ac38

See more details on using hashes here.

Release history Release notifications | RSS feed

3.10.0

2 files

3.9.2

2 files

3.9.1

2 files

3.9.0

2 files

3.8.0

2 files

3.7

2 files

3.6.1

2 files

3.6

2 files

3.5.1

2 files

3.5

2 files

3.4.1

2 files

3.4

2 files

3.3.1

2 files

3.3

2 files

3.2

2 files

3.1.1

2 files

3.1

2 files

3.0.2

2 files

3.0.1

2 files

3.0

2 files

2.9.2

2 files

2.9.1

2 files

2.9

2 files

2.8

2 files

2.7

2 files

2.6.2

2 files

2.6.1

2 files

2.6

2 files

2.5.3

2 files

This release

2.5.2 This release

2 files

2.5.1

2 files

2.5

2 files

2.4

2 files

2.3

2 files

2.2

2 files

2.1

2 files

2.0.2

2 files

2.0.1

2 files

2.0

2 files

1.7.3

2 files

1.7.2

2 files

1.7.1

2 files

1.7

2 files

1.6.3

2 files

1.6.2

2 files

1.6.1

2 files

1.6

2 files

1.5

2 files

1.4.19

2 files

1.4.18

2 files

1.4.17

2 files

1.4.16

2 files

1.4.15

2 files

1.4.14

2 files

1.4.13

2 files

1.4.12

2 files

1.4.11

2 files

1.4.10

2 files

1.4.9

2 files

1.4.8

2 files

1.4.7

2 files

1.4.6

2 files

1.4.5

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4

2 files

1.3.12

2 files

1.3.11

2 files

1.3.10

2 files

1.3.9

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3

2 files

1.2.1

2 files

1.2

2 files

1.1.2

2 files

1.1.1

2 files

1.1

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0

2 files

0.16.2

2 files

0.16.1

2 files

0.16

2 files

0.15

2 files

0.14.5

2 files

0.14.4

2 files

0.14.3

2 files

0.14.2

2 files

0.14.1

2 files

0.14

2 files

0.13.5

2 files

0.13.4

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

0.13

2 files

0.12.2

2 files

0.12.1

2 files

0.12

2 files

0.11

2 files

0.10

2 files

0.9.9

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9

2 files

0.8

2 files

0.7.1

2 files

0.7

2 files

0.6.1

2 files

0.6

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5

2 files

0.4.1

2 files

0.4

2 files

0.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2

2 files

0.2.dev1

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1

2 files

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