cui-py 0.2.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 (164) hide show
  1. cui_py-0.2.0/.github/workflows/build-publish.yml +226 -0
  2. cui_py-0.2.0/.github/workflows/ci.yml +111 -0
  3. cui_py-0.2.0/.gitignore +232 -0
  4. cui_py-0.2.0/CHANGELOG.md +63 -0
  5. cui_py-0.2.0/CMakeLists.txt +87 -0
  6. cui_py-0.2.0/LICENSE +22 -0
  7. cui_py-0.2.0/Makefile +182 -0
  8. cui_py-0.2.0/PKG-INFO +228 -0
  9. cui_py-0.2.0/README.md +202 -0
  10. cui_py-0.2.0/TODO.md +54 -0
  11. cui_py-0.2.0/csrc/cuipy_pty.c +47 -0
  12. cui_py-0.2.0/csrc/cuipy_pty.h +34 -0
  13. cui_py-0.2.0/csrc/cuipy_pty_stub.c +21 -0
  14. cui_py-0.2.0/docs/dev/coverage.md +513 -0
  15. cui_py-0.2.0/docs/dev/issues/cui-state-reset.md +89 -0
  16. cui_py-0.2.0/docs/dev/known-issues.md +9 -0
  17. cui_py-0.2.0/examples/dashboard.py +102 -0
  18. cui_py-0.2.0/examples/hello.py +27 -0
  19. cui_py-0.2.0/examples/showcase.py +380 -0
  20. cui_py-0.2.0/examples/term.py +64 -0
  21. cui_py-0.2.0/examples/todo.py +150 -0
  22. cui_py-0.2.0/pyproject.toml +79 -0
  23. cui_py-0.2.0/src/cui/__init__.py +17 -0
  24. cui_py-0.2.0/src/cui/_core.pyi +2337 -0
  25. cui_py-0.2.0/src/cui/_core.pyx +1575 -0
  26. cui_py-0.2.0/src/cui/_cui.pxd +3387 -0
  27. cui_py-0.2.0/src/cui/_gen.pxi +9686 -0
  28. cui_py-0.2.0/src/cui/py.typed +0 -0
  29. cui_py-0.2.0/tests/__init__.py +0 -0
  30. cui_py-0.2.0/tests/conftest.py +45 -0
  31. cui_py-0.2.0/tests/smoke_all.py +126 -0
  32. cui_py-0.2.0/tests/test_app.py +73 -0
  33. cui_py-0.2.0/tests/test_buffers.py +218 -0
  34. cui_py-0.2.0/tests/test_canvas.py +115 -0
  35. cui_py-0.2.0/tests/test_components.py +197 -0
  36. cui_py-0.2.0/tests/test_cui.py +82 -0
  37. cui_py-0.2.0/tests/test_examples.py +103 -0
  38. cui_py-0.2.0/tests/test_frame.py +107 -0
  39. cui_py-0.2.0/tests/test_input.py +155 -0
  40. cui_py-0.2.0/tests/test_nested.py +101 -0
  41. cui_py-0.2.0/tests/test_options.py +139 -0
  42. cui_py-0.2.0/tests/test_pty.py +146 -0
  43. cui_py-0.2.0/tests/test_scopes.py +135 -0
  44. cui_py-0.2.0/tests/test_smoke.py +24 -0
  45. cui_py-0.2.0/tests/test_state.py +52 -0
  46. cui_py-0.2.0/thirdparty/cui/CMakeLists.txt +359 -0
  47. cui_py-0.2.0/thirdparty/cui/LICENSE +21 -0
  48. cui_py-0.2.0/thirdparty/cui/THIRD_PARTY.md +13 -0
  49. cui_py-0.2.0/thirdparty/cui/VENDORED +4 -0
  50. cui_py-0.2.0/thirdparty/cui/assets/fonts/LICENSE-Geist.txt +92 -0
  51. cui_py-0.2.0/thirdparty/cui/assets/fonts/LICENSE-Inter.txt +92 -0
  52. cui_py-0.2.0/thirdparty/cui/assets/fonts/LICENSE-Lucide.txt +43 -0
  53. cui_py-0.2.0/thirdparty/cui/cmake/CuiApp.cmake +24 -0
  54. cui_py-0.2.0/thirdparty/cui/cmake/mingw-w64.cmake +11 -0
  55. cui_py-0.2.0/thirdparty/cui/include/cui/cui.h +5490 -0
  56. cui_py-0.2.0/thirdparty/cui/include/cui/cui_app.h +175 -0
  57. cui_py-0.2.0/thirdparty/cui/include/cui/cui_icons.h +177 -0
  58. cui_py-0.2.0/thirdparty/cui/include/cui/cui_ios_main.h +23 -0
  59. cui_py-0.2.0/thirdparty/cui/include/cui/cui_render.h +107 -0
  60. cui_py-0.2.0/thirdparty/cui/src/cui_actions.c +1273 -0
  61. cui_py-0.2.0/thirdparty/cui/src/cui_ai.c +1139 -0
  62. cui_py-0.2.0/thirdparty/cui/src/cui_bidi.c +200 -0
  63. cui_py-0.2.0/thirdparty/cui/src/cui_bidi.h +25 -0
  64. cui_py-0.2.0/thirdparty/cui/src/cui_bidi_data.h +722 -0
  65. cui_py-0.2.0/thirdparty/cui/src/cui_canvas.c +1187 -0
  66. cui_py-0.2.0/thirdparty/cui/src/cui_charts.c +1019 -0
  67. cui_py-0.2.0/thirdparty/cui/src/cui_chrome.c +1352 -0
  68. cui_py-0.2.0/thirdparty/cui/src/cui_code.c +636 -0
  69. cui_py-0.2.0/thirdparty/cui/src/cui_controls.c +1114 -0
  70. cui_py-0.2.0/thirdparty/cui/src/cui_core.c +1206 -0
  71. cui_py-0.2.0/thirdparty/cui/src/cui_creative.c +1055 -0
  72. cui_py-0.2.0/thirdparty/cui/src/cui_curves.c +1224 -0
  73. cui_py-0.2.0/thirdparty/cui/src/cui_data.c +514 -0
  74. cui_py-0.2.0/thirdparty/cui/src/cui_devpanels.c +1016 -0
  75. cui_py-0.2.0/thirdparty/cui/src/cui_devtools.c +1963 -0
  76. cui_py-0.2.0/thirdparty/cui/src/cui_devviews.c +844 -0
  77. cui_py-0.2.0/thirdparty/cui/src/cui_dials.c +548 -0
  78. cui_py-0.2.0/thirdparty/cui/src/cui_diff.c +1496 -0
  79. cui_py-0.2.0/thirdparty/cui/src/cui_disclosure.c +827 -0
  80. cui_py-0.2.0/thirdparty/cui/src/cui_dock.c +1152 -0
  81. cui_py-0.2.0/thirdparty/cui/src/cui_draw.c +584 -0
  82. cui_py-0.2.0/thirdparty/cui/src/cui_editor.c +1302 -0
  83. cui_py-0.2.0/thirdparty/cui/src/cui_emoji.c +1533 -0
  84. cui_py-0.2.0/thirdparty/cui/src/cui_emoji_data.h +841 -0
  85. cui_py-0.2.0/thirdparty/cui/src/cui_extras.c +847 -0
  86. cui_py-0.2.0/thirdparty/cui/src/cui_files.c +919 -0
  87. cui_py-0.2.0/thirdparty/cui/src/cui_flame.c +2004 -0
  88. cui_py-0.2.0/thirdparty/cui/src/cui_font_data.c +4848 -0
  89. cui_py-0.2.0/thirdparty/cui/src/cui_graph.c +739 -0
  90. cui_py-0.2.0/thirdparty/cui/src/cui_grid.c +705 -0
  91. cui_py-0.2.0/thirdparty/cui/src/cui_hex.c +686 -0
  92. cui_py-0.2.0/thirdparty/cui/src/cui_image.c +72 -0
  93. cui_py-0.2.0/thirdparty/cui/src/cui_inflate.c +198 -0
  94. cui_py-0.2.0/thirdparty/cui/src/cui_instrument.c +789 -0
  95. cui_py-0.2.0/thirdparty/cui/src/cui_internal.h +868 -0
  96. cui_py-0.2.0/thirdparty/cui/src/cui_joining.h +885 -0
  97. cui_py-0.2.0/thirdparty/cui/src/cui_layout.c +1124 -0
  98. cui_py-0.2.0/thirdparty/cui/src/cui_loading.c +453 -0
  99. cui_py-0.2.0/thirdparty/cui/src/cui_markdown.c +1393 -0
  100. cui_py-0.2.0/thirdparty/cui/src/cui_media.c +607 -0
  101. cui_py-0.2.0/thirdparty/cui/src/cui_month.c +562 -0
  102. cui_py-0.2.0/thirdparty/cui/src/cui_motion.c +1139 -0
  103. cui_py-0.2.0/thirdparty/cui/src/cui_nodes.c +1116 -0
  104. cui_py-0.2.0/thirdparty/cui/src/cui_overlay.c +1797 -0
  105. cui_py-0.2.0/thirdparty/cui/src/cui_photo.c +389 -0
  106. cui_py-0.2.0/thirdparty/cui/src/cui_pickers.c +1651 -0
  107. cui_py-0.2.0/thirdparty/cui/src/cui_planning.c +1015 -0
  108. cui_py-0.2.0/thirdparty/cui/src/cui_regex.c +510 -0
  109. cui_py-0.2.0/thirdparty/cui/src/cui_shape.c +467 -0
  110. cui_py-0.2.0/thirdparty/cui/src/cui_shape.h +21 -0
  111. cui_py-0.2.0/thirdparty/cui/src/cui_social.c +333 -0
  112. cui_py-0.2.0/thirdparty/cui/src/cui_strings.c +61 -0
  113. cui_py-0.2.0/thirdparty/cui/src/cui_terminal.c +571 -0
  114. cui_py-0.2.0/thirdparty/cui/src/cui_text.c +1161 -0
  115. cui_py-0.2.0/thirdparty/cui/src/cui_textedit.c +931 -0
  116. cui_py-0.2.0/thirdparty/cui/src/cui_theme.c +357 -0
  117. cui_py-0.2.0/thirdparty/cui/src/cui_timeline.c +1450 -0
  118. cui_py-0.2.0/thirdparty/cui/src/cui_tools.c +1111 -0
  119. cui_py-0.2.0/thirdparty/cui/src/cui_tour.c +189 -0
  120. cui_py-0.2.0/thirdparty/cui/src/cui_treetable.c +1235 -0
  121. cui_py-0.2.0/thirdparty/cui/src/cui_viz.c +2329 -0
  122. cui_py-0.2.0/thirdparty/cui/src/cui_voice.c +417 -0
  123. cui_py-0.2.0/thirdparty/cui/src/cui_widgets.c +1509 -0
  124. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app.c +443 -0
  125. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_android.c +532 -0
  126. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_cocoa.m +546 -0
  127. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_glfw.c +356 -0
  128. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_ios.m +595 -0
  129. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_sdl2.c +400 -0
  130. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_win32.c +771 -0
  131. cui_py-0.2.0/thirdparty/cui/src/platform/cui_app_x11.c +1016 -0
  132. cui_py-0.2.0/thirdparty/cui/src/platform/cui_dialogs.c +309 -0
  133. cui_py-0.2.0/thirdparty/cui/src/platform/cui_platform.h +80 -0
  134. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_d3d12.c +784 -0
  135. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_gl.c +433 -0
  136. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_metal.m +453 -0
  137. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_sw.c +775 -0
  138. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_vulkan.c +1033 -0
  139. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_vulkan.frag +58 -0
  140. cui_py-0.2.0/thirdparty/cui/src/render/cui_render_vulkan.vert +24 -0
  141. cui_py-0.2.0/thirdparty/cui/src/render/generated/cui_render_vulkan_spirv.h +371 -0
  142. cui_py-0.2.0/thirdparty/cui/third_party/LICENSE-Unicode.txt +39 -0
  143. cui_py-0.2.0/thirdparty/cui/third_party/stb_image.h +7988 -0
  144. cui_py-0.2.0/thirdparty/cui/third_party/stb_image_write.h +1724 -0
  145. cui_py-0.2.0/thirdparty/cui/third_party/stb_rect_pack.h +623 -0
  146. cui_py-0.2.0/thirdparty/cui/third_party/stb_truetype.h +5079 -0
  147. cui_py-0.2.0/thirdparty/cui-repl/LICENSE +21 -0
  148. cui_py-0.2.0/thirdparty/cui-repl/VENDORED +4 -0
  149. cui_py-0.2.0/thirdparty/cui-repl/src/boxdraw.c +133 -0
  150. cui_py-0.2.0/thirdparty/cui-repl/src/boxdraw.h +15 -0
  151. cui_py-0.2.0/thirdparty/cui-repl/src/cuix.c +32 -0
  152. cui_py-0.2.0/thirdparty/cui-repl/src/cuix.h +32 -0
  153. cui_py-0.2.0/thirdparty/cui-repl/src/pty.c +174 -0
  154. cui_py-0.2.0/thirdparty/cui-repl/src/pty.h +42 -0
  155. cui_py-0.2.0/thirdparty/cui-repl/src/session.c +300 -0
  156. cui_py-0.2.0/thirdparty/cui-repl/src/session.h +95 -0
  157. cui_py-0.2.0/thirdparty/cui-repl/src/term_view.c +539 -0
  158. cui_py-0.2.0/thirdparty/cui-repl/src/term_view.h +47 -0
  159. cui_py-0.2.0/thirdparty/patches/cui-state-reset.patch +39 -0
  160. cui_py-0.2.0/tools/core_stub_head.pyi.in +120 -0
  161. cui_py-0.2.0/tools/core_stub_tail.pyi.in +93 -0
  162. cui_py-0.2.0/tools/gen_bindings.py +2082 -0
  163. cui_py-0.2.0/tools/install-zig.sh +23 -0
  164. cui_py-0.2.0/uv.lock +1156 -0
