pyinfra


Namepyinfra JSON
Version 3.5 PyPI version JSON
download
home_pagehttps://pyinfra.com
Summarypyinfra automates/provisions/manages/deploys infrastructure.
upload_time2025-09-03 10:26:38
maintainerNone
docs_urlNone
authorNick / Fizzadar
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://pyinfra.com">
        <img src="https://pyinfra.com/static/logo_readme.png" alt="pyinfra" />
    </a>
</p>

<p>
    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 <code>ansible</code> but Python instead of YAML, and a lot faster.
</p>

---

<h3>
    <a href="https://docs.pyinfra.com/page/getting-started.html"><strong>Getting Started</strong></a> &bull;
    <a href="https://github.com/pyinfra-dev/pyinfra-examples"><strong>Examples Repo</strong></a> &bull;
    <a href="https://matrix.to/#/#pyinfra:matrix.org"><strong>Chat on Matrix</strong></a>
</h3>
<p>
    <a href="https://docs.pyinfra.com"><strong>Documentation</strong></a> &bull;
    <a href="https://docs.pyinfra.com/page/support.html"><strong>Help & Support</strong></a> &bull;
    <a href="https://docs.pyinfra.com/page/contributing.html"><strong>Contributing</strong></a>
</p>

---

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.

<img width="100%" src="https://pyinfra.com/static/example_deploy.gif" />

## Quickstart

Install pyinfra with `pip`:

```
pip install pyinfra
```

Now you can execute commands on hosts via SSH:

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

