qansitextviewer 0.1.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.
Files changed (63) hide show
  1. qansitextviewer-0.1.0/.githooks/commit-msg +4 -0
  2. qansitextviewer-0.1.0/.github/workflows/ci.yml +81 -0
  3. qansitextviewer-0.1.0/.github/workflows/docs.yml +45 -0
  4. qansitextviewer-0.1.0/.github/workflows/release.yml +81 -0
  5. qansitextviewer-0.1.0/.gitignore +207 -0
  6. qansitextviewer-0.1.0/.python-version +1 -0
  7. qansitextviewer-0.1.0/CHANGELOG.md +44 -0
  8. qansitextviewer-0.1.0/LICENSE +339 -0
  9. qansitextviewer-0.1.0/PKG-INFO +88 -0
  10. qansitextviewer-0.1.0/README.md +57 -0
  11. qansitextviewer-0.1.0/ansi_text_viewer/__init__.py +1 -0
  12. qansitextviewer-0.1.0/ansi_text_viewer/ansi_escape_handler.py +316 -0
  13. qansitextviewer-0.1.0/ansi_text_viewer/ansi_text_viewer.py +1721 -0
  14. qansitextviewer-0.1.0/ansi_text_viewer/highlight.py +182 -0
  15. qansitextviewer-0.1.0/ansi_text_viewer/line_number_area.py +31 -0
  16. qansitextviewer-0.1.0/ansi_text_viewer/py.typed +0 -0
  17. qansitextviewer-0.1.0/ansi_text_viewer/search_handler.py +230 -0
  18. qansitextviewer-0.1.0/cliff.toml +21 -0
  19. qansitextviewer-0.1.0/demo.py +557 -0
  20. qansitextviewer-0.1.0/docs/api/highlighting.md +81 -0
  21. qansitextviewer-0.1.0/docs/api/internals.md +45 -0
  22. qansitextviewer-0.1.0/docs/api/viewer.md +303 -0
  23. qansitextviewer-0.1.0/docs/assets/demo_screen_after_wrap_text.png +0 -0
  24. qansitextviewer-0.1.0/docs/assets/demo_screen_before_wrap_text.png +0 -0
  25. qansitextviewer-0.1.0/docs/assets/demo_screen_with_ANSI_escape_code.png +0 -0
  26. qansitextviewer-0.1.0/docs/assets/demo_screen_with_all_functions_empty_logs.png +0 -0
  27. qansitextviewer-0.1.0/docs/assets/demo_screen_with_bookmarks.png +0 -0
  28. qansitextviewer-0.1.0/docs/assets/demo_screen_with_context_menu.png +0 -0
  29. qansitextviewer-0.1.0/docs/assets/demo_screen_with_highlight_search.png +0 -0
  30. qansitextviewer-0.1.0/docs/assets/demo_screen_with_highlight_text_selection.png +0 -0
  31. qansitextviewer-0.1.0/docs/assets/demo_screen_with_streaming_logs_and_number_line.png +0 -0
  32. qansitextviewer-0.1.0/docs/assets/demo_screen_with_system_fonts.png +0 -0
  33. qansitextviewer-0.1.0/docs/assets/simple_demo.png +0 -0
  34. qansitextviewer-0.1.0/docs/changelog.md +6 -0
  35. qansitextviewer-0.1.0/docs/gallery.md +106 -0
  36. qansitextviewer-0.1.0/docs/index.md +94 -0
  37. qansitextviewer-0.1.0/docs/troubleshooting.md +60 -0
  38. qansitextviewer-0.1.0/justfile +45 -0
  39. qansitextviewer-0.1.0/main.py +17 -0
  40. qansitextviewer-0.1.0/mkdocs.yml +82 -0
  41. qansitextviewer-0.1.0/pyproject.toml +95 -0
  42. qansitextviewer-0.1.0/simple_demo.py +10 -0
  43. qansitextviewer-0.1.0/tests/__init__.py +0 -0
  44. qansitextviewer-0.1.0/tests/conftest.py +22 -0
  45. qansitextviewer-0.1.0/tests/test_ansi_escape_handler.py +109 -0
  46. qansitextviewer-0.1.0/tests/test_ansi_text_viewer.py +93 -0
  47. qansitextviewer-0.1.0/tests/test_appearance.py +85 -0
  48. qansitextviewer-0.1.0/tests/test_async.py +87 -0
  49. qansitextviewer-0.1.0/tests/test_batch2.py +61 -0
  50. qansitextviewer-0.1.0/tests/test_bools.py +55 -0
  51. qansitextviewer-0.1.0/tests/test_colors.py +39 -0
  52. qansitextviewer-0.1.0/tests/test_diagnostics.py +62 -0
  53. qansitextviewer-0.1.0/tests/test_edgecases.py +63 -0
  54. qansitextviewer-0.1.0/tests/test_features.py +149 -0
  55. qansitextviewer-0.1.0/tests/test_fonts.py +43 -0
  56. qansitextviewer-0.1.0/tests/test_gui_flows.py +138 -0
  57. qansitextviewer-0.1.0/tests/test_highlight_rules.py +96 -0
  58. qansitextviewer-0.1.0/tests/test_line_number_area.py +11 -0
  59. qansitextviewer-0.1.0/tests/test_perf.py +29 -0
  60. qansitextviewer-0.1.0/tests/test_polish.py +83 -0
  61. qansitextviewer-0.1.0/tests/test_remaining.py +159 -0
  62. qansitextviewer-0.1.0/tests/test_security.py +51 -0
  63. qansitextviewer-0.1.0/uv.lock +1485 -0
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ # Installed via `just hooks` (sets git core.hooksPath to .githooks/).
3
+ # Rejects non-conventional commit messages before they are created.
4
+ uv run cz check --commit-msg-file "$1"
@@ -0,0 +1,81 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ env:
12
+ QT_QPA_PLATFORM: offscreen
13
+ UV_PYTHON: "3.14"
14
+
15
+ jobs:
16
+ test:
17
+ name: test (py${{ matrix.python-version }})
18
+ runs-on: ubuntu-24.04
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.11", "3.14"]
23
+ env:
24
+ UV_PYTHON: ${{ matrix.python-version }}
25
+ steps:
26
+ # Pinned to actions/checkout v7.0.1.
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
28
+ # Pinned to astral-sh/setup-uv v10.1.0.
29
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
30
+ - name: Install Qt runtime libs
31
+ run: |
32
+ sudo apt-get update
33
+ sudo apt-get install -y \
34
+ libgl1 libegl1 libxkbcommon0 libdbus-1-3 libfontconfig1
35
+ - name: Sync dependencies
36
+ run: uv sync --group dev
37
+ - name: Run tests
38
+ run: uv run --no-sync pytest -p no:cacheprovider -q
39
+
40
+ lint:
41
+ name: lint
42
+ runs-on: ubuntu-24.04
43
+ steps:
44
+ # Pinned to actions/checkout v7.0.1.
45
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
46
+ # Pinned to astral-sh/setup-uv v10.1.0.
47
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
48
+ - name: Check lockfile is in sync
49
+ run: uv lock --check
50
+ - name: Ruff check
51
+ run: uvx ruff@0.16.7 check ansi_text_viewer demo.py main.py tests
52
+ - name: Ruff format check
53
+ run: uvx ruff@0.16.7 format --check ansi_text_viewer demo.py main.py tests
54
+
55
+ typecheck:
56
+ name: typecheck
57
+ runs-on: ubuntu-24.04
58
+ steps:
59
+ # Pinned to actions/checkout v7.0.1.
60
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
61
+ # Pinned to astral-sh/setup-uv v10.1.0.
62
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
63
+ - name: Sync dependencies
64
+ run: uv sync --group dev
65
+ - name: mypy
66
+ run: uv run --no-sync mypy ansi_text_viewer
67
+ - name: ty
68
+ run: uv run --no-sync ty check ansi_text_viewer
69
+
70
+ docs:
71
+ name: docs
72
+ runs-on: ubuntu-24.04
73
+ steps:
74
+ # Pinned to actions/checkout v7.0.1.
75
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
76
+ # Pinned to astral-sh/setup-uv v10.1.0.
77
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
78
+ - name: Sync dependencies
79
+ run: uv sync --group dev
80
+ - name: Build docs
81
+ run: uv run --no-sync mkdocs build
@@ -0,0 +1,45 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: build
14
+ runs-on: ubuntu-24.04
15
+ steps:
16
+ # Pinned to actions/checkout v7.0.1.
17
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
18
+ # Pinned to astral-sh/setup-uv v10.1.0.
19
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
20
+ - name: Sync dependencies
21
+ run: uv sync --group dev
22
+ - name: Build docs
23
+ run: uv run --no-sync mkdocs build --site-dir site
24
+ # Pinned to actions/upload-pages-artifact v5.0.0.
25
+ - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9
26
+ with:
27
+ path: site
28
+
29
+ deploy:
30
+ name: deploy
31
+ needs: build
32
+ runs-on: ubuntu-24.04
33
+ permissions:
34
+ pages: write
35
+ id-token: write
36
+ concurrency:
37
+ group: github-pages
38
+ cancel-in-progress: false
39
+ environment:
40
+ name: github-pages
41
+ url: ${{ steps.deploy.outputs.page_url }}
42
+ steps:
43
+ # Pinned to actions/deploy-pages v5.0.1.
44
+ - id: deploy
45
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346
@@ -0,0 +1,81 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ tag:
10
+ description: "Existing tag to release (e.g. v0.2.0)."
11
+ required: true
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ release:
18
+ name: release
19
+ runs-on: ubuntu-24.04
20
+ permissions:
21
+ contents: write
22
+ env:
23
+ TAG: ${{ inputs.tag || github.ref_name }}
24
+ steps:
25
+ # Pinned to actions/checkout v7.0.1.
26
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
27
+ with:
28
+ fetch-depth: 0
29
+ # Pinned to astral-sh/setup-uv v10.1.0.
30
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
31
+ - name: Build distributions
32
+ run: uv build
33
+ - name: Check distributions
34
+ run: uv run --with twine twine check dist/*
35
+ - name: Extract release notes
36
+ run: |
37
+ python - <<'EOF'
38
+ import os
39
+ import re
40
+
41
+ tag = os.environ["TAG"]
42
+ version = tag[1:] if tag.startswith("v") else tag
43
+ text = open("CHANGELOG.md", encoding="utf-8").read()
44
+ match = re.search(
45
+ rf"^## \[{re.escape(version)}\].*?\n(.*?)(?=^## \[|\Z)",
46
+ text,
47
+ re.S | re.M,
48
+ )
49
+ if not match:
50
+ raise SystemExit(f"No CHANGELOG entry for [{version}]")
51
+ with open("release-notes.md", "w", encoding="utf-8") as f:
52
+ f.write(match.group(1).strip() + "\n")
53
+ EOF
54
+ - name: Create release
55
+ env:
56
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57
+ run: |
58
+ if ! gh release view "$TAG" >/dev/null 2>&1; then
59
+ gh release create "$TAG" \
60
+ --title "$TAG" \
61
+ --notes-file release-notes.md \
62
+ dist/*
63
+ else
64
+ gh release upload "$TAG" dist/* --clobber
65
+ fi
66
+
67
+ publish-pypi:
68
+ name: publish-pypi
69
+ needs: release
70
+ runs-on: ubuntu-24.04
71
+ permissions:
72
+ id-token: write
73
+ steps:
74
+ # Pinned to actions/checkout v7.0.1.
75
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
76
+ # Pinned to astral-sh/setup-uv v10.1.0.
77
+ - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4
78
+ - name: Build distributions
79
+ run: uv build
80
+ - name: Publish to PyPI
81
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here, newest first.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [0.1.0] - 2026-09-17
7
+
8
+ ### Added
9
+
10
+ - Async non-blocking appends (`appendAnsiTextAsync`, progress/finished
11
+ signals, cancel) with byte-identical output to the sync path.
12
+ - Pluggable highlight rules (`HighlightRule` protocol, `Span`,
13
+ `add_highlight_rule`) covering log levels, tracebacks, JSON, CMake,
14
+ justfiles, URLs, and `file:line` links.
15
+ - Theme-following default text colors with manual override
16
+ (`setDefaultColors`, `setColorsFollowTheme`) and session persistence.
17
+ - Font controls (`setFontSize`, `setFontFamily`, `useSystemFont`).
18
+ - Strict boolean parsing (`"false"`/`"0"`/`"off"` work) and symmetric
19
+ `is...()` getters for every flag.
20
+ - Bookmarks stored on text blocks; gutter click, list panel, navigation
21
+ skips filtered-out lines.
22
+ - Sessions (JSON save/load with validation), export (txt/html/md),
23
+ selection stats, current-line highlight, max-blocks/line-length caps.
24
+ - Color knobs (`setLogLevelColors`, `setBookmarkColor`,
25
+ `setSearchHighlightColor` active color, `currentLineColor`).
26
+ - Debug diagnostics: every silent fallback logs on the `ansi_text_viewer`
27
+ logger; contract violations raise with the offender named.
28
+ - Tooling: pytest suite, ruff (Google docstrings), mypy + ty, MkDocs API
29
+ docs with gallery, SHA-pinned CI on Python 3.11–3.14, commitizen with
30
+ conventional commits and Pages deploy workflow.
31
+ - Packaging: PyPI metadata (license, classifiers, authors, URLs),
32
+ `py.typed` marker verified in the wheel via `twine check`.
33
+
34
+ ### Changed
35
+
36
+ - Default text colors now follow the theme instead of fixed
37
+ terminal white-on-black.
38
+ - Links open on ++ctrl+click++ only (was: single click).
39
+ - Python requirement lowered to `>=3.11`.
40
+
41
+ ### Removed
42
+
43
+ - `test.py` demo shim — import the demo from `demo` instead:
44
+ `from demo import TestWindow`.