python-cui 1.4.0.6__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 (159) hide show
  1. python_cui-1.4.0.6/.github/workflows/ci.yml +60 -0
  2. python_cui-1.4.0.6/.github/workflows/publish-to-pypi.yml +152 -0
  3. python_cui-1.4.0.6/.gitignore +27 -0
  4. python_cui-1.4.0.6/.gitmodules +3 -0
  5. python_cui-1.4.0.6/CMakeLists.txt +98 -0
  6. python_cui-1.4.0.6/CUI/.editorconfig +22 -0
  7. python_cui-1.4.0.6/CUI/.gitignore +38 -0
  8. python_cui-1.4.0.6/CUI/CHANGELOG.md +245 -0
  9. python_cui-1.4.0.6/CUI/CLAUDE.md +38 -0
  10. python_cui-1.4.0.6/CUI/CMakeLists.txt +265 -0
  11. python_cui-1.4.0.6/CUI/LICENSE +21 -0
  12. python_cui-1.4.0.6/CUI/README.md +375 -0
  13. python_cui-1.4.0.6/CUI/THIRD_PARTY.md +13 -0
  14. python_cui-1.4.0.6/CUI/cmake/CuiApp.cmake +24 -0
  15. python_cui-1.4.0.6/CUI/cmake/mingw-w64.cmake +11 -0
  16. python_cui-1.4.0.6/CUI/examples/CMakeLists.txt +21 -0
  17. python_cui-1.4.0.6/CUI/include/cui/cui.h +4519 -0
  18. python_cui-1.4.0.6/CUI/include/cui/cui_app.h +117 -0
  19. python_cui-1.4.0.6/CUI/include/cui/cui_icons.h +177 -0
  20. python_cui-1.4.0.6/CUI/include/cui/cui_render.h +78 -0
  21. python_cui-1.4.0.6/CUI/src/cui_actions.c +1244 -0
  22. python_cui-1.4.0.6/CUI/src/cui_ai.c +1070 -0
  23. python_cui-1.4.0.6/CUI/src/cui_bidi.c +200 -0
  24. python_cui-1.4.0.6/CUI/src/cui_bidi.h +25 -0
  25. python_cui-1.4.0.6/CUI/src/cui_bidi_data.h +722 -0
  26. python_cui-1.4.0.6/CUI/src/cui_charts.c +660 -0
  27. python_cui-1.4.0.6/CUI/src/cui_chrome.c +1071 -0
  28. python_cui-1.4.0.6/CUI/src/cui_code.c +557 -0
  29. python_cui-1.4.0.6/CUI/src/cui_controls.c +1005 -0
  30. python_cui-1.4.0.6/CUI/src/cui_core.c +859 -0
  31. python_cui-1.4.0.6/CUI/src/cui_curves.c +1206 -0
  32. python_cui-1.4.0.6/CUI/src/cui_data.c +491 -0
  33. python_cui-1.4.0.6/CUI/src/cui_devpanels.c +1026 -0
  34. python_cui-1.4.0.6/CUI/src/cui_devtools.c +1954 -0
  35. python_cui-1.4.0.6/CUI/src/cui_devviews.c +839 -0
  36. python_cui-1.4.0.6/CUI/src/cui_dials.c +548 -0
  37. python_cui-1.4.0.6/CUI/src/cui_diff.c +1496 -0
  38. python_cui-1.4.0.6/CUI/src/cui_disclosure.c +676 -0
  39. python_cui-1.4.0.6/CUI/src/cui_dock.c +1152 -0
  40. python_cui-1.4.0.6/CUI/src/cui_draw.c +479 -0
  41. python_cui-1.4.0.6/CUI/src/cui_editor.c +1302 -0
  42. python_cui-1.4.0.6/CUI/src/cui_emoji.c +1533 -0
  43. python_cui-1.4.0.6/CUI/src/cui_emoji_data.h +841 -0
  44. python_cui-1.4.0.6/CUI/src/cui_extras.c +830 -0
  45. python_cui-1.4.0.6/CUI/src/cui_files.c +775 -0
  46. python_cui-1.4.0.6/CUI/src/cui_flame.c +1761 -0
  47. python_cui-1.4.0.6/CUI/src/cui_font_data.c +4848 -0
  48. python_cui-1.4.0.6/CUI/src/cui_graph.c +740 -0
  49. python_cui-1.4.0.6/CUI/src/cui_grid.c +666 -0
  50. python_cui-1.4.0.6/CUI/src/cui_hex.c +686 -0
  51. python_cui-1.4.0.6/CUI/src/cui_image.c +61 -0
  52. python_cui-1.4.0.6/CUI/src/cui_inflate.c +198 -0
  53. python_cui-1.4.0.6/CUI/src/cui_instrument.c +759 -0
  54. python_cui-1.4.0.6/CUI/src/cui_internal.h +742 -0
  55. python_cui-1.4.0.6/CUI/src/cui_joining.h +885 -0
  56. python_cui-1.4.0.6/CUI/src/cui_layout.c +1098 -0
  57. python_cui-1.4.0.6/CUI/src/cui_markdown.c +1393 -0
  58. python_cui-1.4.0.6/CUI/src/cui_media.c +607 -0
  59. python_cui-1.4.0.6/CUI/src/cui_month.c +562 -0
  60. python_cui-1.4.0.6/CUI/src/cui_motion.c +1118 -0
  61. python_cui-1.4.0.6/CUI/src/cui_nodes.c +1104 -0
  62. python_cui-1.4.0.6/CUI/src/cui_overlay.c +1501 -0
  63. python_cui-1.4.0.6/CUI/src/cui_photo.c +388 -0
  64. python_cui-1.4.0.6/CUI/src/cui_pickers.c +1632 -0
  65. python_cui-1.4.0.6/CUI/src/cui_planning.c +920 -0
  66. python_cui-1.4.0.6/CUI/src/cui_regex.c +509 -0
  67. python_cui-1.4.0.6/CUI/src/cui_shape.c +467 -0
  68. python_cui-1.4.0.6/CUI/src/cui_shape.h +21 -0
  69. python_cui-1.4.0.6/CUI/src/cui_social.c +330 -0
  70. python_cui-1.4.0.6/CUI/src/cui_strings.c +54 -0
  71. python_cui-1.4.0.6/CUI/src/cui_terminal.c +571 -0
  72. python_cui-1.4.0.6/CUI/src/cui_text.c +1153 -0
  73. python_cui-1.4.0.6/CUI/src/cui_textedit.c +890 -0
  74. python_cui-1.4.0.6/CUI/src/cui_theme.c +354 -0
  75. python_cui-1.4.0.6/CUI/src/cui_timeline.c +1448 -0
  76. python_cui-1.4.0.6/CUI/src/cui_tools.c +1111 -0
  77. python_cui-1.4.0.6/CUI/src/cui_tour.c +189 -0
  78. python_cui-1.4.0.6/CUI/src/cui_treetable.c +777 -0
  79. python_cui-1.4.0.6/CUI/src/cui_viz.c +2093 -0
  80. python_cui-1.4.0.6/CUI/src/cui_widgets.c +1301 -0
  81. python_cui-1.4.0.6/CUI/src/platform/cui_app.c +323 -0
  82. python_cui-1.4.0.6/CUI/src/platform/cui_app_cocoa.m +435 -0
  83. python_cui-1.4.0.6/CUI/src/platform/cui_app_glfw.c +221 -0
  84. python_cui-1.4.0.6/CUI/src/platform/cui_app_sdl2.c +258 -0
  85. python_cui-1.4.0.6/CUI/src/platform/cui_app_win32.c +553 -0
  86. python_cui-1.4.0.6/CUI/src/platform/cui_app_x11.c +731 -0
  87. python_cui-1.4.0.6/CUI/src/platform/cui_dialogs.c +246 -0
  88. python_cui-1.4.0.6/CUI/src/platform/cui_platform.h +67 -0
  89. python_cui-1.4.0.6/CUI/src/render/cui_render_gl.c +423 -0
  90. python_cui-1.4.0.6/CUI/src/render/cui_render_sw.c +745 -0
  91. python_cui-1.4.0.6/CUI/tests/CMakeLists.txt +113 -0
  92. python_cui-1.4.0.6/CUI/third_party/LICENSE-Unicode.txt +39 -0
  93. python_cui-1.4.0.6/CUI/third_party/stb_image.h +7988 -0
  94. python_cui-1.4.0.6/CUI/third_party/stb_image_write.h +1724 -0
  95. python_cui-1.4.0.6/CUI/third_party/stb_rect_pack.h +623 -0
  96. python_cui-1.4.0.6/CUI/third_party/stb_truetype.h +5079 -0
  97. python_cui-1.4.0.6/PKG-INFO +221 -0
  98. python_cui-1.4.0.6/README.md +205 -0
  99. python_cui-1.4.0.6/docs/images/components-dark.png +0 -0
  100. python_cui-1.4.0.6/docs/images/components-light.png +0 -0
  101. python_cui-1.4.0.6/docs/images/examples/assistant.png +0 -0
  102. python_cui-1.4.0.6/docs/images/examples/caffeine.png +0 -0
  103. python_cui-1.4.0.6/docs/images/examples/dashboard.png +0 -0
  104. python_cui-1.4.0.6/docs/images/examples/finance.png +0 -0
  105. python_cui-1.4.0.6/docs/images/examples/hello.png +0 -0
  106. python_cui-1.4.0.6/docs/images/examples/mail.png +0 -0
  107. python_cui-1.4.0.6/docs/images/examples/music.png +0 -0
  108. python_cui-1.4.0.6/docs/images/examples/notes.png +0 -0
  109. python_cui-1.4.0.6/docs/images/examples/settings.png +0 -0
  110. python_cui-1.4.0.6/docs/images/examples/todo.png +0 -0
  111. python_cui-1.4.0.6/docs/images/examples/tracker.png +0 -0
  112. python_cui-1.4.0.6/examples/_common.py +109 -0
  113. python_cui-1.4.0.6/examples/assistant.py +377 -0
  114. python_cui-1.4.0.6/examples/caffeine.py +149 -0
  115. python_cui-1.4.0.6/examples/components.py +78 -0
  116. python_cui-1.4.0.6/examples/dashboard.py +267 -0
  117. python_cui-1.4.0.6/examples/finance.py +325 -0
  118. python_cui-1.4.0.6/examples/hello.py +35 -0
  119. python_cui-1.4.0.6/examples/mail.py +381 -0
  120. python_cui-1.4.0.6/examples/music.py +661 -0
  121. python_cui-1.4.0.6/examples/notes.py +309 -0
  122. python_cui-1.4.0.6/examples/settings.py +252 -0
  123. python_cui-1.4.0.6/examples/todo.py +163 -0
  124. python_cui-1.4.0.6/examples/tracker.py +428 -0
  125. python_cui-1.4.0.6/pyproject.toml +67 -0
  126. python_cui-1.4.0.6/src/cui/__init__.py +87 -0
  127. python_cui-1.4.0.6/src/cui/__init__.pyi +757 -0
  128. python_cui-1.4.0.6/src/cui/_api.pyi +425 -0
  129. python_cui-1.4.0.6/src/cui/_api.pyx +5538 -0
  130. python_cui-1.4.0.6/src/cui/_cui.pxd +52 -0
  131. python_cui-1.4.0.6/src/cui/_cui.pyi +160 -0
  132. python_cui-1.4.0.6/src/cui/_cui.pyx +1559 -0
  133. python_cui-1.4.0.6/src/cui/_gen/COVERAGE.md +151 -0
  134. python_cui-1.4.0.6/src/cui/_gen/__init__.py +1 -0
  135. python_cui-1.4.0.6/src/cui/_gen/constants.py +813 -0
  136. python_cui-1.4.0.6/src/cui/_gen/model.py +202 -0
  137. python_cui-1.4.0.6/src/cui/_gen/sizes.h +196 -0
  138. python_cui-1.4.0.6/src/cui/_stdbool.pxd +12 -0
  139. python_cui-1.4.0.6/src/cui/_trampoline.c +131 -0
  140. python_cui-1.4.0.6/src/cui/_trampoline.h +48 -0
  141. python_cui-1.4.0.6/src/cui/_types.py +287 -0
  142. python_cui-1.4.0.6/src/cui/cui_decl.pxd +2855 -0
  143. python_cui-1.4.0.6/src/cui/py.typed +0 -0
  144. python_cui-1.4.0.6/src/cui/ui.py +606 -0
  145. python_cui-1.4.0.6/tests/conftest.py +49 -0
  146. python_cui-1.4.0.6/tests/test_app.py +91 -0
  147. python_cui-1.4.0.6/tests/test_charts.py +105 -0
  148. python_cui-1.4.0.6/tests/test_context.py +88 -0
  149. python_cui-1.4.0.6/tests/test_examples.py +38 -0
  150. python_cui-1.4.0.6/tests/test_facade.py +158 -0
  151. python_cui-1.4.0.6/tests/test_generated.py +34 -0
  152. python_cui-1.4.0.6/tests/test_marshalling.py +131 -0
  153. python_cui-1.4.0.6/tests/test_render.py +108 -0
  154. python_cui-1.4.0.6/tools/clang-include/README.md +26 -0
  155. python_cui-1.4.0.6/tools/clang-include/stdarg.h +10 -0
  156. python_cui-1.4.0.6/tools/clang-include/stdbool.h +12 -0
  157. python_cui-1.4.0.6/tools/clang-include/stddef.h +13 -0
  158. python_cui-1.4.0.6/tools/clang-include/stdint.h +20 -0
  159. python_cui-1.4.0.6/tools/gen_cui.py +1723 -0