Or target Docker containers, the local machine, and other [connectors](https://docs.pyinfra.com/page/connectors.html):

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

As well as executing commands you can define state using [operations](https://docs.pyinfra.com/page/operations.html):

```sh
# 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`:


```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`:

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


And executed together:

```sh
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](https://docs.pyinfra.com/page/getting-started.html) or [using operations](https://docs.pyinfra.com/page/using-operations.html) guides. See how to use [inventory & data](https://docs.pyinfra.com/page/inventory-data.html), [global arguments](https://docs.pyinfra.com/page/arguments.html) and [the CLI](https://docs.pyinfra.com/page/cli.html) or check out the [documented examples](https://docs.pyinfra.com/page/examples.html).

---

<p align="center">
    <a href="https://pypi.python.org/pypi/pyinfra"><img alt="PyPI version" src="https://img.shields.io/pypi/v/pyinfra?color=blue"></a>
    <a href="https://pepy.tech/project/pyinfra"><img alt="PyPi downloads" src="https://pepy.tech/badge/pyinfra"></a>
    <a href="https://docs.pyinfra.com"><img alt="Docs status" src="https://img.shields.io/github/actions/workflow/status/Fizzadar/pyinfra/docs.yml?branch=2.x"></a>
    <a href="https://github.com/Fizzadar/pyinfra/actions?query=workflow%3A%22Execute+tests%22"><img alt="Execute tests status" src="https://img.shields.io/github/actions/workflow/status/Fizzadar/pyinfra/test.yml?branch=2.x"></a>
    <a href="https://codecov.io/github/Fizzadar/pyinfra"><img alt="Codecov Coverage" src="https://img.shields.io/codecov/c/gh/Fizzadar/pyinfra"></a>
    <a href="https://github.com/Fizzadar/pyinfra/blob/2.x/LICENSE.md"><img alt="MIT Licensed" src="https://img.shields.io/pypi/l/pyinfra"></a>
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://pyinfra.com",
    "name": "pyinfra",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Nick / Fizzadar",
    "author_email": "pointlessrambler@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/19/b0/121b5b51ea9f201721ebf8d5c1d33fa3fc9be4eccd91d9e1f91344d6fad9/pyinfra-3.5.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <a href=\"https://pyinfra.com\">\n        <img src=\"https://pyinfra.com/static/logo_readme.png\" alt=\"pyinfra\" />\n    </a>\n</p>\n\n<p>\n    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 <code>ansible</code> but Python instead of YAML, and a lot faster.\n</p>\n\n---\n\n<h3>\n    <a href=\"https://docs.pyinfra.com/page/getting-started.html\"><strong>Getting Started</strong></a> &bull;\n    <a href=\"https://github.com/pyinfra-dev/pyinfra-examples\"><strong>Examples Repo</strong></a> &bull;\n    <a href=\"https://matrix.to/#/#pyinfra:matrix.org\"><strong>Chat on Matrix</strong></a>\n</h3>\n<p>\n    <a href=\"https://docs.pyinfra.com\"><strong>Documentation</strong></a> &bull;\n    <a href=\"https://docs.pyinfra.com/page/support.html\"><strong>Help & Support</strong></a> &bull;\n    <a href=\"https://docs.pyinfra.com/page/contributing.html\"><strong>Contributing</strong></a>\n</p>\n\n---\n\nWhy pyinfra? Design features include:\n\n+ \ud83d\ude80 **Super fast** execution over thousands of hosts with predictable performance.\n+ \ud83d\udea8 **Instant debugging** with realtime stdin/stdout/stderr output (`-vvv`).\n+ \ud83d\udd04 **Idempotent operations** that enable diffs and dry runs before making changes.\n+ \ud83d\udce6 **Extendable** with the entire Python package ecosystem.\n+ \ud83d\udcbb **Agentless execution** against anything with shell access.\n+ \ud83d\udd0c **Integrated** with connectors for Docker, Terraform, Vagrant and more.\n\n<img width=\"100%\" src=\"https://pyinfra.com/static/example_deploy.gif\" />\n\n## Quickstart\n\nInstall pyinfra with `pip`:\n\n```\npip install pyinfra\n```\n\nNow you can execute commands on hosts via SSH:\n\n```sh\npyinfra my-server.net exec -- echo \"hello world\"\n```\n\nOr target Docker containers, the local machine, and other [connectors](https://docs.pyinfra.com/page/connectors.html):\n\n```sh\npyinfra @docker/ubuntu exec -- echo \"Hello world\"\npyinfra @local exec -- echo \"Hello world\"\n```\n\nAs well as executing commands you can define state using [operations](https://docs.pyinfra.com/page/operations.html):\n\n```sh\n# Install iftop apt package if not present\npyinfra @docker/ubuntu apt.packages iftop update=true _sudo=true\n```\n\nWhich can then be saved as a Python file like `deploy.py`:\n\n\n```py\nfrom pyinfra.operations import apt\n\napt.packages(\n    name=\"Ensure iftop is installed\",\n    packages=['iftop'],\n    update=True,\n    _sudo=True,\n)\n```\n\nThe hosts can also be saved in a file, for example `inventory.py`:\n\n```py\ntargets = [\"@docker/ubuntu\", \"my-test-server.net\"]\n```\n\n\nAnd executed together:\n\n```sh\npyinfra inventory.py deploy.py\n```\n\nNow you know the building blocks of pyinfra! By combining inventory, operations and Python code you can deploy anything.\n\nSee the more detailed [getting started](https://docs.pyinfra.com/page/getting-started.html) or [using operations](https://docs.pyinfra.com/page/using-operations.html) guides. See how to use [inventory & data](https://docs.pyinfra.com/page/inventory-data.html), [global arguments](https://docs.pyinfra.com/page/arguments.html) and [the CLI](https://docs.pyinfra.com/page/cli.html) or check out the [documented examples](https://docs.pyinfra.com/page/examples.html).\n\n---\n\n<p align=\"center\">\n    <a href=\"https://pypi.python.org/pypi/pyinfra\"><img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/pyinfra?color=blue\"></a>\n    <a href=\"https://pepy.tech/project/pyinfra\"><img alt=\"PyPi downloads\" src=\"https://pepy.tech/badge/pyinfra\"></a>\n    <a href=\"https://docs.pyinfra.com\"><img alt=\"Docs status\" src=\"https://img.shields.io/github/actions/workflow/status/Fizzadar/pyinfra/docs.yml?branch=2.x\"></a>\n    <a href=\"https://github.com/Fizzadar/pyinfra/actions?query=workflow%3A%22Execute+tests%22\"><img alt=\"Execute tests status\" src=\"https://img.shields.io/github/actions/workflow/status/Fizzadar/pyinfra/test.yml?branch=2.x\"></a>\n    <a href=\"https://codecov.io/github/Fizzadar/pyinfra\"><img alt=\"Codecov Coverage\" src=\"https://img.shields.io/codecov/c/gh/Fizzadar/pyinfra\"></a>\n    <a href=\"https://github.com/Fizzadar/pyinfra/blob/2.x/LICENSE.md\"><img alt=\"MIT Licensed\" src=\"https://img.shields.io/pypi/l/pyinfra\"></a>\n</p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pyinfra automates/provisions/manages/deploys infrastructure.",
    "version": "3.5",
    "project_urls": {
        "Documentation": "https://docs.pyinfra.com",
        "GitHub": "https://github.com/Fizzadar/pyinfra",
        "Homepage": "https://pyinfra.com"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03ef35d82faf4938eb6cd2e9a577ac70075dd3f56db47531505349312ff8a271",
                "md5": "7a9096f8837f40c95c2610cec358a205",
                "sha256": "ed37c94206b287ad2c18a0891f2412a44df345fd5c5239e3e999ba29bab12e81"
            },
            "downloads": -1,
            "filename": "pyinfra-3.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a9096f8837f40c95c2610cec358a205",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.9",
            "size": 294156,
            "upload_time": "2025-09-03T10:26:36",
            "upload_time_iso_8601": "2025-09-03T10:26:36.321123Z",
            "url": "https://files.pythonhosted.org/packages/03/ef/35d82faf4938eb6cd2e9a577ac70075dd3f56db47531505349312ff8a271/pyinfra-3.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "19b0121b5b51ea9f201721ebf8d5c1d33fa3fc9be4eccd91d9e1f91344d6fad9",
                "md5": "7a1d003fec49c3505e561143cf48adc7",
                "sha256": "db7f7de7e5e3d2202fb01c089e93e6bef7a5d898d119f3a8964da4b54e123a9c"
            },
            "downloads": -1,
            "filename": "pyinfra-3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "7a1d003fec49c3505e561143cf48adc7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 233210,
            "upload_time": "2025-09-03T10:26:38",
            "upload_time_iso_8601": "2025-09-03T10:26:38.526019Z",
            "url": "https://files.pythonhosted.org/packages/19/b0/121b5b51ea9f201721ebf8d5c1d33fa3fc9be4eccd91d9e1f91344d6fad9/pyinfra-3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-03 10:26:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Fizzadar",
    "github_project": "pyinfra",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyinfra"
}
        
Elapsed time: 1.92368s