Debian Codegraph @

third_party/python/blessed/blessed-1.19.1.dist-info/METADATA

raw
1 Metadata-Version: 2.1
2 Name: blessed
3 Version: 1.19.1
4 Summary: Easy, practical library for making terminal apps, by providing an elegant, well-documented interface to Colors, Keyboard input, and screen Positioning capabilities.
5 Home-page: https://github.com/jquast/blessed
6 Author: Jeff Quast, Erik Rose, Avram Lubkin
7 Author-email: [email protected]
8 License: MIT
9 Project-URL: Documentation, https://blessed.readthedocs.io
10 Keywords: terminal,sequences,tty,curses,ncurses,formatting,style,color,console,keyboard,ansi,xterm
11 Platform: UNKNOWN
12 Classifier: Intended Audience :: Developers
13 Classifier: Natural Language :: English
14 Classifier: Development Status :: 5 - Production/Stable
15 Classifier: Environment :: Console
16 Classifier: Environment :: Console :: Curses
17 Classifier: License :: OSI Approved :: MIT License
18 Classifier: Operating System :: POSIX
19 Classifier: Operating System :: Microsoft :: Windows
20 Classifier: Programming Language :: Python :: 2
21 Classifier: Programming Language :: Python :: 2.7
22 Classifier: Programming Language :: Python :: 3
23 Classifier: Programming Language :: Python :: 3.4
24 Classifier: Programming Language :: Python :: 3.5
25 Classifier: Programming Language :: Python :: 3.6
26 Classifier: Programming Language :: Python :: 3.7
27 Classifier: Programming Language :: Python :: 3.8
28 Classifier: Programming Language :: Python :: 3.9
29 Classifier: Topic :: Software Development :: Libraries
30 Classifier: Topic :: Software Development :: User Interfaces
31 Classifier: Topic :: Terminals
32 Classifier: Typing :: Typed
33 Requires-Python: >=2.7
34 License-File: LICENSE
35 Requires-Dist: wcwidth (>=0.1.4)
36 Requires-Dist: six (>=1.9.0)
37 Requires-Dist: jinxed (>=1.1.0) ; platform_system == "Windows"
38 Requires-Dist: ordereddict (==1.1) ; python_version < "2.7"
39 Requires-Dist: backports.functools-lru-cache (>=1.2.1) ; python_version < "3.2"
40
41 | |pypi_downloads| |codecov| |windows| |linux| |mac| |bsd|
42
43 Introduction
44 ============
45
46 Blessed is an easy, practical *library* for making *terminal* apps, by providing an elegant,
47 well-documented interface to Colors_, Keyboard_ input, and screen position and Location_
48 capabilities.
49
50 .. code-block:: python
51
52 from blessed import Terminal
53
54 term = Terminal()
55
56 print(term.home + term.clear + term.move_y(term.height // 2))
57 print(term.black_on_darkkhaki(term.center('press any key to continue.')))
58
59 with term.cbreak(), term.hidden_cursor():
60 inp = term.inkey()
61
62 print(term.move_down(2) + 'You pressed ' + term.bold(repr(inp)))
63
64 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_basic_intro.gif
65 :alt: Animation of running the code example
66
67 It's meant to be *fun* and *easy*, to do basic terminal graphics and styling with Python using
68 *blessed*. Terminal_ is the only class you need to import and the only object you should need for
69 Terminal capabilities.
70
71 Whether you want to improve CLI apps with colors, or make fullscreen applications or games,
72 *blessed* should help get you started quickly. Your users will love it because it works on Windows,
73 Mac, and Linux, and you will love it because it has plenty of documentation and examples!
74
75 Full documentation at https://blessed.readthedocs.io/en/latest/
76
77 Examples
78 --------
79
80 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/blessed_demo_intro.gif
81 :alt: Animations of x11-colorpicker.py, bounce.py, worms.py, and plasma.py
82
83 x11-colorpicker.py_, bounce.py_, worms.py_, and plasma.py_, from our repository.
84
85 Exemplary 3rd-party examples which use *blessed*,
86
87 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_3rdparty_voltron.png
88 :alt: Screenshot of 'Voltron' (By the author of Voltron, from their README).
89
90 Voltron_ is an extensible debugger UI toolkit written in Python
91
92 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_3rdparty_cursewords.gif
93 :alt: Animation of 'cursewords' (By the author of cursewords, from their README).
94
95 cursewords_ is "graphical" command line program for solving crossword puzzles in the terminal.
96
97 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_3rdparty_githeat.gif
98 :alt: Animation of 'githeat.interactive', using blessed repository at the time of capture.
99
100 GitHeat_ builds an interactive heatmap of git history.
101
102 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_3rdparty_dashing.gif
103 :alt: Animations from 'Dashing' (By the author of Dashing, from their README)
104
105 Dashing_ is a library to quickly create terminal-based dashboards.
106
107 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/demo_3rdparty_enlighten.gif
108 :alt: Animations from 'Enlighten' (By the author of Enlighten, from their README)
109
110 Enlighten_ is a console progress bar library that allows simultaneous output without redirection.
111
112 .. figure:: https://dxtz6bzwq9sxx.cloudfront.net/blessed_3rdparty_macht.gif
113 :alt: Demonstration of 'macht', a 2048 clone
114
115 macht_ is a clone of the (briefly popular) puzzle game, 2048.
116
117 Requirements
118 ------------
119
120 *Blessed* works with Windows, Mac, Linux, and BSD's, on Python 2.7, 3.4, 3.5, 3.6, 3.7, and 3.8.
121
122 Brief Overview
123 --------------
124
125 *Blessed* is more than just a Python wrapper around curses_:
126
127 * Styles_, Colors_, and maybe a little positioning without necessarily clearing the whole screen
128 first.
129 * Works great with Python's new f-strings_ or any other kind of string formatting.
130 * Provides up-to-the-moment Location_ and terminal height and width, so you can respond to terminal
131 size changes.
132 * Avoids making a mess if the output gets piped to a non-terminal, you can output sequences to any
133 file-like object such as *StringIO*, files, pipes or sockets.
134 * Uses `terminfo(5)`_ so it works with any terminal type and capability: No more C-like calls to
135 tigetstr_ and tparm_.
136 * Non-obtrusive calls to only the capabilities database ensures that you are free to mix and match
137 with calls to any other curses application code or library you like.
138 * Provides context managers `Terminal.fullscreen()`_ and `Terminal.hidden_cursor()`_ to safely
139 express terminal modes, curses development will no longer fudge up your shell.
140 * Act intelligently when somebody redirects your output to a file, omitting all of the special
141 sequences colors, but still containing all of the text.
142
143 *Blessed* is a fork of `blessings <https://github.com/erikrose/blessings>`_, which does all of
144 the same above with the same API, as well as following **enhancements**:
145
146 * Windows support, new since Dec. 2019!
147 * Dead-simple keyboard handling: safely decoding unicode input in your system's preferred locale and
148 supports application/arrow keys.
149 * 24-bit color support, using `Terminal.color_rgb()`_ and `Terminal.on_color_rgb()`_ and all X11
150 Colors_ by name, and not by number.
151 * Determine cursor location using `Terminal.get_location()`_, enter key-at-a-time input mode using
152 `Terminal.cbreak()`_ or `Terminal.raw()`_ context managers, and read timed key presses using
153 `Terminal.inkey()`_.
154 * Allows the *printable length* of strings that contain sequences to be determined by
155 `Terminal.length()`_, supporting additional methods `Terminal.wrap()`_ and `Terminal.center()`_,
156 terminal-aware variants of the built-in function `textwrap.wrap()`_ and method `str.center()`_,
157 respectively.
158 * Allows sequences to be removed from strings that contain them, using `Terminal.strip_seqs()`_ or
159 sequences and whitespace using `Terminal.strip()`_.
160
161 Before And After
162 ----------------
163
164 With the built-in curses_ module, this is how you would typically
165 print some underlined text at the bottom of the screen:
166
167 .. code-block:: python
168
169 from curses import tigetstr, setupterm, tparm
170 from fcntl import ioctl
171 from os import isatty
172 import struct
173 import sys
174 from termios import TIOCGWINSZ
175
176 # If we want to tolerate having our output piped to other commands or
177 # files without crashing, we need to do all this branching:
178 if hasattr(sys.stdout, 'fileno') and isatty(sys.stdout.fileno()):
179 setupterm()
180 sc = tigetstr('sc')
181 cup = tigetstr('cup')
182 rc = tigetstr('rc')
183 underline = tigetstr('smul')
184 normal = tigetstr('sgr0')
185 else:
186 sc = cup = rc = underline = normal = ''
187
188 # Save cursor position.
189 print(sc)
190
191 if cup:
192 # tigetnum('lines') doesn't always update promptly, hence this:
193 height = struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, '\000' * 8))[0]
194
195 # Move cursor to bottom.
196 print(tparm(cup, height - 1, 0))
197
198 print('This is {under}underlined{normal}!'
199 .format(under=underline, normal=normal))
200
201 # Restore cursor position.
202 print(rc)
203
204 The same program with *Blessed* is simply:
205
206 .. code-block:: python
207
208 from blessed import Terminal
209
210 term = Terminal()
211 with term.location(0, term.height - 1):
212 print('This is ' + term.underline('underlined') + '!', end='')
213
214 .. _curses: https://docs.python.org/3/library/curses.html
215 .. _tigetstr: http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tigetstr.3
216 .. _tparm: http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tparm.3
217 .. _`terminfo(5)`: https://invisible-island.net/ncurses/man/terminfo.5.html
218 .. _str.center(): https://docs.python.org/3/library/stdtypes.html#str.center
219 .. _textwrap.wrap(): https://docs.python.org/3/library/textwrap.html#textwrap.wrap
220 .. _Terminal: https://blessed.readthedocs.io/en/stable/terminal.html
221 .. _`Terminal.fullscreen()`: https://blessed.readthedocs.io/en/latest/api/terminal.html#blessed.terminal.Terminal.fullscreen
222 .. _`Terminal.get_location()`: https://blessed.readthedocs.io/en/latest/location.html#finding-the-cursor
223 .. _`Terminal.color_rgb()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.color_rgb
224 .. _`Terminal.hidden_cursor()`: https://blessed.readthedocs.io/en/latest/api/terminal.html#blessed.terminal.Terminal.hidden_cursor
225 .. _`Terminal.on_color_rgb()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.on_color_rgb
226 .. _`Terminal.length()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.length
227 .. _`Terminal.strip()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.strip
228 .. _`Terminal.rstrip()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.rstrip
229 .. _`Terminal.lstrip()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.lstrip
230 .. _`Terminal.strip_seqs()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.strip_seqs
231 .. _`Terminal.wrap()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.wrap
232 .. _`Terminal.center()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.center
233 .. _`Terminal.rjust()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.rjust
234 .. _`Terminal.ljust()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.ljust
235 .. _`Terminal.cbreak()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.cbreak
236 .. _`Terminal.raw()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.raw
237 .. _`Terminal.inkey()`: https://blessed.readthedocs.io/en/stable/api/terminal.html#blessed.terminal.Terminal.inkey
238 .. _Colors: https://blessed.readthedocs.io/en/stable/colors.html
239 .. _Styles: https://blessed.readthedocs.io/en/stable/terminal.html#styles
240 .. _Location: https://blessed.readthedocs.io/en/stable/location.html
241 .. _Keyboard: https://blessed.readthedocs.io/en/stable/keyboard.html
242 .. _Examples: https://blessed.readthedocs.io/en/stable/examples.html
243 .. _x11-colorpicker.py: https://blessed.readthedocs.io/en/stable/examples.html#x11-colorpicker-py
244 .. _bounce.py: https://blessed.readthedocs.io/en/stable/examples.html#bounce-py
245 .. _worms.py: https://blessed.readthedocs.io/en/stable/examples.html#worms-py
246 .. _plasma.py: https://blessed.readthedocs.io/en/stable/examples.html#plasma-py
247 .. _Voltron: https://github.com/snare/voltron
248 .. _cursewords: https://github.com/thisisparker/cursewords
249 .. _GitHeat: https://github.com/AmmsA/Githeat
250 .. _Dashing: https://github.com/FedericoCeratto/dashing
251 .. _Enlighten: https://github.com/Rockhopper-Technologies/enlighten
252 .. _macht: https://github.com/rolfmorel/macht
253 .. _f-strings: https://docs.python.org/3/reference/lexical_analysis.html#f-strings
254 .. |pypi_downloads| image:: https://img.shields.io/pypi/dm/blessed.svg?logo=pypi
255 :alt: Downloads
256 :target: https://pypi.org/project/blessed/
257 .. |codecov| image:: https://codecov.io/gh/jquast/blessed/branch/master/graph/badge.svg
258 :alt: codecov.io Code Coverage
259 :target: https://codecov.io/gh/jquast/blessed/
260 .. |linux| image:: https://img.shields.io/badge/Linux-yes-success?logo=linux
261 :alt: Linux supported
262 .. |windows| image:: https://img.shields.io/badge/Windows-NEW-success?logo=windows
263 :alt: Windows supported
264 .. |mac| image:: https://img.shields.io/badge/MacOS-yes-success?logo=apple
265 :alt: MacOS supported
266 .. |bsd| image:: https://img.shields.io/badge/BSD-yes-success?logo=freebsd
267 :alt: BSD supported
268
269