-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
432 lines (393 loc) · 20.3 KB
/
Copy pathindex.html
File metadata and controls
432 lines (393 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>pyinfra — agentless infrastructure automation, in plain Python</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="pyinfra runs commands over SSH against thousands of hosts in seconds. No DSL. No YAML. No agents. Just Python.">
<meta name="author" content="pyinfra">
<meta name="robots" content="index, follow">
<meta name="theme-color" content="#00d060">
<meta name="darkreader-lock">
<link rel="canonical" href="https://pyinfra.com">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://pyinfra.com">
<meta property="og:title" content="pyinfra — agentless infrastructure automation, in plain Python">
<meta property="og:description" content="pyinfra runs commands over SSH against thousands of hosts in seconds. No DSL. No YAML. No agents. Just Python.">
<meta property="og:image" content="https://pyinfra.com/static/logo_readme.png">
<meta property="og:site_name" content="pyinfra">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://pyinfra.com">
<meta name="twitter:title" content="pyinfra — agentless infrastructure automation, in plain Python">
<meta name="twitter:description" content="pyinfra runs commands over SSH against thousands of hosts in seconds. No DSL. No YAML. No agents. Just Python.">
<meta name="twitter:image" content="https://pyinfra.com/static/logo_readme.png">
<link rel="icon" type="image/png" href="static/logo.png">
<link rel="apple-touch-icon" href="static/logo.png">
<link rel="preload" href="static/fonts/jetbrains-mono-latin.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preconnect" href="https://stats.oxygem.com">
<link rel="dns-prefetch" href="https://stats.oxygem.com">
<link rel="stylesheet" href="static/style.css">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "pyinfra",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Linux, macOS, Windows",
"description": "Fast Python-based infrastructure automation and configuration management tool for deploying to SSH servers, Docker containers, and local machines.",
"url": "https://pyinfra.com",
"image": "https://pyinfra.com/static/logo_readme.png",
"softwareVersion": "3.x",
"author": {
"@type": "Organization",
"name": "pyinfra",
"url": "https://pyinfra.com"
},
"programmingLanguage": "Python"
}
</script>
</head>
<body>
<header class="nav">
<div class="container nav__inner">
<a class="brand-mark" href="/">
<img src="static/logo.png" alt="pyinfra logo" width="30" height="30">
<span class="home">~/pyinfra</span>
</a>
<nav class="nav__links">
<a href="https://docs.pyinfra.com"><span>/</span>docs</a>
<a href="https://github.com/pyinfra-dev/pyinfra"><span>/</span>github</a>
</nav>
<div class="nav__cta">
<a class="stars" href="https://github.com/pyinfra-dev/pyinfra" aria-label="GitHub stars: over 5,700"><span class="star" aria-hidden="true">★</span> <span aria-hidden="true">>5.7k</span></a>
<a class="btn-pill" href="https://docs.pyinfra.com/page/getting-started.html">$ quickstart →</a>
</div>
</div>
</header>
<section class="hero">
<div class="container hero__grid">
<div>
<div class="hero__pre" aria-hidden="true">┌─ pyinfra v3 ──────────────┐</div>
<h1><span aria-hidden="true">> </span>automate<br><span class="green">thousands</span> of<br>servers<span class="green" aria-hidden="true">_</span></h1>
<p class="hero__lede">
pyinfra is a python-native, agentless automation tool that runs
commands over ssh — concurrently, idempotently, and
<strong>6× faster than ansible</strong>.
</p>
<div class="install-box">
<span class="noselect prompt">$</span>
<span class="install-box__cmd">uv tool install pyinfra</span>
<button type="button" class="copy" data-copy-target=".install-box__cmd">copy</button>
</div>
<div class="tags">
<span>[mit license]</span>
<span>·</span>
<span>[python 3.10+]</span>
<span>·</span>
<span>[no agents]</span>
<span>·</span>
<span>[zero config]</span>
</div>
<div class="btn-row">
<a class="btn-ascii" href="https://docs.pyinfra.com">[ read the docs ]</a>
<a class="btn-ascii" href="https://github.com/pyinfra-dev/pyinfra">[ view on github ]</a>
</div>
</div>
<!-- Code window -->
<div class="window" id="hero-window">
<div class="window__tabs" role="tablist" aria-label="Code examples">
<button class="window__tab is-active" role="tab" id="tab-deploy" data-tab="deploy" aria-controls="pane-deploy" aria-selected="true" tabindex="0">deploy.py</button>
<button class="window__tab" role="tab" id="tab-inventory" data-tab="inventory" aria-controls="pane-inventory" aria-selected="false" tabindex="-1">inventory.py</button>
<button class="window__tab" role="tab" id="tab-output" data-tab="output" aria-controls="pane-output" aria-selected="false" tabindex="-1">output</button>
</div>
<pre class="code window__pane is-active" id="pane-deploy" role="tabpanel" aria-labelledby="tab-deploy" tabindex="0" data-pane="deploy">
<span class="ln"><span class="gutter"> 1</span><span class="tok-comment"># deploy.py · 23 hosts</span></span>
<span class="ln"><span class="gutter"> 2</span> </span>
<span class="ln"><span class="gutter"> 3</span><span class="tok-kw">from</span> <span class="tok-mod">pyinfra.operations</span> <span class="tok-kw">import</span> apt, files, systemd</span>
<span class="ln"><span class="gutter"> 4</span> </span>
<span class="ln"><span class="gutter"> 5</span><span class="tok-fn">apt.packages</span>(</span>
<span class="ln"><span class="gutter"> 6</span> packages=[<span class="tok-str">"nginx"</span>, <span class="tok-str">"certbot"</span>],</span>
<span class="ln"><span class="gutter"> 7</span> update=<span class="tok-kw">True</span>,</span>
<span class="ln"><span class="gutter"> 8</span>)</span>
<span class="ln"><span class="gutter"> 9</span> </span>
<span class="ln"><span class="gutter">10</span><span class="tok-fn">files.template</span>(</span>
<span class="ln"><span class="gutter">11</span> src=<span class="tok-str">"templates/nginx.conf.j2"</span>,</span>
<span class="ln"><span class="gutter">12</span> dest=<span class="tok-str">"/etc/nginx/sites-enabled/api"</span>,</span>
<span class="ln"><span class="gutter">13</span>)</span>
<span class="ln"><span class="gutter">14</span> </span>
<span class="ln"><span class="gutter">15</span><span class="tok-fn">systemd.service</span>(<span class="tok-str">"nginx"</span>, reloaded=<span class="tok-kw">True</span>)</span>
</pre>
<pre class="code window__pane" id="pane-inventory" role="tabpanel" aria-labelledby="tab-inventory" tabindex="0" data-pane="inventory">
<span class="ln"><span class="gutter"> 1</span><span class="tok-comment"># inventory.py · groups + hosts</span></span>
<span class="ln"><span class="gutter"> 2</span> </span>
<span class="ln"><span class="gutter"> 3</span>web = [</span>
<span class="ln"><span class="gutter"> 4</span> (<span class="tok-str">"web-01.prod"</span>, {<span class="tok-str">"role"</span>: <span class="tok-str">"edge"</span>}),</span>
<span class="ln"><span class="gutter"> 5</span> (<span class="tok-str">"web-02.prod"</span>, {<span class="tok-str">"role"</span>: <span class="tok-str">"edge"</span>}),</span>
<span class="ln"><span class="gutter"> 6</span> *[(<span class="tok-fn">f</span><span class="tok-str">"web-{i:02}.prod"</span>, {}) <span class="tok-kw">for</span> i <span class="tok-kw">in</span> <span class="tok-fn">range</span>(3, 24)],</span>
<span class="ln"><span class="gutter"> 7</span>]</span>
<span class="ln"><span class="gutter"> 8</span> </span>
<span class="ln"><span class="gutter"> 9</span>db = [</span>
<span class="ln"><span class="gutter">10</span> (<span class="tok-str">"db-01.prod"</span>, {<span class="tok-str">"role"</span>: <span class="tok-str">"primary"</span>}),</span>
<span class="ln"><span class="gutter">11</span> (<span class="tok-str">"db-02.prod"</span>, {<span class="tok-str">"role"</span>: <span class="tok-str">"replica"</span>}),</span>
<span class="ln"><span class="gutter">12</span>]</span>
<span class="ln"><span class="gutter">13</span> </span>
<span class="ln"><span class="gutter">14</span><span class="tok-comment"># $ pyinfra inventory.py deploy.py --limit web</span></span>
<span class="ln"><span class="gutter">15</span><span class="tok-comment"># → 23 hosts targeted</span></span>
</pre>
<pre class="code window__pane window__pane--term" id="pane-output" role="tabpanel" aria-labelledby="tab-output" tabindex="0" data-pane="output">
<span class="ln"><span class="muted">$ pyinfra inventory.py deploy.py --limit web</span></span>
<span class="ln"> </span>
<span class="ln">--> Loading inventory…</span>
<span class="ln"><span class="muted"> Hosts: web-01..web-23</span></span>
<span class="ln"> </span>
<span class="ln">--> Gathering facts (concurrent)…</span>
<span class="ln"><span class="muted"> 23 hosts · 0.6s</span></span>
<span class="ln"> </span>
<span class="ln">--> Running deploy.py…</span>
<span class="ln"><span class="good"> ✓ web-01.prod 3 ops changed=2 0.42s</span></span>
<span class="ln"><span class="good"> ✓ web-02.prod 3 ops changed=2 0.39s</span></span>
<span class="ln"><span class="warn"> ⟳ web-03.prod running… apt.packages</span></span>
<span class="ln"> </span>
<span class="ln">--> Summary</span>
<span class="ln"><span class="good"> successful: 23 changed: 18 failed: 0 total: 2.1s</span></span>
</pre>
<div class="status-bar">
<span data-status-left>NORMAL deploy.py python</span>
<span data-status-right>23 hosts ready · --dry · 17:42</span>
</div>
</div>
</div>
</section>
<section class="output">
<div class="container output__grid">
<div>
<div class="section-eyebrow">// streaming output</div>
<h2>See what changes,<br><span style="color:var(--brand)">before it changes.</span></h2>
<p>
Run with <strong>--dry</strong> for a per-host diff of every operation pyinfra
would perform. Run for real and watch results stream back in parallel.
</p>
</div>
<div class="terminal">
<div class="window__head-row">
<span>bash · zsh · ~/ops</span>
<span><span class="live-dot">●</span> live</span>
</div>
<pre class="terminal__body">
<span class="muted">$ pyinfra inventory.py deploy.py --limit web</span>
<div>--> Loading inventory…</div>
<span class="muted"> Hosts: web-01..web-24, db-01..db-04</span>
<div>--> Gathering facts (concurrent)…</div>
<span class="muted"> 24 hosts · 0.6s</span>
<div>--> Running deploy.py…</div>
<span class="good"> ✓ web-01.prod 3 ops changed=2 0.42s</span>
<span class="good"> ✓ web-02.prod 3 ops changed=2 0.39s</span>
<span class="good"> ✓ web-03.prod 3 ops changed=0 0.18s</span>
<span class="good"> ✓ web-04.prod 3 ops changed=2 0.44s</span>
<span class="warn"> ⟳ web-05.prod running… apt.packages</span>
<span class="muted"> … 19 more</span>
<div>--> Summary</div>
<span class="good"> successful: 24 changed: 18 no-change: 6 failed: 0</span>
<span class="good"> total: 2.1s</span>
</pre>
</div>
</div>
</section>
<section class="pillars">
<div class="container">
<div class="pillars__head">
<div class="section-eyebrow">// features</div>
<h2>Why pyinfra <span class="green">in six points.</span></h2>
</div>
<div class="pillar-grid">
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">pure</span>():</div>
<h3>Just Python</h3>
<p>No yaml. No jinja-in-yaml. Real control flow. Your editor already understands it.</p>
</article>
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">fast</span>():</div>
<h3>Concurrent ssh</h3>
<p>6× faster than ansible on identical workloads. Built on gevent + SSH.</p>
</article>
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">safe</span>():</div>
<h3>Diff before apply</h3>
<p>Run --dry to preview every change. Operations are idempotent — re-runs are no-ops.</p>
</article>
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">small</span>():</div>
<h3>0 agents</h3>
<p>Only requirement on hosts: a shell and ssh. No daemons. No state files. No control plane.</p>
</article>
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">big</span>():</div>
<h3>Scale-ready</h3>
<p>Works on 1 host or 10,000. Parallel execution, realtime streaming output.</p>
</article>
<article class="pillar">
<div class="pillar__def"><span class="kw">def</span> <span class="name">open</span>():</div>
<h3>Hackable</h3>
<p>Custom operation in 10 lines. Connect to anything that speaks a shell — docker, lxc, k8s.</p>
</article>
</div>
</div>
</section>
<section class="diff">
<div class="container">
<div class="section-eyebrow">// vs ansible</div>
<h2>$ diff ansible/ pyinfra/</h2>
<div class="diff__grid">
<div class="code-card">
<div class="code-card__head">
<span>--- ansible/playbook.yml</span>
<span>16 lines</span>
</div>
<pre class="code-card__body">- hosts: web
tasks:
- name: install nginx
apt:
name: nginx
update_cache: yes
- name: render config
template:
src: nginx.conf.j2
dest: /etc/nginx/sites-enabled/api
notify: reload nginx
handlers:
- name: reload nginx
service:
name: nginx
state: reloaded</pre>
</div>
<div class="code-card code-card--good">
<div class="code-card__head">
<span>+++ pyinfra/deploy.py</span>
<span>8 lines</span>
</div>
<pre class="code-card__body"><span class="tok-kw">from</span> <span class="tok-mod">pyinfra.operations</span> <span class="tok-kw">import</span> apt, files, systemd
<span class="tok-fn">apt.packages</span>([<span class="tok-str">"nginx"</span>], update=<span class="tok-kw">True</span>)
cfg = <span class="tok-fn">files.template</span>(
src=<span class="tok-str">"nginx.conf.j2"</span>,
dest=<span class="tok-str">"/etc/nginx/sites-enabled/api"</span>,
)
<span class="tok-kw">if</span> cfg.will_change:
<span class="tok-fn">systemd.service</span>(<span class="tok-str">"nginx"</span>, reloaded=<span class="tok-kw">True</span>)</pre>
</div>
</div>
</div>
</section>
<section class="manifest">
<div class="container">
<div class="section-eyebrow">// manifesto</div>
<div class="manifest__grid">
<div>
<div class="manifest__no">#01</div>
<div class="manifest__h">Code > config</div>
<div class="manifest__b">A loop is just a loop. Stop encoding control flow into yaml.</div>
</div>
<div>
<div class="manifest__no">#02</div>
<div class="manifest__h">Show, then do</div>
<div class="manifest__b">Diff first. Apply second. Surprise nobody.</div>
</div>
<div>
<div class="manifest__no">#03</div>
<div class="manifest__h">Stay out of the way</div>
<div class="manifest__b">No agent. No state file. No control plane. SSH and go.</div>
</div>
<div>
<div class="manifest__no">#04</div>
<div class="manifest__h">Read like english</div>
<div class="manifest__b">Operations are nouns and verbs. apt.packages. files.template. systemd.service.</div>
</div>
</div>
</div>
</section>
<section class="companies">
<div class="container">
<div class="section-eyebrow">// 180+ contributors</div>
<div class="companies__head">
Thank you to hundreds open source contributors from companies and institutes all over...
</div>
<div class="companies__grid">
<div class="company"><span class="company__no" aria-hidden="true">01</span>SAP</div>
<div class="company"><span class="company__no" aria-hidden="true">02</span>EPAM Systems</div>
<div class="company"><span class="company__no" aria-hidden="true">03</span>Lawrence Livermore</div>
<div class="company"><span class="company__no" aria-hidden="true">04</span>Utrecht University</div>
<div class="company"><span class="company__no" aria-hidden="true">05</span>Odoo</div>
<div class="company"><span class="company__no" aria-hidden="true">06</span>Rochester Inst. of Tech.</div>
<div class="company"><span class="company__no" aria-hidden="true">07</span>Linköping University</div>
<div class="company"><span class="company__no" aria-hidden="true">08</span>Paul Scherrer Institute</div>
<div class="company"><span class="company__no" aria-hidden="true">09</span>Iress</div>
<div class="company"><span class="company__no" aria-hidden="true">10</span>NPR</div>
<div class="company"><span class="company__no" aria-hidden="true">11</span>Fox-IT</div>
<div class="company"><span class="company__no" aria-hidden="true">12</span>Prezi</div>
<div class="company"><span class="company__no" aria-hidden="true">13</span>Sensorfact</div>
<div class="company"><span class="company__no" aria-hidden="true">14</span>EDITED</div>
<div class="company"><span class="company__no" aria-hidden="true">15</span>Cynerio</div>
</div>
</div>
</section>
<section class="cta">
<div class="container">
<div class="cta__eyebrow"># ready when you are</div>
<div class="cta__logo"><img src="static/logo.png" alt="" width="56" height="56"></div>
<h2><span class="noselect">$ </span>uv tool install pyinfra<span class="noselect green">_</span></h2>
<p>Read the 5-minute quickstart. Deploy your first host today. Replace your ansible repo next quarter.</p>
<div class="cta__btns">
<a class="btn-brand" href="https://docs.pyinfra.com/page/getting-started.html">[ quickstart → ]</a>
<a class="btn-outline" href="https://github.com/pyinfra-dev/pyinfra">[ github ↗ ]</a>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="footer__grid">
<div>
<div class="footer__brand">
<img src="static/logo.png" alt="" width="24" height="24">
<span>~/pyinfra</span>
</div>
<div class="footer__tag">mit licensed · python 3.10+</div>
</div>
<div class="footer__col">
<div class="footer__col-h">/docs</div>
<ul>
<li><a href="https://docs.pyinfra.com/page/getting-started.html">quickstart</a></li>
<li><a href="https://docs.pyinfra.com/page/operations.html">operations</a></li>
<li><a href="https://docs.pyinfra.com/page/connectors.html">connectors</a></li>
</ul>
</div>
<div class="footer__col">
<div class="footer__col-h">/community</div>
<ul>
<li><a href="https://github.com/pyinfra-dev/pyinfra">github</a></li>
<li><a href="https://matrix.to/#/#pyinfra:matrix.org">matrix chat</a></li>
<li><a href="https://github.com/pyinfra-dev/pyinfra/discussions">discussions</a></li>
</ul>
</div>
<div class="footer__col">
<div class="footer__col-h">/meta</div>
<ul>
<li><a href="https://github.com/pyinfra-dev/pyinfra/blob/3.x/LICENSE.md">mit license</a></li>
<li><a href="https://github.com/pyinfra-dev/pyinfra/blob/3.x/CHANGELOG.md">changelog</a></li>
</ul>
</div>
</div>
<div class="footer__base">
<span>© 2015–2026 · pyinfra and contributors</span>
<span><span class="live">●</span> all systems operational</span>
</div>
</div>
</footer>
<script src="static/script.js" defer></script>
<script async defer data-domain="pyinfra.com" src="https://stats.oxygem.com/js/index.js"></script>
</body>
</html>