@@ -0,0 +1,60 @@
1
+ # PYCUI CI: the generated API must be in sync with CUI's headers, the extension
2
+ # must build, and the offscreen test suite must pass.
3
+ #
4
+ # libclang is pinned: its parse drives the checked-in generated API, so a new
5
+ # version is a deliberate regeneration, not a silent CI upgrade.
6
+ name: ci
7
+
8
+ on:
9
+ push:
10
+ pull_request:
11
+
12
+ jobs:
13
+ windows:
14
+ runs-on: windows-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ with:
18
+ submodules: recursive
19
+
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+
24
+ - name: Install build requirements
25
+ run: python -m pip install cython scikit-build-core cmake pytest libclang==18.1.1
26
+
27
+ - name: Generated API is up to date
28
+ run: python tools/gen_cui.py --check
29
+
30
+ - name: Build and install
31
+ run: python -m pip install --no-build-isolation .
32
+
33
+ - name: Test
34
+ run: python -m pytest tests -q
35
+
36
+ linux:
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ with:
41
+ submodules: recursive
42
+
43
+ - uses: actions/setup-python@v5
44
+ with:
45
+ python-version: "3.12"
46
+
47
+ - name: Install build requirements
48
+ run: |
49
+ sudo apt-get update
50
+ sudo apt-get install -y build-essential libx11-dev
51
+ python -m pip install cython scikit-build-core cmake ninja pytest libclang==18.1.1
52
+
53
+ - name: Generated API is up to date
54
+ run: python tools/gen_cui.py --check
55
+
56
+ - name: Build and install
57
+ run: python -m pip install --no-build-isolation .
58
+
59
+ - name: Test
60
+ run: python -m pytest tests -q
@@ -0,0 +1,152 @@
1
+ # PYCUI publish: a version tag is the release. The sdist is built and checked
2
+ # first, then wheels for Windows and Linux on x86_64 are built and tested, and
3
+ # the whole set is uploaded to PyPI in one step.
4
+ #
5
+ # git tag v1.4.0.0 && git push origin v1.4.0.0
6
+ #
7
+ # The version in pyproject.toml is <cui version>.<bindings revision>, so a tag
8
+ # must match it, and its first three numbers must match the vendored CUI.
9
+ name: publish-to-pypi
10
+
11
+ on:
12
+ push:
13
+ tags: ['v*']
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ sdist:
20
+ name: sdist
21
+ runs-on: ubuntu-24.04
22
+ timeout-minutes: 30
23
+ steps:
24
+ - uses: actions/checkout@v7
25
+ with:
26
+ submodules: recursive
27
+ persist-credentials: false
28
+
29
+ - uses: actions/setup-python@v7
30
+ with:
31
+ python-version: "3.13"
32
+
33
+ - name: Install the source tools
34
+ run: python -m pip install build twine libclang==18.1.1
35
+
36
+ - name: The tag, the version and the vendored CUI agree
37
+ run: |
38
+ version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
39
+ tag=${GITHUB_REF_NAME#v}
40
+ cui=$(sed -n 's/^#define CUI_VERSION_STRING "\(.*\)"/\1/p' CUI/include/cui/cui.h)
41
+ echo "tag ${tag}, package ${version}, vendored CUI ${cui}"
42
+ if [ "${tag}" != "${version}" ]; then
43
+ echo "::error::tag ${GITHUB_REF_NAME} does not match the version ${version} in pyproject.toml"
44
+ exit 1
45
+ fi
46
+ if [ "${version%.*}" != "${cui}" ]; then
47
+ echo "::error::version ${version} does not start with the vendored CUI version ${cui}"
48
+ exit 1
49
+ fi
50
+
51
+ - name: The generated API matches CUI's headers
52
+ run: python tools/gen_cui.py --check
53
+
54
+ - name: Build the sdist
55
+ run: python -m build --sdist --outdir dist
56
+
57
+ - name: Check the sdist metadata
58
+ run: python -m twine check dist/*
59
+
60
+ - name: The sdist builds a wheel
61
+ run: |
62
+ sudo apt-get update -qq
63
+ sudo apt-get install -y -qq libx11-dev
64
+ python -m pip wheel --no-deps --wheel-dir build/from-sdist dist/*.tar.gz
65
+ ls -l build/from-sdist
66
+
67
+ - uses: actions/upload-artifact@v7
68
+ with:
69
+ name: dist-sdist
70
+ path: dist/*.tar.gz
71
+ if-no-files-found: error
72
+
73
+ wheels:
74
+ name: wheels (${{ matrix.name }})
75
+ needs: sdist
76
+ runs-on: ${{ matrix.runner }}
77
+ timeout-minutes: 60
78
+ strategy:
79
+ fail-fast: false
80
+ matrix:
81
+ include:
82
+ # Only x86_64, one runner per OS: cibuildwheel builds the runner's
83
+ # own architecture, so nothing is cross-compiled and each wheel is
84
+ # tested where it was built.
85
+ - { name: linux-x86_64, runner: ubuntu-24.04 }
86
+ - { name: windows-amd64, runner: windows-2022 }
87
+ steps:
88
+ - uses: actions/checkout@v7
89
+ with:
90
+ submodules: recursive
91
+ persist-credentials: false
92
+
93
+ # The action sets up the Python that runs cibuildwheel. The version is
94
+ # pinned because a cibuildwheel minor release can add or drop builds.
95
+ - uses: pypa/cibuildwheel@v4.3.5
96
+ env:
97
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
98
+ CIBW_SKIP: "*-musllinux_* *-win32 *_i686 pp*"
99
+ CIBW_ARCHS: auto
100
+ # The generated API check needs libclang and the CUI headers, so it
101
+ # runs with the sdist; a wheel only has to import, render and run.
102
+ CIBW_TEST_REQUIRES: pytest
103
+ CIBW_TEST_COMMAND: >-
104
+ python -m pytest {project}/tests -q
105
+ --ignore={project}/tests/test_generated.py
106
+
107
+ - uses: actions/upload-artifact@v7
108
+ with:
109
+ name: dist-wheels-${{ matrix.name }}
110
+ path: wheelhouse/*.whl
111
+ if-no-files-found: error
112
+
113
+ publish:
114
+ name: publish
115
+ needs: [sdist, wheels]
116
+ runs-on: ubuntu-24.04
117
+ timeout-minutes: 15
118
+ # Replace the token with Trusted Publishing (id-token: write) if the
119
+ # project gets a PyPI trusted publisher; attestations also need it.
120
+ environment: pypi
121
+ permissions:
122
+ contents: read
123
+ steps:
124
+ - uses: actions/download-artifact@v8
125
+ with:
126
+ pattern: dist-*
127
+ path: dist
128
+ merge-multiple: true
129
+
130
+ - name: The upload set is the tag's version
131
+ run: |
132
+ version=${GITHUB_REF_NAME#v}
133
+ test "$(ls dist/*.tar.gz | wc -l)" -eq 1
134
+ test "$(ls dist/*.whl | wc -l)" -gt 0
135
+ for file in dist/*; do
136
+ case "$(basename "${file}")" in
137
+ *"-${version}-"*|*"-${version}.tar.gz") ;;
138
+ *) echo "::error::$(basename "${file}") does not carry version ${version}"; exit 1 ;;
139
+ esac
140
+ done
141
+ ls -l dist
142
+
143
+ - uses: pypa/gh-action-pypi-publish@release/v1
144
+ with:
145
+ # A PyPI API token for this project, kept in the repository's
146
+ # secrets or in the pypi environment's secrets.
147
+ password: ${{ secrets.PYPI_API_TOKEN }}
148
+ packages-dir: dist
149
+ # A retry after a partial upload should finish the job instead of
150
+ # failing on the files that already landed.
151
+ skip-existing: true
152
+ attestations: false
@@ -0,0 +1,27 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyd
5
+ *.so
6
+ *.dylib
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .venv/
11
+ build-venv/
12
+ .pytest_cache/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+
16
+ # Local dev scratch
17
+ dev/out/
18
+ build/log.txt
19
+ build/app_out.txt
20
+ build/app_err.txt
21
+
22
+ # Editors / OS
23
+ .vs/
24
+ .vscode/
25
+ .idea/
26
+ Thumbs.db
27
+ .DS_Store
@@ -0,0 +1,3 @@
1
+ [submodule "CUI"]
2
+ path = CUI
3
+ url = https://github.com/yappologistic/CUI
@@ -0,0 +1,98 @@
1
+ # PYCUI: builds the `cui` Python package and its Cython extensions.
2
+ #
3
+ # CUI is vendored as the `CUI/` submodule and linked statically into the
4
+ # extensions, so the wheel ships no libcui.dll and a CUI upgrade is a submodule
5
+ # bump plus a rebuild.
6
+ cmake_minimum_required(VERSION 3.24)
7
+
8
+ project(cui_python LANGUAGES C)
9
+
10
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
11
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
12
+ endif()
13
+
14
+ # CUI is a static archive linked into the shared Python extension modules, so
15
+ # its objects must be position independent on ELF platforms (-fPIC). Without
16
+ # this the Linux link fails on relocations against libc symbols.
17
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
18
+
19
+ # ---- CUI, statically linked -------------------------------------------------
20
+
21
+ set(CUI_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
22
+ set(CUI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
23
+ set(CUI_BUILD_SHARED OFF CACHE BOOL "" FORCE)
24
+ set(CUI_WITH_APP ON CACHE BOOL "" FORCE)
25
+ set(CUI_DEFAULT_FONTS ON CACHE BOOL "" FORCE)
26
+ set(CUI_STB_IMAGE ON CACHE BOOL "" FORCE)
27
+ set(CUI_TEXT_SHAPING OFF CACHE BOOL "" FORCE)
28
+ add_subdirectory(CUI EXCLUDE_FROM_ALL)
29
+
30
+ # The binding reports the CUI version it was compiled against; tools/gen_cui.py
31
+ # reads the same header for the generated API.
32
+ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/CUI/include/cui/cui.h" _cui_version_line
33
+ REGEX "^#define CUI_VERSION_STRING")
34
+ string(REGEX MATCH "\"([0-9.]+)\"" _cui_version "${_cui_version_line}")
35
+ set(CUI_VERSION "${CMAKE_MATCH_1}")
36
+ message(STATUS "PYCUI: vendored CUI ${CUI_VERSION}")
37
+
38
+ # ---- Python -----------------------------------------------------------------
39
+
40
+ find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
41
+
42
+ # Cython is a build requirement, but it lives in the interpreter's Scripts
43
+ # directory on Windows, which is often not on PATH; look there first.
44
+ get_filename_component(_py_prefix "${Python_EXECUTABLE}" DIRECTORY)
45
+ find_program(CYTHON_EXECUTABLE
46
+ NAMES cython cython3
47
+ HINTS "${_py_prefix}" "${_py_prefix}/Scripts" "${_py_prefix}/bin"
48
+ DOC "Cython compiler for the cui extensions")
49
+ if(NOT CYTHON_EXECUTABLE)
50
+ message(FATAL_ERROR "Cython not found; `pip install cython` into ${Python_EXECUTABLE}'s environment")
51
+ endif()
52
+ message(STATUS "PYCUI: Cython ${CYTHON_EXECUTABLE}")
53
+
54
+ # ---- Cython extensions ------------------------------------------------------
55
+
56
+ set(_src "${CMAKE_CURRENT_SOURCE_DIR}/src/cui")
57
+ file(GLOB _cython_headers CONFIGURE_DEPENDS "${_src}/*.pxd")
58
+
59
+ # pycui_extension(<name> [EXTRA_C_SOURCES ...])
60
+ #
61
+ # Cythonizes <src>/<name>.pyx into a Python module `cui.<name>` and links CUI
62
+ # into it. The generated wrappers ship as a separate translation unit from the
63
+ # hand-written core so each stays quick to compile and readable.
64
+ function(pycui_extension name)
65
+ set(_pyx "${_src}/${name}.pyx")
66
+ set(_c "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
67
+ add_custom_command(
68
+ OUTPUT "${_c}"
69
+ COMMAND "${CYTHON_EXECUTABLE}" -3 --fast-fail --module-name "cui.${name}"
70
+ -I "${_src}" "${_pyx}" -o "${_c}"
71
+ DEPENDS "${_pyx}" ${_cython_headers}
72
+ COMMENT "Cythonizing cui.${name}"
73
+ VERBATIM)
74
+ Python_add_library(${name} MODULE WITH_SOABI "${_c}" ${ARGN})
75
+ target_include_directories(${name} PRIVATE "${_src}")
76
+ target_link_libraries(${name} PRIVATE cui::cui)
77
+ target_compile_definitions(${name} PRIVATE CUI_VERSION_STRING="${CUI_VERSION}")
78
+ if(MSVC)
79
+ target_compile_options(${name} PRIVATE /W3 /utf-8)
80
+ target_compile_definitions(${name} PRIVATE _CRT_SECURE_NO_WARNINGS)
81
+ else()
82
+ target_compile_options(${name} PRIVATE -Wall -Wno-unused-function -Wno-unused-variable)
83
+ endif()
84
+ if(APPLE)
85
+ set_target_properties(${name} PROPERTIES INSTALL_RPATH "@loader_path")
86
+ elseif(UNIX)
87
+ set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN")
88
+ endif()
89
+ install(TARGETS ${name} DESTINATION cui)
90
+ endfunction()
91
+
92
+ pycui_extension(_cui "${_src}/_trampoline.c")
93
+ pycui_extension(_api)
94
+
95
+ # The pure-Python package files.
96
+ install(DIRECTORY "${_src}/"
97
+ DESTINATION cui
98
+ FILES_MATCHING PATTERN "*.py" PATTERN "*.pyi" PATTERN "py.typed")
@@ -0,0 +1,22 @@
1
+ # Editor settings that match the code (see docs/CONTRIBUTING.md, Code style)
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.{c,h,m,cpp}]
11
+ indent_style = space
12
+ indent_size = 4
13
+
14
+ [*.{md,yml,yaml,json,py,js,mjs,css,html,cmake,txt}]
15
+ indent_style = space
16
+ indent_size = 4
17
+
18
+ [*.{yml,yaml}]
19
+ indent_size = 2
20
+
21
+ [Makefile]
22
+ indent_style = tab
@@ -0,0 +1,38 @@
1
+ build*/
2
+ out/
3
+ *.o
4
+ *.obj
5
+ *.exe
6
+ *.pdb
7
+ *.ilk
8
+ *.a
9
+ *.lib
10
+ *.so
11
+ *.dylib
12
+ *.dll
13
+ .DS_Store
14
+ .vscode/
15
+ .idea/
16
+ compile_commands.json
17
+ /tests/output/
18
+
19
+ # documentation site: generated by web/tools/build.sh
20
+ /web/build/
21
+ /web/site/wasm/
22
+ /web/site/catalog.js
23
+ /web/site/fonts
24
+ /web/site/images
25
+ /web/site/src/
26
+ /web/site/c/
27
+ /web/site/guide/
28
+ /web/site/components/
29
+ /web/site/changelog/
30
+ /web/site/showcase/
31
+ /web/site/apps/
32
+ /web/site/reference/
33
+ /web/site/sitemap.xml
34
+ /web/site/robots.txt
35
+
36
+ # local tool state (the repository's own CLAUDE.md is tracked; personal ones are not)
37
+ /.claude/
38
+ CLAUDE.local.md