@@ -0,0 +1,226 @@
1
+ name: Build and Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ pull_request:
8
+ branches: [main, master]
9
+ workflow_dispatch:
10
+ inputs:
11
+ publish:
12
+ description: "Publish to PyPI"
13
+ required: false
14
+ default: false
15
+ type: boolean
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ concurrency:
21
+ group: build-${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: true
23
+
24
+ env:
25
+ # wheel.py-api builds one cp311-abi3 wheel; later versions reuse and test it.
26
+ CIBW_BUILD: "cp311-* cp312-* cp313-* cp314-*"
27
+ CIBW_SKIP: "*-musllinux_* pp*"
28
+ CIBW_TEST_REQUIRES: pytest
29
+ CIBW_TEST_COMMAND: pytest {project}/tests -v
30
+ # CUI's Linux backend needs the X11 headers; libX11 is on the manylinux allowlist.
31
+ CIBW_BEFORE_ALL_LINUX: >-
32
+ (dnf install -y libX11-devel xz || yum install -y libX11-devel xz)
33
+ && sh {project}/tools/install-zig.sh /opt/zig
34
+ # cui.Pty on Linux and macOS. libghostty-vt's minimum macOS is 13.0.
35
+ CIBW_CONFIG_SETTINGS_LINUX: cmake.define.CUI_PY_PTY=ON
36
+ CIBW_CONFIG_SETTINGS_MACOS: cmake.define.CUI_PY_PTY=ON
37
+ CIBW_ENVIRONMENT_LINUX: PATH=/opt/zig:$PATH
38
+ CIBW_BEFORE_ALL_MACOS: sh {project}/tools/install-zig.sh $HOME/.zig-0.17.1
39
+ CIBW_ENVIRONMENT_MACOS: PATH=$HOME/.zig-0.17.1:$PATH MACOSX_DEPLOYMENT_TARGET=13.0
40
+ CIBW_TEST_COMMAND_LINUX: >-
41
+ python -c "import cui, sys; sys.exit(not cui.PTY_AVAILABLE)" && pytest {project}/tests -v
42
+ CIBW_TEST_COMMAND_MACOS: >-
43
+ python -c "import cui, sys; sys.exit(not cui.PTY_AVAILABLE)" && pytest {project}/tests -v
44
+
45
+ jobs:
46
+ build-sdist:
47
+ name: Build source distribution
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@v7
51
+
52
+ - name: Install uv
53
+ uses: astral-sh/setup-uv@v10.0.1
54
+
55
+ - name: Build sdist
56
+ run: uv build --sdist
57
+
58
+ - name: Upload sdist
59
+ uses: actions/upload-artifact@v7
60
+ with:
61
+ name: sdist
62
+ path: dist/*.tar.gz
63
+ retention-days: 14
64
+
65
+ build-wheels-linux:
66
+ name: Build wheels (Linux ${{ matrix.arch }})
67
+ # Native arm runners: zig building libghostty-vt under QEMU is too slow.
68
+ strategy:
69
+ matrix:
70
+ include:
71
+ - { runner: ubuntu-latest, arch: x86_64 }
72
+ - { runner: ubuntu-24.04-arm, arch: aarch64 }
73
+ runs-on: ${{ matrix.runner }}
74
+ steps:
75
+ - uses: actions/checkout@v7
76
+
77
+ - name: Build wheels
78
+ uses: pypa/cibuildwheel@v4.2
79
+ env:
80
+ CIBW_ARCHS_LINUX: ${{ matrix.arch }}
81
+
82
+ - name: Upload wheels
83
+ uses: actions/upload-artifact@v7
84
+ with:
85
+ name: wheels-linux-${{ matrix.arch }}
86
+ path: wheelhouse/*.whl
87
+ retention-days: 14
88
+
89
+ build-wheels-macos:
90
+ name: Build wheels (macOS)
91
+ runs-on: macos-latest
92
+ steps:
93
+ - uses: actions/checkout@v7
94
+
95
+ - name: Build wheels
96
+ uses: pypa/cibuildwheel@v4.2
97
+ env:
98
+ CIBW_ARCHS_MACOS: x86_64 arm64
99
+
100
+ - name: Upload wheels
101
+ uses: actions/upload-artifact@v7
102
+ with:
103
+ name: wheels-macos
104
+ path: wheelhouse/*.whl
105
+ retention-days: 14
106
+
107
+ build-wheels-windows:
108
+ name: Build wheels (Windows)
109
+ runs-on: windows-latest
110
+ steps:
111
+ - uses: actions/checkout@v7
112
+
113
+ - name: Build wheels
114
+ uses: pypa/cibuildwheel@v4.2
115
+ env:
116
+ CIBW_ARCHS_WINDOWS: AMD64
117
+
118
+ - name: Upload wheels
119
+ uses: actions/upload-artifact@v7
120
+ with:
121
+ name: wheels-windows
122
+ path: wheelhouse/*.whl
123
+ retention-days: 14
124
+
125
+ collect-artifacts:
126
+ name: Collect all build artifacts
127
+ needs: [build-sdist, build-wheels-linux, build-wheels-macos, build-wheels-windows]
128
+ runs-on: ubuntu-latest
129
+ steps:
130
+ - name: Download sdist
131
+ uses: actions/download-artifact@v8
132
+ with:
133
+ name: sdist
134
+ path: dist/
135
+
136
+ - name: Download wheels
137
+ uses: actions/download-artifact@v8
138
+ with:
139
+ pattern: wheels-*
140
+ merge-multiple: true
141
+ path: dist/
142
+
143
+ - name: List all artifacts
144
+ run: |
145
+ echo "=== All build artifacts ==="
146
+ ls -la dist/
147
+ echo ""
148
+ echo "=== Wheel count: $(ls dist/*.whl 2>/dev/null | wc -l) ==="
149
+ echo "=== Sdist count: $(ls dist/*.tar.gz 2>/dev/null | wc -l) ==="
150
+
151
+ - name: Check wheels are abi3
152
+ run: |
153
+ if ls dist/*.whl | grep -v -- '-abi3-'; then
154
+ echo "::error::non-abi3 wheels found"; exit 1
155
+ fi
156
+ pipx run abi3audit --strict --report dist/*.whl
157
+
158
+ - name: Upload combined artifacts
159
+ uses: actions/upload-artifact@v7
160
+ with:
161
+ name: all-dist
162
+ path: dist/
163
+ retention-days: 30
164
+
165
+ publish-testpypi:
166
+ name: Publish to TestPyPI
167
+ needs: collect-artifacts
168
+ runs-on: ubuntu-latest
169
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
170
+ environment:
171
+ name: testpypi
172
+ url: https://test.pypi.org/p/cui-py
173
+ permissions:
174
+ id-token: write
175
+ steps:
176
+ - name: Download all artifacts
177
+ uses: actions/download-artifact@v8
178
+ with:
179
+ name: all-dist
180
+ path: dist/
181
+
182
+ - name: Publish to TestPyPI
183
+ uses: pypa/gh-action-pypi-publish@release/v1
184
+ with:
185
+ repository-url: https://test.pypi.org/legacy/
186
+ skip-existing: true
187
+
188
+ publish-pypi:
189
+ name: Publish to PyPI
190
+ needs: [collect-artifacts, publish-testpypi]
191
+ runs-on: ubuntu-latest
192
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
193
+ environment:
194
+ name: pypi
195
+ url: https://pypi.org/p/cui-py
196
+ permissions:
197
+ id-token: write
198
+ steps:
199
+ - name: Download all artifacts
200
+ uses: actions/download-artifact@v8
201
+ with:
202
+ name: all-dist
203
+ path: dist/
204
+
205
+ - name: Publish to PyPI
206
+ uses: pypa/gh-action-pypi-publish@release/v1
207
+
208
+ publish-manual:
209
+ name: Manual Publish to PyPI
210
+ needs: collect-artifacts
211
+ runs-on: ubuntu-latest
212
+ if: github.event_name == 'workflow_dispatch' && inputs.publish
213
+ environment:
214
+ name: pypi
215
+ url: https://pypi.org/p/cui-py
216
+ permissions:
217
+ id-token: write
218
+ steps:
219
+ - name: Download all artifacts
220
+ uses: actions/download-artifact@v8
221
+ with:
222
+ name: all-dist
223
+ path: dist/
224
+
225
+ - name: Publish to PyPI
226
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,111 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ci-${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ qa:
19
+ name: QA (lint, typecheck, test)
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v10.0.1
26
+ with:
27
+ enable-cache: true
28
+
29
+ - name: Set up Python
30
+ run: uv python install 3.13
31
+
32
+ - name: Install X11 headers (CUI's Linux backend)
33
+ run: sudo apt-get update && sudo apt-get install -y libx11-dev
34
+
35
+ - name: Install dependencies
36
+ run: uv sync --dev
37
+
38
+ - name: Lint with ruff
39
+ run: uv run ruff check src/ tests/ examples/ tools/
40
+
41
+ - name: Check formatting with ruff
42
+ run: uv run ruff format --check src/ tests/ examples/ tools/
43
+
44
+ - name: Type check with mypy
45
+ run: uv run mypy src/cui tests/ examples/
46
+
47
+ - name: Run tests
48
+ run: uv run pytest tests/ -v --cov=src/cui --cov-report=xml
49
+
50
+ build:
51
+ name: Build (${{ matrix.os }}/${{ matrix.python-version }})
52
+ needs: qa
53
+ runs-on: ${{ matrix.os }}
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ os: [ubuntu-latest, macos-latest, windows-latest]
58
+ python-version: ["3.11", "3.13"]
59
+
60
+ steps:
61
+ - uses: actions/checkout@v7
62
+
63
+ - name: Install uv
64
+ uses: astral-sh/setup-uv@v10.0.1
65
+ with:
66
+ enable-cache: true
67
+
68
+ - name: Set up Python ${{ matrix.python-version }}
69
+ run: uv python install ${{ matrix.python-version }}
70
+
71
+ - name: Install X11 headers (CUI's Linux backend)
72
+ if: runner.os == 'Linux'
73
+ run: sudo apt-get update && sudo apt-get install -y libx11-dev
74
+
75
+ - name: Install dependencies
76
+ run: uv sync
77
+
78
+ - name: Build extension
79
+ run: uv build --wheel
80
+
81
+ - name: Run tests
82
+ run: uv run pytest tests/ -v
83
+
84
+ - name: Upload wheel artifact
85
+ uses: actions/upload-artifact@v7
86
+ with:
87
+ name: wheel-${{ matrix.os }}-py${{ matrix.python-version }}
88
+ path: dist/*.whl
89
+ retention-days: 7
90
+
91
+ collect-artifacts:
92
+ name: Collect all artifacts
93
+ needs: build
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - name: Download all artifacts
97
+ uses: actions/download-artifact@v8
98
+ with:
99
+ path: all-wheels
100
+ pattern: wheel-*
101
+ merge-multiple: true
102
+
103
+ - name: List collected wheels
104
+ run: ls -la all-wheels/
105
+
106
+ - name: Upload combined artifacts
107
+ uses: actions/upload-artifact@v7
108
+ with:
109
+ name: all-wheels
110
+ path: all-wheels/
111
+ retention-days: 14
@@ -0,0 +1,232 @@
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
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # Build, CMake, editor, OS
223
+ *.pyd
224
+ .uv/
225
+ CMakeCache.txt
226
+ CMakeFiles/
227
+ cmake_install.cmake
228
+ .idea/
229
+ .vscode/
230
+ *.swp
231
+ *~
232
+ .DS_Store
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0]
10
+
11
+ ### Added
12
+
13
+ - `cui.Pty` and `ui.pty(id, p)`: a child process on a pseudo-terminal, shown by cui-repl's terminal view and emulated by libghostty-vt 1.0.0. The Linux and macOS wheels include it. A source build needs Zig 0.17 and the CMake option `CUI_PY_PTY`; without it, and on Windows, `cui.Pty()` raises and `cui.PTY_AVAILABLE` is false. The view is compiled into `_core` and not a second extension module, because a second module would link its own copy of CUI and run it on contexts that `_core` created. `thirdparty/cui-repl/src/cuix.c` calls CUI's public API for focus queries, the cursor and the clipboard, and reads the private `cui_internal.h` for text, keys, Tab, setting focus and the wheel, so a CUI update can break it.
14
+
15
+ - Window state and placement on `App`: `maximize`, `minimize`, `restore`, `window_state`, `set_position`, `placement` and `follow_system_theme`, and `App(placement=...)` to reopen a window where it was. `placement()` returns a `cui.WindowPlacement`. CUI clamps a placement's size to the minimum size.
16
+
17
+ - `ctx.image_update(tex, x, y, width, height, rgba, stride=0)` replaces a region of an image texture in place, for video and camera frames. It takes only textures from this context's `image_create` or `image_load`. Handles are plain ints, and an R8 font-atlas handle would make the OpenGL renderer read four times the buffer. `rgba` is any C-contiguous buffer, such as `bytes`, a `memoryview` or a NumPy array; `image_create` takes the same.
18
+
19
+ - Component input: `ctx.canvas(..., focusable=True, component_input=True)` makes a canvas a Tab stop that receives keys and text. `ctx.set_input_hook(fn)` sees each `cui.InputEvent` before CUI and can take it, and `ctx.dispatch_input(event, route)` replays it to `route(event)`. `dispatch_input` turns the hook off while it runs: CUI requires this, because a replayed TEXT event otherwise reaches the hook again. Building UI, injecting input or changing the hook inside a hook or route raises `RuntimeError`, as CUI forbids them there. An exception in a hook is raised at the next frame boundary.
20
+
21
+ - Option fields that are pointers or arrays now have keywords. 12 of 84 remain: callbacks, a buffer without a size, and two structs cui-py cannot convert (`docs/dev/coverage.md`). A field C reads and writes takes a `cui.Ref`, such as `ui.treemap(..., selected=sel)` with `sel = cui.Ref(-1)`. A `Ref` owns the storage C points at and lives until the frame ends, because some components write it later: a tree table writes `cursor` in `tree_table_end`. An array takes a sequence, and its count field is set from `len()`. An array whose length comes from a parameter or is fixed raises `ValueError` on any other length, since C reads that many entries. Each field is listed by hand in `tools/gen_bindings.py`: a pointer that looks like one value can be an array, as `data_grid`'s `selected` is.
22
+
23
+ ```python
24
+ sel = cui.Ref(-1)
25
+ ui.treemap("t", items, selected=sel)
26
+ ui.segmented("view", ["List", "Board"], i, icons=[cui.ICON_LIST, cui.ICON_LAYOUT_DASHBOARD])
27
+ ```
28
+
29
+ The count keywords these arrays now set are gone, such as `label_count`, `place_count`, `tick_count` and `meter_channels`.
30
+
31
+ ### Changed
32
+
33
+ - CUI 1.5.0 ([release notes](https://github.com/yappologistic/CUI/releases/tag/v1.5.0)). The generator wraps 421 entries, up from 372, and 48 more are written by hand, up from 35; `docs/dev/coverage.md` lists the 34 not wrapped yet. `ctx.spinner(size, ...)` now takes `cui_spinner_ex`'s options, such as `style` and `color`. Charts, gauges and the series palette draw differently, and the radial gauge has no needle. `cui-state-reset.patch` is regenerated against 1.5.0, which keeps the `cui_state` behaviour it fixes.
34
+
35
+ - `make build` reuses `build/{wheel_tag}` and builds without isolation, so a rebuild recompiles only changed files. It now takes 0.6 s; it took 28 s before. In a new isolated environment, scikit-build-core deletes `CMakeCache.txt` and `CMakeFiles/`, so a persistent build directory alone did not help. `make build-pty` and `make test-asan` use their own directories, because CMake caches options and flags. `cython` and `scikit-build-core` are now in the dev group.
36
+
37
+ - macOS wheels need macOS 13 or later, up from 10.9 (x86_64) and 11 (arm64), because libghostty-vt targets 13.
38
+
39
+ - Wheels target `cp311-abi3`, up from `cp310-abi3`. 3.11 over 3.10 because the buffer protocol joined the stable ABI in 3.11, and `image_update` would otherwise copy each frame through `bytes`. Python 3.10 is no longer supported. Free-threaded builds cannot use the stable ABI and keep version-specific wheels. The build now needs Cython 3.1 or later.
40
+
41
+ ## [0.1.0]
42
+
43
+ First release.
44
+
45
+ ### Added
46
+
47
+ - Bindings for CUI 1.4.0, vendored in `thirdparty/cui` and linked statically. `tools/gen_bindings.py` generates them from CUI's headers with libclang: 355 Context methods, 48 of them scopes, and 17 functions; 35 more are written by hand. The output is committed, so a build needs only Cython and a C compiler. A generator, rather than hand-written wrappers, because CUI declares 496 functions and changes between minor releases. `docs/dev/coverage.md` lists the 27 functions not wrapped yet.
48
+
49
+ - `cui.App`, a native window with an event loop. It releases the GIL while it waits for events.
50
+
51
+ - `cui.Context()` without a window: software rendering, `render()`, `save_png()`, input injection and a clipboard, for tests.
52
+
53
+ - `ctx.canvas(id, w, h, paint)` with `draw_*` methods that work only inside `paint`. An exception raised in `paint` is re-raised when the frame ends.
54
+
55
+ - `cui.LogBuffer` and `cui.TerminalBuffer` for `ui.log_view` and `ui.terminal`. Any thread may write to them. CUI paints line text straight from the buffer after the build returns, and `App.frame()` releases the GIL meanwhile, so a write from another thread could change text mid-paint. A view therefore pins its buffer until the frame ends and queues writes made until then, capped at the buffer's capacity. Queueing over a lock, because a lock held across `App.frame()` would also be held while it waits for input and block the writer.
56
+
57
+ - `examples/hello.py`, `examples/todo.py`, `examples/dashboard.py` and `examples/showcase.py`.
58
+
59
+ - `make test-asan`: the tests and a call to every generated method under AddressSanitizer (macOS).
60
+
61
+ ### Fixed
62
+
63
+ - Vendored CUI patch: a component that reused another component type's id read that type's state struct as its own, and `cui_destroy` later freed pointers from it (abort on macOS). `cui_state` now discards an entry asked for at a different size. Reset over a debug assertion, because the collision follows from repeated labels in release builds too. See `docs/dev/known-issues.md`.