flexablelib 3.4.0__tar.gz → 3.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flexablelib-3.4.0 → flexablelib-3.5.0}/CHANGELOG.md +50 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/PKG-INFO +42 -8
- {flexablelib-3.4.0 → flexablelib-3.5.0}/README.md +28 -1
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_frames.py +34 -1
- flexablelib-3.5.0/flexablelib/_images.py +1288 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/layout.py +19 -2
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib.egg-info/PKG-INFO +42 -8
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib.egg-info/SOURCES.txt +5 -0
- flexablelib-3.5.0/flexablelib.egg-info/requires.txt +35 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/package.json +1 -1
- {flexablelib-3.4.0 → flexablelib-3.5.0}/setup.py +6 -1
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v330_components.py +3 -1
- flexablelib-3.5.0/tests/test_v350_images.py +817 -0
- flexablelib-3.5.0/tests/test_v350_images_core.py +672 -0
- flexablelib-3.5.0/tools/bench_images.py +78 -0
- flexablelib-3.5.0/tools/image_demo.py +38 -0
- flexablelib-3.4.0/flexablelib.egg-info/requires.txt +0 -26
- {flexablelib-3.4.0 → flexablelib-3.5.0}/.coveragerc +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/LICENSE +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/MANIFEST.in +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/examples/admin.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/examples/dashboard.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/examples/keys.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/__init__.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_legacy/__init__.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_legacy/screen.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_legacy/widgets.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_speedups.c +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/_width_tables.h +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/box_topology.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/cells.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/colors.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/columns.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/fast.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/identifiers.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/merges.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/options.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/py.typed +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/readers.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/screen.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/style_compositions.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/table.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/table_strings.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/text_width.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/utils.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/widgets.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib/writers.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/pytest.ini +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/setup.cfg +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/style_examples.md +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/conftest.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/helpers.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_align_indicators.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_box_topology.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_cells.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_columns.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_excel.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_issues.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_merge_edge_matrix.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_merge_fill.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_merges.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_public_api_edges.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_readme_examples.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_stress_matrix.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_style_line_widths.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_styles.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_text_width.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_upstream_issues.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v2021_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v210_rows_copy.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v2110_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v211_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v213_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v214_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v215_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v216_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v217_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v218_features.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v219_coverage.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v219_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v220_exports.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v221_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v222_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v223_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v224_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v230_none.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v231_fixes.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v232_merge_ansi.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v300_style_names.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v310_layout.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v320_tui.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v330_frames.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v330_layout.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v330_tui.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v331_formats.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v331_panel_width.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v331_readers_bom.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v331_readers_edges.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v331_tabs.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v340_accessibility.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v340_core.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/test_v340_input.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tests/wincon_child.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/bench_frames.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/benchmark.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/gen_ascii_table.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/generate_width_tables.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/pty_check.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/readme_gallery.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/stress_matrix.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/style_examples.py +0 -0
- {flexablelib-3.4.0 → flexablelib-3.5.0}/tools/text_to_png.py +0 -0
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.5.0] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Pictures in the terminal** (`flexablelib-components`, see
|
|
9
|
+
`docs/IMAGES.md`): `Image` and `ImageViewer`, and `FilePreview` draws
|
|
10
|
+
image files (and the first page of PDFs and SVGs when `pdftoppm`,
|
|
11
|
+
PyMuPDF, `rsvg-convert` or cairosvg is available). Automatic fallback
|
|
12
|
+
chain: **kitty graphics protocol** (Unicode placeholders on kitty 0.28+,
|
|
13
|
+
Ghostty and through tmux passthrough), **iTerm2 inline images**,
|
|
14
|
+
**sixel**, Unicode blocks (half blocks, quadrants, sextants, braille in
|
|
15
|
+
truecolor / 256 / 16 colours or mono), ASCII, then an **OSC 8 link** that
|
|
16
|
+
opens the picture in the browser (`BROWSER`, `xdg-open`, `gio`, `open`,
|
|
17
|
+
`start`, `wslview`), and with no browser and no display a **warning**
|
|
18
|
+
(`⚠` / `!`) with the file name and the reason -- nothing is opened.
|
|
19
|
+
`fit` (`contain`, `cover`, `fill`, `none`), proportions from the cell
|
|
20
|
+
size in pixels, `alt`, `caption`, `background`, `animate`, `focusable`
|
|
21
|
+
(Enter / `o` / click open it).
|
|
22
|
+
- **Graphics detection** (`flexablelib_tui.graphics`, `detect_graphics`,
|
|
23
|
+
`GraphicsInfo`): environment first (kitty, Ghostty, WezTerm, iTerm2, VS
|
|
24
|
+
Code, Konsole, mintty, Warp, rio, foot, mlterm, contour, Windows
|
|
25
|
+
Terminal, Terminal.app, tmux client features and passthrough, GNU
|
|
26
|
+
screen), then one short query of the terminal (kitty APC query,
|
|
27
|
+
`CSI 16 t` / `CSI 14 t` cell and window pixels, `TIOCGWINSZ`,
|
|
28
|
+
XTSMGRAPHICS, XTVERSION, DA1), cached; `App` asks through its terminal
|
|
29
|
+
and replays keys typed meanwhile. `FLEXABLELIB_IMAGE=kitty|iterm|sixel|
|
|
30
|
+
blocks|half|quadrant|sextant|braille|ascii|link|none` forces a method,
|
|
31
|
+
`FLEXABLELIB_NO_BROWSER=1` says there is no browser.
|
|
32
|
+
- **Image decoding without dependencies** (`flexablelib._images`): PNG
|
|
33
|
+
(every colour type and depth, transparency, Adam7), GIF (frames,
|
|
34
|
+
disposal, interlace), BMP (1–32 bit, bit fields), PPM/PGM/PBM; Pillow
|
|
35
|
+
(`flexablelib[images]`) adds JPEG, WebP, TIFF and the rest. URLs with a
|
|
36
|
+
timeout and a size cap.
|
|
37
|
+
- **C acceleration** in `flexablelib-speedups` for resizing (area
|
|
38
|
+
average), median-cut quantization, the sixel encoder, PNG unfiltering
|
|
39
|
+
and the block/braille conversion, byte-identical to the Python fallback
|
|
40
|
+
(29–87× faster; `tools/bench_images.py`). `FLEXABLELIB_IMAGES=python`
|
|
41
|
+
forces Python.
|
|
42
|
+
- Extras `images` (Pillow) -- included in `all` -- and `svg` (cairosvg).
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Frames carry pictures as an invisible zero-width mark that becomes the
|
|
46
|
+
picture sequence when the frame is written (`str()`, `print`, `Live`,
|
|
47
|
+
`App`): widths, layouts and the frame diff are unchanged. `Live` redraws a
|
|
48
|
+
picture when a line it covers changes and deletes kitty pictures that
|
|
49
|
+
left the screen.
|
|
50
|
+
- `Card` and `Grid` without colour keep the invisible component and picture
|
|
51
|
+
marks (clicks and pictures inside layouts work with `NO_COLOR`).
|
|
52
|
+
- `App` reaches components inside a `Card` body (focus, keys, clicks).
|
|
53
|
+
- The accessibility audit reports `no alt text` for images.
|
|
54
|
+
|
|
5
55
|
## [3.4.0] - 2026-11-12
|
|
6
56
|
|
|
7
57
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.0
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 54 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -46,18 +46,25 @@ Requires-Dist: openpyxl>=3.0; extra == "excel"
|
|
|
46
46
|
Provides-Extra: html
|
|
47
47
|
Requires-Dist: lxml>=4.0; extra == "html"
|
|
48
48
|
Provides-Extra: tui
|
|
49
|
-
Requires-Dist: flexablelib-tui==3.
|
|
49
|
+
Requires-Dist: flexablelib-tui==3.5.0; extra == "tui"
|
|
50
50
|
Provides-Extra: components
|
|
51
|
-
Requires-Dist: flexablelib-components==3.
|
|
51
|
+
Requires-Dist: flexablelib-components==3.5.0; extra == "components"
|
|
52
52
|
Provides-Extra: speed
|
|
53
|
-
Requires-Dist: flexablelib-speedups==3.
|
|
53
|
+
Requires-Dist: flexablelib-speedups==3.5.0; extra == "speed"
|
|
54
|
+
Provides-Extra: images
|
|
55
|
+
Requires-Dist: Pillow>=8; extra == "images"
|
|
56
|
+
Requires-Dist: flexablelib-tui==3.5.0; extra == "images"
|
|
57
|
+
Requires-Dist: flexablelib-components==3.5.0; extra == "images"
|
|
58
|
+
Provides-Extra: svg
|
|
59
|
+
Requires-Dist: cairosvg>=2.5; extra == "svg"
|
|
54
60
|
Provides-Extra: all
|
|
55
61
|
Requires-Dist: pandas>=1.0; extra == "all"
|
|
56
62
|
Requires-Dist: openpyxl>=3.0; extra == "all"
|
|
57
63
|
Requires-Dist: lxml>=4.0; extra == "all"
|
|
58
|
-
Requires-Dist:
|
|
59
|
-
Requires-Dist: flexablelib-
|
|
60
|
-
Requires-Dist: flexablelib-
|
|
64
|
+
Requires-Dist: Pillow>=8; extra == "all"
|
|
65
|
+
Requires-Dist: flexablelib-tui==3.5.0; extra == "all"
|
|
66
|
+
Requires-Dist: flexablelib-components==3.5.0; extra == "all"
|
|
67
|
+
Requires-Dist: flexablelib-speedups==3.5.0; extra == "all"
|
|
61
68
|
Dynamic: author
|
|
62
69
|
Dynamic: author-email
|
|
63
70
|
Dynamic: classifier
|
|
@@ -95,7 +102,7 @@ Dynamic: summary
|
|
|
95
102
|
|
|
96
103
|
**flexablelib** turns rows and columns into readable tables for terminals, logs,
|
|
97
104
|
reports and docs. It has **no runtime dependencies**, ships **prebuilt wheels
|
|
98
|
-
with an optional C speed-up**, and is covered by **4,
|
|
105
|
+
with an optional C speed-up**, and is covered by **4,500+ tests** on Python
|
|
99
106
|
3.8 – 3.14 (Linux, Windows, macOS).
|
|
100
107
|
|
|
101
108
|
Since 3.3.0 the same library builds **complete interactive terminal
|
|
@@ -208,6 +215,33 @@ Since 3.4.0: [docs/INPUT.md](https://github.com/Opus-Perpetuus/flexablelib/blob/
|
|
|
208
215
|
</tr>
|
|
209
216
|
</table>
|
|
210
217
|
|
|
218
|
+
### Pictures in the terminal
|
|
219
|
+
|
|
220
|
+
Since 3.5.0: [docs/IMAGES.md](https://github.com/Opus-Perpetuus/flexablelib/blob/main/docs/IMAGES.md) — kitty, iTerm2, sixel, Unicode blocks, ASCII, then a link to the browser, then a warning. Real terminals under Xvfb.
|
|
221
|
+
|
|
222
|
+
<table>
|
|
223
|
+
<tr>
|
|
224
|
+
<td width="50%"><b>kitty graphics protocol</b> — detected, Unicode placeholders<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/01_kitty.png" alt="A picture in kitty" width="420"></td>
|
|
225
|
+
<td width="50%"><b>iTerm2 inline images</b> — WezTerm, iTerm2, VS Code, Konsole<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/02_iterm2_wezterm.png" alt="iTerm2 images in WezTerm" width="420"></td>
|
|
226
|
+
</tr>
|
|
227
|
+
<tr>
|
|
228
|
+
<td><b>sixel</b> — xterm, foot, mlterm, Windows Terminal<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/03_sixel_xterm_foot.png" alt="sixel in xterm and foot" width="420"></td>
|
|
229
|
+
<td><b>Unicode blocks</b> — half blocks, quadrants, sextants<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/04_bloques_unicode.png" alt="Unicode block pictures" width="420"></td>
|
|
230
|
+
</tr>
|
|
231
|
+
<tr>
|
|
232
|
+
<td><b>Braille and ASCII</b> — mono with NO_COLOR, ASCII without Unicode<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/05_braille_ascii.png" alt="Braille and ASCII pictures" width="420"></td>
|
|
233
|
+
<td><b>Inside Grid, Card and App</b> — the frame diff keeps working<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/08_card_grid_app.png" alt="Pictures inside a dashboard" width="420"></td>
|
|
234
|
+
</tr>
|
|
235
|
+
<tr>
|
|
236
|
+
<td><b>Link to the browser</b> — OSC 8, Enter or click opens it<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/06_enlace_osc8.png" alt="Link fallback" width="420"></td>
|
|
237
|
+
<td><b>No browser, no display</b> — a warning, nothing opened<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/07_aviso_sin_navegador.png" alt="Warning when no browser is available" width="420"></td>
|
|
238
|
+
</tr>
|
|
239
|
+
<tr>
|
|
240
|
+
<td><b>Redraws in kitty, xterm and WezTerm</b> — ImageViewer in an App<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/09_visor_redibujo.png" alt="ImageViewer switching pictures" width="420"></td>
|
|
241
|
+
<td><b>C acceleration</b> — resize, quantize, sixel, blocks<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/10_benchmark.png" alt="C versus Python picture timings" width="420"></td>
|
|
242
|
+
</tr>
|
|
243
|
+
</table>
|
|
244
|
+
|
|
211
245
|
### Speed
|
|
212
246
|
|
|
213
247
|
<p align="center">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
**flexablelib** turns rows and columns into readable tables for terminals, logs,
|
|
23
23
|
reports and docs. It has **no runtime dependencies**, ships **prebuilt wheels
|
|
24
|
-
with an optional C speed-up**, and is covered by **4,
|
|
24
|
+
with an optional C speed-up**, and is covered by **4,500+ tests** on Python
|
|
25
25
|
3.8 – 3.14 (Linux, Windows, macOS).
|
|
26
26
|
|
|
27
27
|
Since 3.3.0 the same library builds **complete interactive terminal
|
|
@@ -134,6 +134,33 @@ Since 3.4.0: [docs/INPUT.md](https://github.com/Opus-Perpetuus/flexablelib/blob/
|
|
|
134
134
|
</tr>
|
|
135
135
|
</table>
|
|
136
136
|
|
|
137
|
+
### Pictures in the terminal
|
|
138
|
+
|
|
139
|
+
Since 3.5.0: [docs/IMAGES.md](https://github.com/Opus-Perpetuus/flexablelib/blob/main/docs/IMAGES.md) — kitty, iTerm2, sixel, Unicode blocks, ASCII, then a link to the browser, then a warning. Real terminals under Xvfb.
|
|
140
|
+
|
|
141
|
+
<table>
|
|
142
|
+
<tr>
|
|
143
|
+
<td width="50%"><b>kitty graphics protocol</b> — detected, Unicode placeholders<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/01_kitty.png" alt="A picture in kitty" width="420"></td>
|
|
144
|
+
<td width="50%"><b>iTerm2 inline images</b> — WezTerm, iTerm2, VS Code, Konsole<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/02_iterm2_wezterm.png" alt="iTerm2 images in WezTerm" width="420"></td>
|
|
145
|
+
</tr>
|
|
146
|
+
<tr>
|
|
147
|
+
<td><b>sixel</b> — xterm, foot, mlterm, Windows Terminal<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/03_sixel_xterm_foot.png" alt="sixel in xterm and foot" width="420"></td>
|
|
148
|
+
<td><b>Unicode blocks</b> — half blocks, quadrants, sextants<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/04_bloques_unicode.png" alt="Unicode block pictures" width="420"></td>
|
|
149
|
+
</tr>
|
|
150
|
+
<tr>
|
|
151
|
+
<td><b>Braille and ASCII</b> — mono with NO_COLOR, ASCII without Unicode<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/05_braille_ascii.png" alt="Braille and ASCII pictures" width="420"></td>
|
|
152
|
+
<td><b>Inside Grid, Card and App</b> — the frame diff keeps working<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/08_card_grid_app.png" alt="Pictures inside a dashboard" width="420"></td>
|
|
153
|
+
</tr>
|
|
154
|
+
<tr>
|
|
155
|
+
<td><b>Link to the browser</b> — OSC 8, Enter or click opens it<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/06_enlace_osc8.png" alt="Link fallback" width="420"></td>
|
|
156
|
+
<td><b>No browser, no display</b> — a warning, nothing opened<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/07_aviso_sin_navegador.png" alt="Warning when no browser is available" width="420"></td>
|
|
157
|
+
</tr>
|
|
158
|
+
<tr>
|
|
159
|
+
<td><b>Redraws in kitty, xterm and WezTerm</b> — ImageViewer in an App<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/09_visor_redibujo.png" alt="ImageViewer switching pictures" width="420"></td>
|
|
160
|
+
<td><b>C acceleration</b> — resize, quantize, sixel, blocks<br><img src="https://raw.githubusercontent.com/Opus-Perpetuus/flexablelib/main/docs/img/v35/10_benchmark.png" alt="C versus Python picture timings" width="420"></td>
|
|
161
|
+
</tr>
|
|
162
|
+
</table>
|
|
163
|
+
|
|
137
164
|
### Speed
|
|
138
165
|
|
|
139
166
|
<p align="center">
|
|
@@ -39,7 +39,8 @@ __all__ = ['ACCELERATED', 'BACKEND', 'use', 'available', 'visible_width',
|
|
|
39
39
|
'slice_columns',
|
|
40
40
|
'border_grid', 'changed_lines', 'render_diff', 'ascii_fold',
|
|
41
41
|
'extract_marks', 'mark_open', 'MARK_CLOSE', 'GLYPH_ORDER',
|
|
42
|
-
'ASCII_FOLD'
|
|
42
|
+
'ASCII_FOLD', 'GRAPHICS_MARK', 'expand_graphics',
|
|
43
|
+
'set_graphics_expander']
|
|
43
44
|
|
|
44
45
|
# The order border_grid() expects its 11 glyphs in.
|
|
45
46
|
GLYPH_ORDER = ('h', 'v', 'tl', 'tr', 'bl', 'br', 'lt', 'rt', 'tt', 'bt', 'x')
|
|
@@ -375,3 +376,35 @@ extract_marks = _py_extract_marks
|
|
|
375
376
|
|
|
376
377
|
use('python' if os.environ.get('FLEXABLELIB_FRAMES', '').lower() == 'python'
|
|
377
378
|
else 'auto')
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
# +---------------------------------------------------------------------------+
|
|
382
|
+
# Pictures: frames carry a zero-width mark (ESC ] 8971 ; id BEL) where a
|
|
383
|
+
# picture goes; flexablelib_tui.graphics registers the function that turns
|
|
384
|
+
# marks into kitty / iTerm2 / sixel sequences when a frame is printed.
|
|
385
|
+
|
|
386
|
+
GRAPHICS_MARK = '\x1b]8971;'
|
|
387
|
+
_graphics_expander = None
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def set_graphics_expander(function):
|
|
391
|
+
"""Install the function :func:`expand_graphics` calls (or ``None``)."""
|
|
392
|
+
global _graphics_expander
|
|
393
|
+
_graphics_expander = function
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def expand_graphics(text):
|
|
397
|
+
"""``text`` with picture marks expanded, when a picture module is
|
|
398
|
+
loaded and the text has any; otherwise ``text`` unchanged."""
|
|
399
|
+
if GRAPHICS_MARK not in text:
|
|
400
|
+
return text
|
|
401
|
+
function = _graphics_expander
|
|
402
|
+
if function is None:
|
|
403
|
+
# This module may have been reloaded after the picture module
|
|
404
|
+
# registered itself: find it again.
|
|
405
|
+
import sys
|
|
406
|
+
module = sys.modules.get('flexablelib_tui.graphics')
|
|
407
|
+
if module is None:
|
|
408
|
+
return text
|
|
409
|
+
function = module.expand
|
|
410
|
+
return function(text)
|