Skip to content

Commit 0f9f4c7

Browse files
author
github-actions
committed
Docs build 2024-06-25
1 parent aaf8736 commit 0f9f4c7

File tree

163 files changed

+2067
-433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2067
-433
lines changed

en/3.x/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: dcc57fcbe3feb18b33b0002b1af024a8
3+
config: 4b6280c49beb6599c8ef6e2bc36ec362
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

en/3.x/_sources/api/connectors.md.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Writing Connectors
22

3-
[Connectors](../connectors) enable pyinfra to directly integrate with other tools and systems. Connectos are written as Python classes.
3+
[Connectors](../connectors) enable pyinfra to directly integrate with other tools and systems. Connectors are written as Python classes.
44

55
## Inventory Connector
66

@@ -66,7 +66,7 @@ class LocalConnector(BaseConnector):
6666
and then writing it to the upload location.
6767

6868
Returns:
69-
bool: indicating succes or failure.
69+
bool: indicating success or failure.
7070
"""
7171

7272
def get_file(

en/3.x/_sources/api/index.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Using the API
22
=============
33

4-
In addition to :doc:`the pyinfra CLI <../cli>`, pyinfra provides a full Python API. As of `v1` this API can be considered mostly stable. An example of how to use the API is embedded below. See also :doc:`./reference`.
4+
In addition to :doc:`the pyinfra CLI <../cli>`, pyinfra provides a full Python API. As of ``v3`` this API can be considered mostly stable. See the :doc:`./reference`.
55

6-
.. literalinclude:: ../../examples/api_deploy.py
6+
`An example of how to use the API can be found here <https://github.com/pyinfra-dev/pyinfra-examples/blob/main/.old/api_deploy.py>`_. Note: this is not yet tested and pending future updates.

en/3.x/_sources/api/operations.md.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Writing Facts & Operations
22

3-
Operations & facts the building blocks pyinfra uses to make changes to hosts, this document describes how you can write your own to extend pyinfra's functionality.
3+
Operations & facts are the building blocks pyinfra uses to make changes to hosts. This document describes how you can write your own to extend pyinfra's functionality.
44

55
## Operations
66

7-
[Operations](../operations) are defined as Python functions. They are passed the current deploy state, the target host and any operation arguments. Operation functions read state from the host, comparing it to the arguments, and yield commands.
7+
[Operations](../operations) are defined as Python functions. They are passed the current deploy state, the target host, and any operation arguments. Operation functions read state from the host, compare it to the arguments, and yield commands.
88

99
### Input: arguments
1010

@@ -40,7 +40,7 @@ yield StringCommand("echo", "Shell!", _sudo=True)
4040
Operations can also call other operations using ``yield from`` syntax:
4141

4242
```py
43-
yield from files.file(
43+
yield from files.file._inner(
4444
path="/some/file",
4545
...,
4646
)
@@ -88,7 +88,7 @@ passed (as a ``list`` of lines) to the ``process`` handler to generate fact data
8888

8989
Fact classes may provide a ``default`` function that takes no arguments (except ``self``). The return value of this function is used if an error
9090
occurs during fact collection. Additionally, a ``requires_command`` variable can be set on the fact that specifies a command that must be available
91-
on the host to collect the fact. If this command is not present on the host the fact will be set to the default, or empty if no ``default`` function
91+
on the host to collect the fact. If this command is not present on the host, the fact will be set to the default, or empty if no ``default`` function
9292
is available.
9393

9494
### Importing & Using Facts

en/3.x/_sources/api/reference.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ API Reference
33

44
The pyinfra API is designed to be used as follows:
55

6-
1. Create the state we are going to operate on, this consists of:
6+
1. Create the state we are going to operate on, which consists of:
77
- An inventory ``pyinfra.api.Inventory`` containing hosts ``pyinfra.api.Host``, plus any data
88
- A config ``pyinfra.api.Config`` for global flag
99
- A state ``pyinfra.api.State`` that combines the inventory & config
10-
2. Now state is setup, we define operations:
10+
2. Now that state is setup, we define operations:
1111
- ``pyinfra.api.operation.add_op``
1212
- ``pyinfra.api.add_deploy``
1313
3. Now that's done, we execute it:

en/3.x/_sources/contributing.md.txt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Third party pull requests help expand pyinfra's functionality and are essential
1313

1414
## Branches
1515

16-
+ There is a branch per major version, ie `2.x`, that tracks the latest release of that version
16+
+ There is a branch per major version, ie `3.x`, that tracks the latest release of that version
1717
+ Changes should generally be based off the latest major branch, unless fixing an old version
1818

1919
## Dev Setup
@@ -30,15 +30,27 @@ cd pyinfra
3030
pip install -e '.[dev]'
3131
```
3232

33-
## Tests
33+
### Code Style & Type Checking
3434

35-
GitHub will run all the test suites as part of any pull requests, here's how you can run them locally:
35+
Code style is enforced via Black, isort and flake8. Types are checked with mypy currently, and pyright is recommended for local development though currently optional. There is a script to run the linting & type-checking:
3636

37-
### Unit Tests
37+
```sh
38+
scripts/dev-lint.sh
39+
```
40+
41+
### Tests
42+
43+
GitHub will run all the test suites as part of any pull requests. There's a handy script that runs the unit tests:
44+
45+
```sh
46+
scripts/dev-test.sh
47+
```
48+
49+
#### Unit Tests
3850

3951
Use `pytest` to run the unit tests, or `pytest --cov` to run with coverage. Pull requests are expected to be tested and not drop overall project coverage by >1%.
4052

41-
### End to End Tests
53+
#### End to End Tests
4254

4355
The end to end tests are also executed via `pytest` but not selected by default, options/usage:
4456

@@ -64,7 +76,3 @@ To view ([localhost:8000](http://localhost:8000)):
6476
```sh
6577
python -m http.server -d docs/build/
6678
```
67-
68-
## Code Style
69-
70-
Code is linted using `flake8` and uses the `black` / `isort` codestyles. To check you can just run `flake8` from the root directory.

en/3.x/_sources/examples.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Example Deploys
22
===============
33

4-
If you are getting started with pyinfra checkout `the examples on Github <https://github.com/Fizzadar/pyinfra/tree/2.x/examples>`_ which should properly introduce the file/folder structure as well as operation basics.
4+
If you are getting started with pyinfra checkout `the examples on GitHub <https://github.com/Fizzadar/pyinfra/tree/2.x/examples>`_ which should properly introduce the file/folder structure as well as operation basics.
55

66
Included here is a set of documented example deploys highlighting common patterns and best practices:
77

en/3.x/_sources/facts.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Facts Index
22
===========
33

4-
pyinfra uses **facts** to determine the existing state of a remote server. Operations use this information to generate commands which alter the state. Facts are read-only and is populated at the beginning of the deploy.
4+
pyinfra uses **facts** to determine the existing state of a remote server. Operations use this information to generate commands which alter the state. Facts are read-only and are populated at the beginning of the deploy.
55

66
Facts can be executed/tested via the command line:
77

@@ -23,7 +23,7 @@ Multiple facts with arguments may be called like so:
2323
2424
pyinfra @local fact files.File path=setup.py files.File path=anotherfile.txt
2525
26-
You can leverage facts as part of :doc:`within operations <using-operations>` like this:
26+
You can leverage facts within :doc:`operations <using-operations>` like this:
2727

2828
.. code:: py
2929

en/3.x/_sources/facts/deb.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Returns the architecture string used in apt repository sources, eg ``amd64``.
2020

2121
.. code:: python
2222
23-
host.get_fact(DebPackage, name)
23+
host.get_fact(DebPackage, package)
2424
2525
Returns information on a .deb archive or installed package.
2626

en/3.x/_sources/facts/docker.rst.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Docker Facts
22
------------
33

4+
See also: :doc:`../operations/docker`.
5+
46
.. _facts:docker.DockerContainer:
57

68
:code:`docker.DockerContainer`
@@ -94,3 +96,27 @@ Returns ``docker inspect`` output for all Docker networks.
9496
9597
Returns ``docker system info`` output in JSON format.
9698

99+
100+
.. _facts:docker.DockerVolume:
101+
102+
:code:`docker.DockerVolume`
103+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
104+
105+
.. code:: python
106+
107+
host.get_fact(DockerVolume, object_id)
108+
109+
Returns ``docker inspect`` output for a single Docker container.
110+
111+
112+
.. _facts:docker.DockerVolumes:
113+
114+
:code:`docker.DockerVolumes`
115+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116+
117+
.. code:: python
118+
119+
host.get_fact(DockerVolumes)
120+
121+
Returns ``docker inspect`` output for all Docker volumes.
122+

en/3.x/_sources/facts/pacman.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Returns a dict of installed pacman packages:
2828

2929
.. code:: python
3030
31-
host.get_fact(PacmanUnpackGroup, name)
31+
host.get_fact(PacmanUnpackGroup, package)
3232
3333
Returns a list of actual packages belonging to the provided package name,
3434
expanding groups or virtual packages.

en/3.x/_sources/facts/rpm.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Rpm Facts
88

99
.. code:: python
1010
11-
host.get_fact(RpmPackage, name)
11+
host.get_fact(RpmPackage, package)
1212
1313
Returns information on a .rpm file:
1414

@@ -27,7 +27,7 @@ Returns information on a .rpm file:
2727

2828
.. code:: python
2929
30-
host.get_fact(RpmPackageProvides, name)
30+
host.get_fact(RpmPackageProvides, package)
3131
3232
Returns a list of packages that provide the specified capability (command, file, etc).
3333

en/3.x/_sources/facts/runit.rst.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Runit Facts
2+
-----------
3+
4+
See also: :doc:`../operations/runit`.
5+
6+
.. _facts:runit.RunitManaged:
7+
8+
:code:`runit.RunitManaged`
9+
~~~~~~~~~~~~~~~~~~~~~~~~~~
10+
11+
.. code:: python
12+
13+
host.get_fact(RunitManaged, service=None, svdir='/var/service')
14+
15+
Returns a set of all services managed by runit
16+
17+
+ **service**: optionally check only for a single service
18+
+ **svdir**: alternative ``SVDIR``
19+
20+
21+
.. _facts:runit.RunitStatus:
22+
23+
:code:`runit.RunitStatus`
24+
~~~~~~~~~~~~~~~~~~~~~~~~~
25+
26+
.. code:: python
27+
28+
host.get_fact(RunitStatus, service=None, svdir='/var/service')
29+
30+
Returns a dict of name -> status for runit services.
31+
32+
+ **service**: optionally check only for a single service
33+
+ **svdir**: alternative ``SVDIR``
34+
35+
.. code:: python
36+
37+
{
38+
'agetty-tty1': True, # service is running
39+
'dhcpcd': False, # service is down
40+
'wpa_supplicant': None, # service is managed, but not running or down,
41+
# possibly in a fail state
42+
}
43+

en/3.x/_sources/facts/server.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ Returns a boolean indicating the remote side has GUI capabilities. Linux only.
9797

9898
.. code:: python
9999
100-
host.get_fact(Home)
100+
host.get_fact(Home, user='')
101101
102-
Returns the home directory of the current user.
102+
Returns the home directory of the given user, or the current user if no user is given.
103103

104104

105105
.. _facts:server.Hostname:

en/3.x/_sources/getting-started.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This guide should help describe the basics of deploying stuff with pyinfra. Star
55

66
.. code:: bash
77
8-
pip install pyinfra
8+
pip install pyinfra --pre
99
1010
To do something with pyinfra you need two things:
1111

en/3.x/_sources/install.md.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Installation
22

3-
## Pipx
3+
## Pip
44

55
It is recommended to install pyinfra using `pip`:
66

77
```sh
8-
pip install pyinfra
8+
pip install pyinfra --pre
99
```
1010

1111
## Windows

en/3.x/_sources/inventory-data.rst.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Inventory & Data
22
================
33

4-
A pyinfra inventory provides hosts, groups and data. Host are the things pyinfra will make changes to (think a SSH daemon on a server, a Docker container or the local machine). Hosts can be attached to groups, and data can then be assigned to both the groups and individual hosts.
4+
A pyinfra inventory provides hosts, groups and data. Hosts are the things pyinfra will make changes to (think a SSH daemon on a server, a Docker container or the local machine). Hosts can be attached to groups, and data can then be assigned to both the groups and individual hosts.
55

6-
By default pyinfra assumes hosts are SSH servers and the name of the host is used as the SSH hostname. Prefixing the name of the host with ``@<connector-name>/`` is used to activate alternative connectors. See: :doc:`connectors`.
6+
By default, pyinfra assumes hosts are SSH servers and the name of the host is used as the SSH hostname. Prefixing the name of the host with ``@<connector-name>/`` is used to activate alternative connectors. See: :doc:`connectors`.
77

88
Inventory Files
99
---------------
@@ -63,7 +63,7 @@ Data can be assigned to individual hosts in the inventory by using a tuple ``(ho
6363
("db-1.net", {"install_postgres": True}),
6464
]
6565
66-
This can then be used in operations files:
66+
This data can then be used in operations:
6767

6868
.. code:: python
6969
@@ -84,7 +84,7 @@ Group data can be stored in separate files under the ``group_data`` directory (t
8484
app_user = "myuser"
8585
app_dir = "/opt/pyinfra"
8686
87-
These can then be used in operations:
87+
These variables can then be used in operations:
8888

8989
.. code:: python
9090
@@ -115,7 +115,7 @@ The same keys can be defined for host and group data - this means we can set a d
115115
Connecting with Data
116116
--------------------
117117

118-
Data can be used to configure connectors, for example setting SSH connection details can be done like so:
118+
Data can be used to configure connectors. For example, setting SSH connection details can be done like so:
119119

120120
.. code:: python
121121

en/3.x/_sources/operations/apt.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Upgrades all apt packages.
281281
282282
# Upgrade all packages and remove unneeded transitive dependencies
283283
apt.upgrade(
284-
name="Upgrade apt packages and remove unneeded dependencies"
284+
name="Upgrade apt packages and remove unneeded dependencies",
285285
auto_remove=True
286286
)
287287

en/3.x/_sources/operations/dnf.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Install/remove/update dnf packages & updates.
5454
extra_install_args=None, extra_uninstall_args=None,
5555
)
5656
57-
+ **packages**: list of packages to ensure
57+
+ **packages**: packages to ensure
5858
+ **present**: whether the packages should be installed
5959
+ **latest**: whether to upgrade packages without a specified version
6060
+ **update**: run ``dnf update`` before installing packages
@@ -99,7 +99,7 @@ Add/remove/update dnf repositories.
9999
gpgkey=None,
100100
)
101101
102-
+ **name**: URL or name for the ``.repo`` file
102+
+ **src**: URL or name for the ``.repo`` file
103103
+ **present**: whether the ``.repo`` file should be present
104104
+ **baseurl**: the baseurl of the repo (if ``name`` is not a URL)
105105
+ **description**: optional verbose description

0 commit comments

Comments
 (0)