Debian Codegraph @

README.de-ch.md

raw
1 [![Supported Python Versions](https://img.shields.io/pypi/pyversions/rich)](https://pypi.org/project/rich/) [![PyPI version](https://badge.fury.io/py/rich.svg)](https://badge.fury.io/py/rich)
2
3 [![Downloads](https://pepy.tech/badge/rich/month)](https://pepy.tech/project/rich)
4 [![codecov](https://img.shields.io/codecov/c/github/Textualize/rich?label=codecov&logo=codecov)](https://codecov.io/gh/Textualize/rich)
5 [![Rich blog](https://img.shields.io/badge/blog-rich%20news-yellowgreen)](https://www.willmcgugan.com/tag/rich/)
6 [![Twitter Follow](https://img.shields.io/twitter/follow/willmcgugan.svg?style=social)](https://twitter.com/willmcgugan)
7
8 ![Logo](https://github.com/textualize/rich/raw/master/imgs/logo.svg)
9
10 [English readme](https://github.com/textualize/rich/blob/master/README.md)
11 • [简体中文 readme](https://github.com/textualize/rich/blob/master/README.cn.md)
12 • [正體中文 readme](https://github.com/textualize/rich/blob/master/README.zh-tw.md)
13 • [Lengua española readme](https://github.com/textualize/rich/blob/master/README.es.md)
14 • [Deutsche readme](https://github.com/textualize/rich/blob/master/README.de.md)
15 • [Läs på svenska](https://github.com/textualize/rich/blob/master/README.sv.md)
16 • [日本語 readme](https://github.com/textualize/rich/blob/master/README.ja.md)
17 • [한국어 readme](https://github.com/textualize/rich/blob/master/README.kr.md)
18 • [Français readme](https://github.com/textualize/rich/blob/master/README.fr.md)
19 • [Schwizerdütsch readme](https://github.com/textualize/rich/blob/master/README.de-ch.md)
20 • [हिन्दी readme](https://github.com/textualize/rich/blob/master/README.hi.md)
21 • [Português brasileiro readme](https://github.com/textualize/rich/blob/master/README.pt-br.md)
22 • [Italian readme](https://github.com/textualize/rich/blob/master/README.it.md)
23 • [Русский readme](https://github.com/textualize/rich/blob/master/README.ru.md)
24 • [فارسی readme](https://github.com/textualize/rich/blob/master/README.fa.md)
25 • [Türkçe readme](https://github.com/textualize/rich/blob/master/README.tr.md)
26 • [Polskie readme](https://github.com/textualize/rich/blob/master/README.pl.md)
27
28 Rich isch ä Python Library för _rich_ Text ond ganz schöni formatiärig im Törminäl
29
30 D [Rich API](https://rich.readthedocs.io/en/latest/) machts ganz eifach zom Farbä ond Stiil zu de Törminälusgob hinzu z füäge. Rich cha au schöni Tabelle, Progressbare, Markdown, Syntax hervorhebe, Tracebäcks und meh darstelle — fix fertig usem Böxli.
31
32 ![Features](https://github.com/textualize/rich/raw/master/imgs/features.png)
33
34 E Video Iifüärig öber Rich geds onder [calmcode.io](https://calmcode.io/rich/introduction.html) vo [@fishnets88](https://twitter.com/fishnets88).
35
36 Lueg was [anderi öber Rich säged](https://www.willmcgugan.com/blog/pages/post/rich-tweets/).
37
38 ## Kompatibilität
39
40 Rich funktioniert mit Linux, OSX ond Windows. True color / emoji funktioniert mit em neue Windows Törminäl, s klassische Törminäl isch of 16 Farbe limitiärt. Rich brucht Python 3.6.3 oder neuer.
41
42 Rich funktioniert mit [Jupyter notebooks](https://jupyter.org/) ohni irgendwelchä zuäsätzloche konfiguration.
43
44 ## Installation
45
46 Installation mit `pip` oder mit dim liäblings PyPI Päckli-Manager.
47
48 ```sh
49 python -m pip install rich
50 ```
51
52 Für das do us zum d Rich usgob im Törminäl z teste:
53
54 ```sh
55 python -m rich
56 ```
57
58 ## Rich Print
59
60 Zom ohni Ufwand Rich Usgob zu dinnere Applikation hinzuäfüäge, chasch eifach d [rich print](https://rich.readthedocs.io/en/latest/introduction.html#quick-start) Methodä importiäre, weli di glich Signatuur hed wiä d Builtin Python Funktion. Versuech das:
61
62 ```python
63 from rich import print
64
65 print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
66 ```
67
68 ![Hello World](https://github.com/textualize/rich/raw/master/imgs/print.png)
69
70 ## Rich REPL
71
72 Rich cha i de Python REPL installiert werde so dass irgend e Datestruktuur hübsch usgeh ond Highlighted wird.
73
74 ```python
75 >>> from rich import pretty
76 >>> pretty.install()
77 ```
78
79 ![REPL](https://github.com/textualize/rich/raw/master/imgs/repl.png)
80
81 ## Console bruchä
82
83 Für meh kontrolle öber de Törminäl inhalt, importiär und instanziär e [Console](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console) Objekt.
84
85 ```python
86 from rich.console import Console
87
88 console = Console()
89 ```
90
91 S Console Objekt hät e `print` Methode mitäre absichtloch gliche Schnittstell wiä d Builtin `print` Funktion. Do es Bispiil wiä mos brucht:
92
93 ```python
94 console.print("Hello", "World!")
95 ```
96
97 Wiä erwartet wird `"Hello World!"` im Törminäl usgeh. Beach das im gägesatz zu de Builtin `print` Funktion, Rich de text so ombricht das es id Törminäl breiti ine passt.
98
99 Es ged es paar Wäg zom Farb und Stiil zu de Usgob hinzuä z füäge. Me cha en stiil a de ganze Usgob zuäwiise i dem mo s Schlösselwortargument `style` verwendet. Do es Bispiil:
100
101 ```python
102 console.print("Hello", "World!", style="bold red")
103 ```
104
105 D Usgob gsiät öppe ä so us:
106
107 ![Hello World](https://github.com/textualize/rich/raw/master/imgs/hello_world.png)
108
109 Da isch guät für d Gstalltig vom Text pro Liniä. Vör ä granularäri Gstalltig hed Rich e spezielli Markup mitäre ähnloche Befehlsufbau wiä [bbcode](https://en.wikipedia.org/wiki/BBCode). Do es Bispiil:
110
111 ```python
112 console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].")
113 ```
114
115 ![Console Markup](https://github.com/textualize/rich/raw/master/imgs/where_there_is_a_will.png)
116
117 Du chasch mitmäne Console Objekt mit wenig Ufwand aasprechendi Usgob erziile. Lueg do d [Console API](https://rich.readthedocs.io/en/latest/console.html) Dokumentation für d Details a.
118
119 ## Rich Inspect
120
121 Rich hät e [inspect](https://rich.readthedocs.io/en/latest/reference/init.html?highlight=inspect#rich.inspect) Funktion wo cha Bricht öber jeglochi Python Objekt, wie Class, Instanz oder Builtin erstelle.
122
123 ```python
124 >>> my_list = ["foo", "bar"]
125 >>> from rich import inspect
126 >>> inspect(my_list, methods=True)
127 ```
128
129 ![Log](https://github.com/textualize/rich/raw/master/imgs/inspect.png)
130
131 Lueg do d [inspect Dokumentation](https://rich.readthedocs.io/en/latest/reference/init.html#rich.inspect) für d Details a.
132
133 # Rich-Bibliothek
134
135 Rich häd ä Aazahl vo integriäte _renderables_ wo du chasch verwende zum eleganti Usgobe i dinner e CLI generiäre ond der hälfed bim debugge vo dim Code.
136
137 Drock of di folgende Öberschrifte für d Details:
138
139 <details>
140 <summary>Log</summary>
141
142 S Console Objekt hät e `log()` Methode wo verglichbar zu de `print()` Schnittstell isch aber zuäsätzloch no e Spaltä för di aktuäll Zitt und d Datai mit de Zille wo de Ufruäf macht us git. Standardmässig tuät Rich es Syntax Highlighting für Python Strukturä sowiä repr Text machä. Went e Collection (wiä zum Bispiil dict oder list) loggsch wird Rich das hübsch Usgeh so dass es i de verfüägbari Platz ine passt. Do es Bispiil für e paar vo dene Funktionä.
143
144 ```python
145 from rich.console import Console
146 console = Console()
147
148 test_data = [
149 {"jsonrpc": "2.0", "method": "sum", "params": [None, 1, 2, 4, False, True], "id": "1",},
150 {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
151 {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"},
152 ]
153
154 def test_log():
155 enabled = False
156 context = {
157 "foo": "bar",
158 }
159 movies = ["Deadpool", "Rise of the Skywalker"]
160 console.log("Hello from", console, "!")
161 console.log(test_data, log_locals=True)
162
163
164 test_log()
165 ```
166
167 Das do obe gid di folgend Usgob:
168
169 ![Log](https://github.com/textualize/rich/raw/master/imgs/log.png)
170
171 Beachte s Argument `log_locals` wo innere Tabelle di lokalä Variable us gid zur Zitt wo d Methodä ufgruäfä worde isch.
172
173 D log Methodä cha zum is Törminäl inne z Logge für langläbige Applikationä wie Server brucht werde isch aber au fürs Debuggä ganz e netti Hilf.
174
175 </details>
176 <details>
177 <summary>Logging Handler</summary>
178
179 Du chasch au d Builtin [Handler Class](https://rich.readthedocs.io/en/latest/logging.html) verwende zum d Usgob vom Python logging Module z formatiäre und iifärbe. Do es Bispiil vo de Usgob:
180
181 ![Logging](https://github.com/textualize/rich/raw/master/imgs/logging.png)
182
183 </details>
184
185 <details>
186 <summary>Emoji</summary>
187
188 Zom e Emoji i de Konsoleusgob iizfüäge tuä de name züschet zwei Doppelpünkt. Do es Bispiil:
189
190 ```python
191 >>> console.print(":smiley: :vampire: :pile_of_poo: :thumbs_up: :raccoon:")
192 😃 🧛 💩 👍 🦝
193 ```
194
195 Bitte verwend diä Funktion gschiid.
196
197 </details>
198
199 <details>
200 <summary>Tabelle</summary>
201
202 Rich cha flexiibäl [Tabelle](https://rich.readthedocs.io/en/latest/tables.html) mit Boxä us Unicodezeiche generiäre. Es gid e Viilzahl vo Formatiärigsoptionä für Ränder, Stiil, Zelleusrichtig ond so witter.
203
204 ![table movie](https://github.com/textualize/rich/raw/master/imgs/table_movie.gif)
205
206 D Animation obe isch mit [table_movie.py](https://github.com/textualize/rich/blob/master/examples/table_movie.py) us em Bispiil-Ordner erstellt worde.
207
208 Do es eifachs Tabelle-Bispiil:
209
210 ```python
211 from rich.console import Console
212 from rich.table import Table
213
214 console = Console()
215
216 table = Table(show_header=True, header_style="bold magenta")
217 table.add_column("Date", style="dim", width=12)
218 table.add_column("Title")
219 table.add_column("Production Budget", justify="right")
220 table.add_column("Box Office", justify="right")
221 table.add_row(
222 "Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118"
223 )
224 table.add_row(
225 "May 25, 2018",
226 "[red]Solo[/red]: A Star Wars Story",
227 "$275,000,000",
228 "$393,151,347",
229 )
230 table.add_row(
231 "Dec 15, 2017",
232 "Star Wars Ep. VIII: The Last Jedi",
233 "$262,000,000",
234 "[bold]$1,332,539,889[/bold]",
235 )
236
237 console.print(table)
238 ```
239
240 Das gid di folgend Usgob:
241
242 ![table](https://github.com/textualize/rich/raw/master/imgs/table.png)
243
244 Beacht das d Konsole Markup glich wie bi `print()` ond `log()` generiärt wird. Ond zwor cha alles wo vo Rich generiert werde cha au im Chopf / Zille iigfüägt werde (sogar anderi Tabellene).
245
246 D Klass `Table` isch gschiid gnuäg yum d Spaltebreite am verfüägbare Platz im Törminäl aazpasse und de Text gegäbenefalls umzbreche. Do isch s gliche Bispiil mit em Törminäl chlinner als d Tabelle vo obe:
247
248 ![table2](https://github.com/textualize/rich/raw/master/imgs/table2.png)
249
250 </details>
251
252 <details>
253 <summary>Progress Bars</summary>
254
255 Rich cha meereri flackerfreii [Progress](https://rich.readthedocs.io/en/latest/progress.html) Bars darstelle zum langläbigi Tasks verfolgä.
256
257 Zur eifache Benutzig irgend e Sequenz id `track` Funktion ine packe und über s Resultat iteriäre. Do es Bispiil:
258
259 ```python
260 from rich.progress import track
261
262 for step in track(range(100)):
263 do_step(step)
264 ```
265
266 Es isch nöd vill schwiriger zum mehräri Progress Bars hinzuä zfüäge. Do es Bispiil us de Doku:
267
268 ![progress](https://github.com/textualize/rich/raw/master/imgs/progress.gif)
269
270 D Spaltä cha so konfiguriärt werde das alli gwünschte Details aazeigt werded. D Built-in Spalte beinhaltät Prozentsatz, Dateigrössi, Dateigschwindikeit ond öbrigi Zitt. Do isch e andos Bispiil wo en laufände Download zeigt:
271
272 ![progress](https://github.com/textualize/rich/raw/master/imgs/downloader.gif)
273
274 Zums selber usprobiäre lueg [examples/downloader.py](https://github.com/textualize/rich/blob/master/examples/downloader.py) a, wo cha glichzittig mehräri URLs abelade und de Fortschritt aazeige.
275
276 </details>
277
278 <details>
279 <summary>Status</summary>
280
281 För Situatione wos schwär isch zum de Fortschritt z berechne, chasch d [status](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.status) Methode verwende wo en 'spinner' animiärt und e Nochricht darstellt. D Animation haltet di nöd ab d Konsole witter normal z bruche. Do es Bispiil:
282
283 ```python
284 from time import sleep
285 from rich.console import Console
286
287 console = Console()
288 tasks = [f"task {n}" for n in range(1, 11)]
289
290 with console.status("[bold green]Working on tasks...") as status:
291 while tasks:
292 task = tasks.pop(0)
293 sleep(1)
294 console.log(f"{task} complete")
295 ```
296
297 Das gid di folgendi Usgob im Törminäl.
298
299 ![status](https://github.com/textualize/rich/raw/master/imgs/status.gif)
300
301 D Spinner Animatione sind vo [cli-spinners](https://www.npmjs.com/package/cli-spinners) usglehnt. Du chasch en speziifischä Spinner mit em `spinner` Parameter uswähle. Start de folgend Befehl zom die verfüägbare Wert z gsiä:
302
303 ```
304 python -m rich.spinner
305 ```
306
307 De Befehl obe generiärt di folgändi Usgob im Törminäl:
308
309 ![spinners](https://github.com/textualize/rich/raw/master/imgs/spinners.gif)
310
311 </details>
312
313 <details>
314 <summary>Tree</summary>
315
316 Rich cha en [tree](https://rich.readthedocs.io/en/latest/tree.html) mit Hilfsliniä generiäre. En Tree isch ideal zom darstelle vo Dateistruktuure oder anderi hirarchischi Date.
317
318 S Label vom Tree cha en eifache Text or alles andere wo Rich cha rendere. Start das Folgendi für e Demonstation:
319
320 ```
321 python -m rich.tree
322 ```
323
324 Das generiärt di folgend Usgob:
325
326 ![markdown](https://github.com/textualize/rich/raw/master/imgs/tree.png)
327
328 Lueg s Bispiil Script [tree.py](https://github.com/textualize/rich/blob/master/examples/tree.py) für e Darstellig vo irgend eim Ordner als Tree, glich wie de Linux Befehl `tree`.
329
330 </details>
331
332 <details>
333 <summary>Spaltene</summary>
334
335 Rich cha Inhalt i hübsche [Spaltene](https://rich.readthedocs.io/en/latest/columns.html) darstelle mit glichä oder optimale Breiti. Do isch e ganz eifachi kopii vom (MacOS / Linux) `ls` Befehl wo Ordner in Spaltene darstellt
336
337 ```python
338 import os
339 import sys
340
341 from rich import print
342 from rich.columns import Columns
343
344 directory = os.listdir(sys.argv[1])
345 print(Columns(directory))
346 ```
347
348 De folgend Screenshot isch d Usgob vom [Spalte-Bispiil](https://github.com/textualize/rich/blob/master/examples/columns.py), wo Date vonnere API hollt ond in Spaltene darstellt:
349
350 ![columns](https://github.com/textualize/rich/raw/master/imgs/columns.png)
351
352 </details>
353
354 <details>
355 <summary>Markdown</summary>
356
357 Rich cha [markdown](https://rich.readthedocs.io/en/latest/markdown.html) übersetze ond leistet vernünftigi Ärbät bim formatiärige is Törminäl z übersetze.
358
359 Zum Markdown z übersetze importier d Klass `Markdown` und instanzier es mitem Markdown Text. Nocher gid mos uf de Konsolä us. Do es Bispiil:
360
361 ```python
362 from rich.console import Console
363 from rich.markdown import Markdown
364
365 console = Console()
366 with open("README.md") as readme:
367 markdown = Markdown(readme.read())
368 console.print(markdown)
369 ```
370
371 Das wird d Usgob ungefär wie s Folgende geh:
372
373 ![markdown](https://github.com/textualize/rich/raw/master/imgs/markdown.png)
374
375 </details>
376
377 <details>
378 <summary>Syntax Highlighting</summary>
379
380 Rich brucht d [pygments](https://pygments.org/) Library für d [Syntax Highlighting](https://rich.readthedocs.io/en/latest/syntax.html). S Bruche isch ähnloch zum Markdown übersetze; instanziär e `Syntax` Objekt ond gibs uf de Konsolä us. Do es Bispiil:
381
382 ```python
383 from rich.console import Console
384 from rich.syntax import Syntax
385
386 my_code = '''
387 def iter_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
388 """Iterate and generate a tuple with a flag for first and last value."""
389 iter_values = iter(values)
390 try:
391 previous_value = next(iter_values)
392 except StopIteration:
393 return
394 first = True
395 for value in iter_values:
396 yield first, False, previous_value
397 first = False
398 previous_value = value
399 yield first, True, previous_value
400 '''
401 syntax = Syntax(my_code, "python", theme="monokai", line_numbers=True)
402 console = Console()
403 console.print(syntax)
404 ```
405
406 Das wird d Usgob ungefär wie s Folgende geh:
407
408 ![syntax](https://github.com/textualize/rich/raw/master/imgs/syntax.png)
409
410 </details>
411
412 <details>
413 <summary>Tracebacks</summary>
414
415 Rich cha [wunderschöni Tracebacks](https://rich.readthedocs.io/en/latest/traceback.html) generiäre wo eifach zum läse sind und meh Code als de Standard-Python-Traceback darstellt. Du chasch Rich als default Traceback Handler setzä ond alli nöd abfangene Exceptions werded mit Rich dargstellt.
416
417 So gsiets ungefär ufemen OSX (ähnloch uf Linux) us:
418
419 ![traceback](https://github.com/textualize/rich/raw/master/imgs/traceback.png)
420
421 </details>
422
423 Alli Rich Renderables bruched s [Console-Protokoll](https://rich.readthedocs.io/en/latest/protocol.html), wo mo au für d eige Entwicklig vo Rich-Inhalt cha bruche.
424
425 # Rich für Ondernemä
426
427 Verfüägbar als Tidelift Abo.
428
429 De Betreue vo Rich ond tuusigi anderi Päkli schaffed mit Tidelift zum komerziälle Support und Wartig für Open Source Päkli wo du zum Baue vo dinnere Applikation bruchsch. Spar Zit, reduziär s Risiko ond verbessere d Code Health mit em bezahle vo de Wartig für gnau die Päkli wo mo brucht. [Lärn meh.](https://tidelift.com/subscription/pkg/pypi-rich?utm_source=pypi-rich&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
430
431 # Projekt wo Rich bruched
432
433 Do es paar Projekt wo Rich verwended:
434
435 - [BrancoLab/BrainRender](https://github.com/BrancoLab/BrainRender)
436 a python package for the visualization of three dimensional neuro-anatomical data
437 - [Ciphey/Ciphey](https://github.com/Ciphey/Ciphey)
438 Automated decryption tool
439 - [emeryberger/scalene](https://github.com/emeryberger/scalene)
440 a high-performance, high-precision CPU and memory profiler for Python
441 - [hedythedev/StarCli](https://github.com/hedythedev/starcli)
442 Browse GitHub trending projects from your command line
443 - [intel/cve-bin-tool](https://github.com/intel/cve-bin-tool)
444 This tool scans for a number of common, vulnerable components (openssl, libpng, libxml2, expat and a few others) to let you know if your system includes common libraries with known vulnerabilities.
445 - [nf-core/tools](https://github.com/nf-core/tools)
446 Python package with helper tools for the nf-core community.
447 - [cansarigol/pdbr](https://github.com/cansarigol/pdbr)
448 pdb + Rich library for enhanced debugging
449 - [plant99/felicette](https://github.com/plant99/felicette)
450 Satellite imagery for dummies.
451 - [seleniumbase/SeleniumBase](https://github.com/seleniumbase/SeleniumBase)
452 Automate & test 10x faster with Selenium & pytest. Batteries included.
453 - [smacke/ffsubsync](https://github.com/smacke/ffsubsync)
454 Automagically synchronize subtitles with video.
455 - [tryolabs/norfair](https://github.com/tryolabs/norfair)
456 Lightweight Python library for adding real-time 2D object tracking to any detector.
457 - [ansible/ansible-lint](https://github.com/ansible/ansible-lint) Ansible-lint checks playbooks for practices and behaviour that could potentially be improved
458 - [ansible-community/molecule](https://github.com/ansible-community/molecule) Ansible Molecule testing framework
459 - +[Vieli meh](https://github.com/textualize/rich/network/dependents)!
460
461 <!-- This is a test, no need to translate -->