urwid 5.0.0__tar.gz → 5.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 (140) hide show
  1. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/documentation.yml +1 -1
  2. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/isolated_mypy.yml +1 -1
  3. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/isolated_pylint.yml +1 -1
  4. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/isolated_pyrefly.yml +1 -1
  5. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/pythonpackage.yml +17 -16
  6. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/yamllint.yml +1 -1
  7. urwid-5.1.0/MANIFEST.in +7 -0
  8. {urwid-5.0.0/urwid.egg-info → urwid-5.1.0}/PKG-INFO +4 -4
  9. {urwid-5.0.0 → urwid-5.1.0}/README.rst +3 -3
  10. urwid-5.1.0/SECURITY.md +49 -0
  11. {urwid-5.0.0 → urwid-5.1.0}/mypy-requirements.txt +1 -1
  12. {urwid-5.0.0 → urwid-5.1.0}/pyproject.toml +25 -0
  13. {urwid-5.0.0 → urwid-5.1.0}/pytest_requirements.txt +2 -2
  14. {urwid-5.0.0 → urwid-5.1.0}/urwid/__init__.py +43 -1
  15. {urwid-5.0.0 → urwid-5.1.0}/urwid/canvas.py +70 -32
  16. {urwid-5.0.0 → urwid-5.1.0}/urwid/command_map.py +74 -4
  17. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/__init__.py +6 -0
  18. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_posix_raw_display.py +56 -23
  19. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_raw_display_base.py +162 -19
  20. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_web.js +4 -117
  21. urwid-5.1.0/urwid/display/_web_common.js +149 -0
  22. urwid-5.1.0/urwid/display/_web_common.py +185 -0
  23. urwid-5.1.0/urwid/display/_websocket.css +3 -0
  24. urwid-5.1.0/urwid/display/_websocket.html +19 -0
  25. urwid-5.1.0/urwid/display/_websocket.js +82 -0
  26. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_win32.py +11 -1
  27. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_win32_raw_display.py +78 -23
  28. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/common.py +80 -5
  29. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/curses.py +93 -46
  30. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/escape.py +64 -15
  31. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/lcd.py +236 -20
  32. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/web.py +69 -150
  33. urwid-5.1.0/urwid/display/websocket.py +330 -0
  34. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/__init__.py +5 -1
  35. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/asyncio_loop.py +12 -2
  36. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/glib_loop.py +2 -1
  37. urwid-5.1.0/urwid/event_loop/guarded_loop.py +170 -0
  38. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/main_loop.py +456 -99
  39. {urwid-5.0.0 → urwid-5.1.0}/urwid/font.py +87 -2
  40. {urwid-5.0.0 → urwid-5.1.0}/urwid/numedit.py +78 -31
  41. {urwid-5.0.0 → urwid-5.1.0}/urwid/str_util.py +38 -0
  42. {urwid-5.0.0 → urwid-5.1.0}/urwid/testing.py +4 -2
  43. {urwid-5.0.0 → urwid-5.1.0}/urwid/version.py +3 -3
  44. {urwid-5.0.0 → urwid-5.1.0}/urwid/vterm.py +77 -26
  45. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/__init__.py +24 -0
  46. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/attr_map.py +36 -23
  47. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/attr_wrap.py +4 -3
  48. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/bar_graph.py +36 -49
  49. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/box_adapter.py +4 -0
  50. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/columns.py +172 -57
  51. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/constants.py +60 -1
  52. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/container.py +50 -1
  53. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/divider.py +8 -1
  54. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/drop_down.py +26 -10
  55. urwid-5.1.0/urwid/widget/edit.py +1848 -0
  56. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/filler.py +8 -1
  57. urwid-5.1.0/urwid/widget/filtered_walker.py +276 -0
  58. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/frame.py +150 -47
  59. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/grid_flow.py +48 -3
  60. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/line_box.py +22 -7
  61. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/listbox.py +199 -73
  62. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/monitored_deque.py +23 -4
  63. urwid-5.1.0/urwid/widget/notifications.py +424 -0
  64. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/overlay.py +187 -92
  65. urwid-5.1.0/urwid/widget/overlay_stack.py +317 -0
  66. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/padding.py +58 -9
  67. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/pile.py +188 -63
  68. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/popup.py +42 -5
  69. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/scrollable.py +71 -37
  70. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/solid_fill.py +4 -1
  71. urwid-5.1.0/urwid/widget/spinner.py +345 -0
  72. urwid-5.1.0/urwid/widget/table.py +1107 -0
  73. urwid-5.1.0/urwid/widget/tabs.py +935 -0
  74. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/treetools.py +303 -28
  75. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/widget.py +79 -3
  76. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/wimp.py +33 -5
  77. {urwid-5.0.0 → urwid-5.1.0/urwid.egg-info}/PKG-INFO +4 -4
  78. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/SOURCES.txt +13 -0
  79. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/scm_file_list.json +46 -7
  80. urwid-5.1.0/urwid.egg-info/scm_version.json +8 -0
  81. urwid-5.0.0/MANIFEST.in +0 -6
  82. urwid-5.0.0/SECURITY.md +0 -3
  83. urwid-5.0.0/urwid/widget/edit.py +0 -1006
  84. urwid-5.0.0/urwid.egg-info/scm_version.json +0 -8
  85. {urwid-5.0.0 → urwid-5.1.0}/.devcontainer/dev.dockerfile +0 -0
  86. {urwid-5.0.0 → urwid-5.1.0}/.devcontainer/devcontainer.json +0 -0
  87. {urwid-5.0.0 → urwid-5.1.0}/.dockerignore +0 -0
  88. {urwid-5.0.0 → urwid-5.1.0}/.editorconfig +0 -0
  89. {urwid-5.0.0 → urwid-5.1.0}/.github/CODE_OF_CONDUCT.md +0 -0
  90. {urwid-5.0.0 → urwid-5.1.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  91. {urwid-5.0.0 → urwid-5.1.0}/.github/ISSUE_TEMPLATE/docs.md +0 -0
  92. {urwid-5.0.0 → urwid-5.1.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  93. {urwid-5.0.0 → urwid-5.1.0}/.github/ISSUE_TEMPLATE/question.md +0 -0
  94. {urwid-5.0.0 → urwid-5.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  95. {urwid-5.0.0 → urwid-5.1.0}/.github/dependabot.yml +0 -0
  96. {urwid-5.0.0 → urwid-5.1.0}/.github/labeler.yml +0 -0
  97. {urwid-5.0.0 → urwid-5.1.0}/.github/release.yml +0 -0
  98. {urwid-5.0.0 → urwid-5.1.0}/.github/workflows/labels.yml +0 -0
  99. {urwid-5.0.0 → urwid-5.1.0}/.gitignore +0 -0
  100. {urwid-5.0.0 → urwid-5.1.0}/.pre-commit-config.yaml +0 -0
  101. {urwid-5.0.0 → urwid-5.1.0}/.yamllint.yml +0 -0
  102. {urwid-5.0.0 → urwid-5.1.0}/COPYING +0 -0
  103. {urwid-5.0.0 → urwid-5.1.0}/classifiers.txt +0 -0
  104. {urwid-5.0.0 → urwid-5.1.0}/conftest.py +0 -0
  105. {urwid-5.0.0 → urwid-5.1.0}/pylint-requirements.txt +0 -0
  106. {urwid-5.0.0 → urwid-5.1.0}/pyrefly-requirements.txt +0 -0
  107. {urwid-5.0.0 → urwid-5.1.0}/requirements.txt +0 -0
  108. {urwid-5.0.0 → urwid-5.1.0}/setup.cfg +0 -0
  109. {urwid-5.0.0 → urwid-5.1.0}/tox.ini +0 -0
  110. {urwid-5.0.0 → urwid-5.1.0}/urwid/_deprecation.py +0 -0
  111. {urwid-5.0.0 → urwid-5.1.0}/urwid/_selectors.py +0 -0
  112. {urwid-5.0.0 → urwid-5.1.0}/urwid/ansi_parser.py +0 -0
  113. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/_web.css +0 -0
  114. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/html_fragment.py +0 -0
  115. {urwid-5.0.0 → urwid-5.1.0}/urwid/display/raw.py +0 -0
  116. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/abstract_loop.py +0 -0
  117. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/select_loop.py +0 -0
  118. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/tornado_loop.py +0 -0
  119. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/trio_loop.py +0 -0
  120. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/twisted_loop.py +0 -0
  121. {urwid-5.0.0 → urwid-5.1.0}/urwid/event_loop/zmq_loop.py +0 -0
  122. {urwid-5.0.0 → urwid-5.1.0}/urwid/graphics.py +0 -0
  123. {urwid-5.0.0 → urwid-5.1.0}/urwid/py.typed +0 -0
  124. {urwid-5.0.0 → urwid-5.1.0}/urwid/signals.py +0 -0
  125. {urwid-5.0.0 → urwid-5.1.0}/urwid/split_repr.py +0 -0
  126. {urwid-5.0.0 → urwid-5.1.0}/urwid/text_layout.py +0 -0
  127. {urwid-5.0.0 → urwid-5.1.0}/urwid/util.py +0 -0
  128. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/ansi_text.py +0 -0
  129. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/big_text.py +0 -0
  130. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/deque_walker.py +0 -0
  131. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/list_walker.py +0 -0
  132. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/monitored_list.py +0 -0
  133. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/progress_bar.py +0 -0
  134. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/text.py +0 -0
  135. {urwid-5.0.0 → urwid-5.1.0}/urwid/widget/widget_decoration.py +0 -0
  136. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/dependency_links.txt +0 -0
  137. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/not-zip-safe +0 -0
  138. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/requires.txt +0 -0
  139. {urwid-5.0.0 → urwid-5.1.0}/urwid.egg-info/top_level.txt +0 -0
  140. {urwid-5.0.0 → urwid-5.1.0}/yamllint-requirements.txt +0 -0
@@ -27,7 +27,7 @@ jobs:
27
27
  with:
28
28
  fetch-depth: 0 # need for setuptools_scm
29
29
  - name: Install uv
30
- uses: astral-sh/setup-uv@v10.3.2
30
+ uses: astral-sh/setup-uv@v10.3.3
31
31
  - name: Create virtual environment
32
32
  run: uv venv
33
33
  - name: Install python dependencies
@@ -17,7 +17,7 @@ jobs:
17
17
  steps:
18
18
  - uses: actions/checkout@v7
19
19
  - name: Install uv
20
- uses: astral-sh/setup-uv@v10.3.2
20
+ uses: astral-sh/setup-uv@v10.3.3
21
21
  - name: Create virtual environment
22
22
  run: uv venv --python 3.14
23
23
  - name: Install package with all extras
@@ -17,7 +17,7 @@ jobs:
17
17
  steps:
18
18
  - uses: actions/checkout@v7
19
19
  - name: Install uv
20
- uses: astral-sh/setup-uv@v10.3.2
20
+ uses: astral-sh/setup-uv@v10.3.3
21
21
  - name: Create virtual environment
22
22
  run: uv venv --python 3.14
23
23
  - name: Install package with all extras
@@ -17,7 +17,7 @@ jobs:
17
17
  steps:
18
18
  - uses: actions/checkout@v7
19
19
  - name: Install uv
20
- uses: astral-sh/setup-uv@v10.3.2
20
+ uses: astral-sh/setup-uv@v10.3.3
21
21
  - name: Create virtual environment
22
22
  run: uv venv --python 3.14
23
23
  - name: Install package with all extras
@@ -53,7 +53,7 @@ jobs:
53
53
  steps:
54
54
  - uses: actions/checkout@v7
55
55
  - name: Install uv
56
- uses: astral-sh/setup-uv@v10.3.2
56
+ uses: astral-sh/setup-uv@v10.3.3
57
57
  - name: Create virtual environment
58
58
  run: uv venv --python 3.14
59
59
  - name: Install package with all extras
@@ -70,7 +70,7 @@ jobs:
70
70
  steps:
71
71
  - uses: actions/checkout@v7
72
72
  - name: Install uv
73
- uses: astral-sh/setup-uv@v10.3.2
73
+ uses: astral-sh/setup-uv@v10.3.3
74
74
  - name: Create virtual environment
75
75
  run: uv venv --python 3.14
76
76
  - name: Install package with all extras
@@ -87,7 +87,7 @@ jobs:
87
87
  steps:
88
88
  - uses: actions/checkout@v7
89
89
  - name: Install uv
90
- uses: astral-sh/setup-uv@v10.3.2
90
+ uses: astral-sh/setup-uv@v10.3.3
91
91
  - name: Create virtual environment
92
92
  run: uv venv --python 3.14
93
93
  - name: Install package with all extras
@@ -106,20 +106,21 @@ jobs:
106
106
  os: [ "ubuntu-latest", "windows-latest" ]
107
107
  # A "t" suffix selects the free-threaded (PEP 703, --disable-gil) build.
108
108
  python-version: [ "3.11", "3.12", "3.13", "3.14", "3.15", "3.13t", "3.14t", "3.15t", "pypy3.11" ]
109
+ # The macOS jobs are disabled because no macOS runners are available at the moment; re-enable them once
110
+ # runners are back. urwid has no macOS-specific code: macOS runs the POSIX paths Linux covers, so the oldest
111
+ # and newest CPython, plus the newest free-threaded build, are enough to catch selector (kqueue) and other
112
+ # POSIX differences.
113
+ # include:
114
+ # - os: "macos-latest"
115
+ # python-version: "3.11"
116
+ # - os: "macos-latest"
117
+ # python-version: "3.15"
118
+ # - os: "macos-latest"
119
+ # python-version: "3.15t"
109
120
  exclude:
110
121
  # trio needs cffi on Windows, which publishes no 3.13t wheel and refuses to build for it.
111
122
  - os: "windows-latest"
112
123
  python-version: "3.13t"
113
- # urwid has no macOS-specific code: macOS runs the POSIX paths Linux covers, so the oldest and newest
114
- # CPython, plus the newest free-threaded build, are enough to catch selector (kqueue) and other POSIX
115
- # differences.
116
- include:
117
- - os: "macos-latest"
118
- python-version: "3.11"
119
- - os: "macos-latest"
120
- python-version: "3.15"
121
- - os: "macos-latest"
122
- python-version: "3.15t"
123
124
 
124
125
  steps:
125
126
  - uses: actions/checkout@v7
@@ -131,7 +132,7 @@ jobs:
131
132
  python-version: ${{ matrix.python-version }}
132
133
  allow-prereleases: true
133
134
  - name: Install uv
134
- uses: astral-sh/setup-uv@v10.3.2
135
+ uses: astral-sh/setup-uv@v10.3.3
135
136
  - name: Create virtual environment
136
137
  run: uv venv --python-preference only-system --python ${{ matrix.python-version }}
137
138
  - name: Install dependencies
@@ -178,7 +179,7 @@ jobs:
178
179
  fetch-depth: 0 # need for setuptools_scm
179
180
 
180
181
  - name: Install uv
181
- uses: astral-sh/setup-uv@v10.3.2
182
+ uses: astral-sh/setup-uv@v10.3.3
182
183
 
183
184
  - name: Build dist
184
185
  run: uv build
@@ -202,7 +203,7 @@ jobs:
202
203
  steps:
203
204
  - uses: actions/checkout@v7
204
205
  - name: Install uv
205
- uses: astral-sh/setup-uv@v10.3.2
206
+ uses: astral-sh/setup-uv@v10.3.3
206
207
  - uses: actions/download-artifact@v8
207
208
  with:
208
209
  # unpacks default artifact into dist/
@@ -17,7 +17,7 @@ jobs:
17
17
  steps:
18
18
  - uses: actions/checkout@v7
19
19
  - name: Install uv
20
- uses: astral-sh/setup-uv@v10.3.2
20
+ uses: astral-sh/setup-uv@v10.3.3
21
21
  - name: Lint YAML files
22
22
  run: uv run --no-project --with-requirements yamllint-requirements.txt yamllint . -f github
23
23
 
@@ -0,0 +1,7 @@
1
+ include COPYING CHANGELOG README.rst
2
+ include requirements.txt classifiers.txt
3
+ include urwid/display/_web.js urwid/display/_web.css urwid/display/_web_common.js
4
+ include urwid/display/_websocket.js urwid/display/_websocket.css urwid/display/_websocket.html
5
+ prune tests
6
+ prune docs
7
+ prune examples
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: urwid
3
- Version: 5.0.0
3
+ Version: 5.1.0
4
4
  Summary: A full-featured console (xterm et al.) user interface library
5
5
  Author-email: Ian Ward <ian@excess.org>
6
6
  License-Expression: LGPL-2.1-only
@@ -74,7 +74,7 @@ It includes many features useful for text console application developers includi
74
74
  - Powerful list box with programmable content for scrolling all widget types
75
75
  - Your choice of event loops: Twisted, Glib (deprecated), Tornado, asyncio, trio, ZeroMQ or select-based loop
76
76
  - Pre-built widgets include edit boxes, buttons, check boxes and radio buttons
77
- - Display modules include raw, curses, and experimental LCD and web displays
77
+ - Display modules include raw, curses, and experimental LCD (deprecated) and web displays
78
78
  - Support for UTF-8, simple 8-bit and CJK encodings
79
79
  - 24-bit (true color), 256 color, and 88 color mode support
80
80
  - Compatible with Python 3.11+ and PyPy
@@ -92,11 +92,11 @@ To install using pip
92
92
  pip install urwid
93
93
 
94
94
  For advanced functionality extra requirements need to be installed.
95
- Example for ZeroMQ event loop and LCD display:
95
+ Example for the ZeroMQ event loop:
96
96
 
97
97
  .. code:: bash
98
98
 
99
- pip install urwid[serial,zmq]
99
+ pip install urwid[zmq]
100
100
 
101
101
  Alternatively if you are on Debian or Ubuntu
102
102
 
@@ -16,7 +16,7 @@ It includes many features useful for text console application developers includi
16
16
  - Powerful list box with programmable content for scrolling all widget types
17
17
  - Your choice of event loops: Twisted, Glib (deprecated), Tornado, asyncio, trio, ZeroMQ or select-based loop
18
18
  - Pre-built widgets include edit boxes, buttons, check boxes and radio buttons
19
- - Display modules include raw, curses, and experimental LCD and web displays
19
+ - Display modules include raw, curses, and experimental LCD (deprecated) and web displays
20
20
  - Support for UTF-8, simple 8-bit and CJK encodings
21
21
  - 24-bit (true color), 256 color, and 88 color mode support
22
22
  - Compatible with Python 3.11+ and PyPy
@@ -34,11 +34,11 @@ To install using pip
34
34
  pip install urwid
35
35
 
36
36
  For advanced functionality extra requirements need to be installed.
37
- Example for ZeroMQ event loop and LCD display:
37
+ Example for the ZeroMQ event loop:
38
38
 
39
39
  .. code:: bash
40
40
 
41
- pip install urwid[serial,zmq]
41
+ pip install urwid[zmq]
42
42
 
43
43
  Alternatively if you are on Debian or Ubuntu
44
44
 
@@ -0,0 +1,49 @@
1
+ # Security
2
+
3
+ Report vulnerabilities at https://github.com/urwid/urwid/security/advisories
4
+
5
+ ## Threat model
6
+
7
+ ### Web display (`urwid.display.web`)
8
+
9
+ The web display runs an urwid application as a CGI script.
10
+ The first request of a browser starts the application,
11
+ and later requests of the same browser carry the session id in the `X-Urwid-ID` header
12
+ to send keystrokes (`handle_short_request()`) or to fetch screen updates in the polling mode.
13
+
14
+ What the module protects:
15
+
16
+ - Session files
17
+ - The input pipe, the polling update socket and the polling daemon's error log of every session
18
+ live in the directory `urwid-web-<uid>` under the `pipe_dir` given to `set_preferences()`.
19
+ - The module creates that directory with mode `0700` and refuses to run when it is not a directory
20
+ owned by the effective user, or when the group or other users have any access to it.
21
+ - The files are named after a hash of the session id, so a listing of the directory does not reveal the id.
22
+ - The polling daemon creates its files with umask `077`.
23
+ - Session id
24
+ - The id is generated by `secrets.token_urlsafe()`.
25
+ - A client-supplied id is checked against `_URWID_ID_MAX_LEN` and `_URWID_ID_CHARS` before any file lookup.
26
+ - Resource limits
27
+ - A keystroke request is read up to `MAX_READ` bytes.
28
+ - The screen size is capped at `MAX_COLS` and `MAX_ROWS`.
29
+ - The number of concurrent sessions of one user and `pipe_dir` is limited to about `max_clients`
30
+ (`set_preferences()`): two sessions starting at once can both pass the check, and stale pipes count towards it.
31
+
32
+ What the deployment has to provide:
33
+
34
+ - The session id is a bearer credential.
35
+ Anyone who sends it to the CGI endpoint can read the screen and send keystrokes to the session.
36
+ Keeping it secret in transit is the web server's job: serve the script over HTTPS only.
37
+ - The module does not authenticate users.
38
+ The web server decides who may reach the CGI script, for example with HTTP authentication.
39
+ - Processes that run as the same user as the CGI script are trusted, because they can open the session directory.
40
+ - Other users must not be able to rename entries in `pipe_dir`:
41
+ it is either private to the user or a sticky directory such as `/tmp`.
42
+ In a shared `pipe_dir` such as `/tmp`, another local user can create `urwid-web-<uid>` first,
43
+ and the display then refuses to run for that uid.
44
+ A `pipe_dir` private to the user avoids this.
45
+
46
+ Reports that need one of these conditions to be broken are not treated as vulnerabilities of urwid.
47
+
48
+ For production use, build a display module on a maintained HTTP and WebSocket library such as aiohttp or Tornado,
49
+ which provide TLS, authentication and connection handling.
@@ -1,2 +1,2 @@
1
- mypy==2.4.0
1
+ mypy==2.4.1
2
2
  types-pyserial==3.5.0.20260712
@@ -402,6 +402,31 @@ missing-module-attribute = "ignore"
402
402
  pythonVersion = "3.11"
403
403
  # The same paths as [tool.pyrefly] project-includes.
404
404
  include = [ "examples", "tests/type_checks", "urwid" ]
405
+ # Per-path exceptions matching the [tool.mypy] overrides and [tool.pyrefly] sub-configs.
406
+ # The first environment whose root holds a file wins.
407
+ # An environment root is also its import root, so each one names the project root to keep "import urwid" resolving.
408
+ [[tool.pyright.executionEnvironments]]
409
+ # Widgets override render, keypress, mouse_event and similar methods with narrower sizing signatures on purpose.
410
+ root = "urwid/widget"
411
+ extraPaths = [ "." ]
412
+ reportIncompatibleMethodOverride = false
413
+
414
+ [[tool.pyright.executionEnvironments]]
415
+ root = "examples"
416
+ extraPaths = [ "." ]
417
+ reportIncompatibleMethodOverride = false
418
+
419
+ [[tool.pyright.executionEnvironments]]
420
+ # The curses window is None until start(), and checking for that before each operation is too expensive.
421
+ root = "urwid/display/curses.py"
422
+ extraPaths = [ "." ]
423
+ reportOptionalMemberAccess = false
424
+
425
+ [[tool.pyright.executionEnvironments]]
426
+ # ctypes.windll exists on Windows only, and so does this module. pythonPlatform = "Windows" here does not resolve it.
427
+ root = "urwid/display/_win32.py"
428
+ extraPaths = [ "." ]
429
+ reportAttributeAccessIssue = false
405
430
 
406
431
  [tool.pytest.ini_options]
407
432
  minversion = "6.0"
@@ -1,4 +1,4 @@
1
- pytest==9.1.1
2
- pytest-asyncio==1.4.0
1
+ pytest==9.2.0
2
+ pytest-asyncio==1.4.1
3
3
  pytest-cov==7.1.0
4
4
  pytest-timeout==2.4.0
@@ -126,10 +126,20 @@ from .display import (
126
126
  AttrSpecError,
127
127
  BaseScreen,
128
128
  Hyperlink,
129
+ InputClosedError,
129
130
  RealTerminal,
130
131
  ScreenError,
131
132
  )
132
- from .event_loop import AsyncioEventLoop, EventLoop, ExitMainLoop, MainLoop, SelectEventLoop
133
+ from .event_loop import (
134
+ AsyncioEventLoop,
135
+ EventLoop,
136
+ ExitMainLoop,
137
+ GuardedEventLoop,
138
+ MainLoop,
139
+ SelectEventLoop,
140
+ get_running_loop,
141
+ get_running_loop_or_none,
142
+ )
133
143
  from .widget import (
134
144
  ANY,
135
145
  BOTTOM,
@@ -172,6 +182,7 @@ from .widget import (
172
182
  EditError,
173
183
  Filler,
174
184
  FillerError,
185
+ FilteredListWalker,
175
186
  Frame,
176
187
  FrameError,
177
188
  GraphVScale,
@@ -187,8 +198,12 @@ from .widget import (
187
198
  MonitoredFocusDeque,
188
199
  MonitoredFocusList,
189
200
  MonitoredList,
201
+ MouseButton,
202
+ Notification,
203
+ Notifications,
190
204
  Overlay,
191
205
  OverlayError,
206
+ OverlayStack,
192
207
  Padding,
193
208
  PaddingError,
194
209
  ParentNode,
@@ -203,12 +218,20 @@ from .widget import (
203
218
  SelectableIcon,
204
219
  SelectNavigationListContentsMixin,
205
220
  SelectNavigationMixin,
221
+ Severity,
206
222
  SimpleDequeWalker,
207
223
  SimpleFocusDequeWalker,
208
224
  SimpleFocusListWalker,
209
225
  SimpleListWalker,
210
226
  Sizing,
211
227
  SolidFill,
228
+ Spinner,
229
+ Table,
230
+ TableColumn,
231
+ TableError,
232
+ TableRow,
233
+ Tabs,
234
+ TabsError,
212
235
  Text,
213
236
  TextError,
214
237
  TreeListBox,
@@ -216,6 +239,7 @@ from .widget import (
216
239
  TreeWalker,
217
240
  TreeWidget,
218
241
  TreeWidgetError,
242
+ ValidationMessage,
219
243
  VAlign,
220
244
  WHSettings,
221
245
  Widget,
@@ -320,6 +344,7 @@ __all__: tuple[str, ...] = (
320
344
  "ExitMainLoop",
321
345
  "Filler",
322
346
  "FillerError",
347
+ "FilteredListWalker",
323
348
  "Font",
324
349
  "FontRegistry",
325
350
  "Frame",
@@ -327,11 +352,13 @@ __all__: tuple[str, ...] = (
327
352
  "GraphVScale",
328
353
  "GridFlow",
329
354
  "GridFlowError",
355
+ "GuardedEventLoop",
330
356
  "HalfBlock5x4Font",
331
357
  "HalfBlock6x5Font",
332
358
  "HalfBlock7x7Font",
333
359
  "HalfBlockHeavy6x5Font",
334
360
  "Hyperlink",
361
+ "InputClosedError",
335
362
  "IntEdit",
336
363
  "LayeredAttr",
337
364
  "LayoutSegment",
@@ -347,8 +374,12 @@ __all__: tuple[str, ...] = (
347
374
  "MonitoredFocusDeque",
348
375
  "MonitoredFocusList",
349
376
  "MonitoredList",
377
+ "MouseButton",
378
+ "Notification",
379
+ "Notifications",
350
380
  "Overlay",
351
381
  "OverlayError",
382
+ "OverlayStack",
352
383
  "Padding",
353
384
  "PaddingError",
354
385
  "ParentNode",
@@ -366,6 +397,7 @@ __all__: tuple[str, ...] = (
366
397
  "SelectNavigationListContentsMixin",
367
398
  "SelectNavigationMixin",
368
399
  "SelectableIcon",
400
+ "Severity",
369
401
  "Sextant2x2Font",
370
402
  "Sextant3x3Font",
371
403
  "Signals",
@@ -376,7 +408,14 @@ __all__: tuple[str, ...] = (
376
408
  "Sizing",
377
409
  "SolidCanvas",
378
410
  "SolidFill",
411
+ "Spinner",
379
412
  "StandardTextLayout",
413
+ "Table",
414
+ "TableColumn",
415
+ "TableError",
416
+ "TableRow",
417
+ "Tabs",
418
+ "TabsError",
380
419
  "TagMarkupException",
381
420
  "Text",
382
421
  "TextCanvas",
@@ -392,6 +431,7 @@ __all__: tuple[str, ...] = (
392
431
  "TreeWidget",
393
432
  "TreeWidgetError",
394
433
  "VAlign",
434
+ "ValidationMessage",
395
435
  "WHSettings",
396
436
  "Widget",
397
437
  "WidgetContainerMixin",
@@ -424,6 +464,8 @@ __all__: tuple[str, ...] = (
424
464
  "get_all_fonts",
425
465
  "get_ascii_fallbacks",
426
466
  "get_encoding_mode",
467
+ "get_running_loop",
468
+ "get_running_loop_or_none",
427
469
  "int_scale",
428
470
  "is_mouse_event",
429
471
  "is_wide_char",
@@ -62,6 +62,8 @@ if typing.TYPE_CHECKING:
62
62
  "pop up anchor": NotRequired[tuple[int, int, int]],
63
63
  # Same (x, y) as "pop up"; the data part is the pop-up widget and its unhandled key callback.
64
64
  "pop up unhandled key": NotRequired[tuple[int, int, tuple[AbstractWidget, Callable[[str], str | None]]]],
65
+ # Same (x, y) as "pop up"; the data part is the pop-up widget and its outside click callback.
66
+ "pop up click outside": NotRequired[tuple[int, int, tuple[AbstractWidget, Callable[[], None]]]],
65
67
  "cursor": NotRequired[tuple[int, int, None]],
66
68
  },
67
69
  )
@@ -401,6 +403,18 @@ class Canvas:
401
403
  return None
402
404
  return on_key[2][1]
403
405
 
406
+ def get_pop_up_click_outside(self) -> Callable[[], None] | None:
407
+ """Return the outside click callback set with the pop-up on this canvas.
408
+
409
+ :returns: the callback, or ``None`` when none was set.
410
+ """
411
+ pop_up = self.coords.get("pop up", None)
412
+ on_click = self.coords.get("pop up click outside", None)
413
+ # As for the anchor, use only the callback set together with this pop-up.
414
+ if pop_up is None or on_click is None or on_click[:2] != pop_up[:2] or on_click[2][0] is not pop_up[2][0]:
415
+ return None
416
+ return on_click[2][1]
417
+
404
418
  def set_pop_up(
405
419
  self,
406
420
  w: AbstractWidget,
@@ -411,6 +425,7 @@ class Canvas:
411
425
  *,
412
426
  anchor_height: int | None = None,
413
427
  on_unhandled_key: Callable[[str], str | None] | None = None,
428
+ on_click_outside: Callable[[], None] | None = None,
414
429
  ) -> None:
415
430
  """Add pop-up information to the canvas.
416
431
 
@@ -434,6 +449,9 @@ class Canvas:
434
449
  :param on_unhandled_key: called by :class:`PopUpTarget <urwid.PopUpTarget>` with a key that `w` returned
435
450
  unhandled while it is the topmost open pop-up; it returns ``None`` when it handled the key, or the key
436
451
  to pass on. ``None`` passes every unhandled key on.
452
+ :param on_click_outside: called by :class:`PopUpTarget <urwid.PopUpTarget>` instead of passing on a press of
453
+ mouse button 1, 2 or 3 outside `w` while it is the topmost open pop-up.
454
+ ``None`` leaves such a press unhandled.
437
455
  :raises CanvasError: the canvas is already finalised, the anchor height is negative
438
456
  or the overlay size is not positive
439
457
  """
@@ -458,6 +476,10 @@ class Canvas:
458
476
  self.coords.pop("pop up unhandled key", None)
459
477
  else:
460
478
  self.coords["pop up unhandled key"] = (left, top, (w, on_unhandled_key))
479
+ if on_click_outside is None:
480
+ self.coords.pop("pop up click outside", None)
481
+ else:
482
+ self.coords["pop up click outside"] = (left, top, (w, on_click_outside))
461
483
 
462
484
  def translate_coords(self, dx: int, dy: int) -> _CanvasCoords:
463
485
  """Return coords shifted by (dx, dy)."""
@@ -774,7 +796,7 @@ class SolidCanvas(Canvas):
774
796
  if col != 1:
775
797
  raise ValueError(f"Invalid fill_char: {fill_char!r}")
776
798
  self._text, cs = apply_target_encoding(fill_char[:end])
777
- self._cs = cs[0][0]
799
+ self._cs: Literal["0", "U"] | None = cs[0][0]
778
800
  self.size = cols, rows
779
801
  self.cursor = None
780
802
 
@@ -801,7 +823,7 @@ class SolidCanvas(Canvas):
801
823
  rows = self.size[1]
802
824
  def_attr = attr.get(None) if attr else None
803
825
 
804
- line = [(def_attr, self._cs, self._text * cols)]
826
+ line: _ContentLine = [(def_attr, self._cs, self._text * cols)]
805
827
  for _ in range(rows):
806
828
  yield line
807
829
 
@@ -1066,14 +1088,15 @@ class CompositeCanvas(Canvas):
1066
1088
  bottom_shards = shards_trim_top(side_shards, height)
1067
1089
  side_shards = shards_trim_rows(side_shards, height)
1068
1090
 
1069
- left_shards: list[list[tuple[int, list[_CView]]]] = []
1070
- right_shards: list[list[tuple[int, list[_CView]]]] = []
1071
- if left > 0:
1072
- left_shards = [shards_trim_sides(side_shards, 0, left)]
1073
- if right > 0:
1074
- right_shards = [shards_trim_sides(side_shards, max(0, left + width), right)]
1075
-
1076
- middle_shards = shards_join((*left_shards, other.shards, *right_shards)) if left or right else other.shards
1091
+ if left > 0 and right > 0:
1092
+ left_shards, right_shards = _shards_cut_columns(side_shards, ((0, left), (left + width, right)))
1093
+ middle_shards = shards_join((left_shards, other.shards, right_shards))
1094
+ elif left > 0:
1095
+ middle_shards = shards_join((shards_trim_sides(side_shards, 0, left), other.shards))
1096
+ elif right > 0:
1097
+ middle_shards = shards_join((other.shards, shards_trim_sides(side_shards, max(0, left + width), right)))
1098
+ else:
1099
+ middle_shards = other.shards
1077
1100
 
1078
1101
  self.shards = top_shards + middle_shards + bottom_shards
1079
1102
 
@@ -1314,36 +1337,51 @@ def shards_trim_sides(
1314
1337
  raise ValueError(left)
1315
1338
  if cols <= 0:
1316
1339
  raise ValueError(cols)
1340
+ return _shards_cut_columns(shards, ((left, cols),))[0]
1341
+
1342
+
1343
+ def _shards_cut_columns(
1344
+ shards: Iterable[tuple[int, list[_CView]]],
1345
+ column_ranges: Sequence[tuple[int, int]],
1346
+ ) -> list[list[tuple[int, list[_CView]]]]:
1347
+ """Return the shards of each ``(left, cols)`` column range.
1348
+
1349
+ *shards* is walked once for all ranges.
1350
+ Each range starts at a non-negative column and has a positive width.
1351
+
1352
+ :returns: one shard list per entry of *column_ranges*, in the same order.
1353
+ :raises CanvasError: the cviews of a shard overflow the gaps the shards above it leave.
1354
+ """
1317
1355
  shard_tail: list[tuple[int, int, Iterator[_ContentLine] | None, _CView]] = []
1318
- new_shards: list[tuple[int, list[_CView]]] = []
1319
- right = left + cols
1356
+ results: list[list[tuple[int, list[_CView]]]] = [[] for _ in column_ranges]
1320
1357
  for num_rows, cviews in shards:
1321
1358
  # Cviews starting in this shard get this shard's marker and continued ones keep an earlier one:
1322
1359
  # done_rows cannot tell them apart, since it stays 0 for a cview continued past a shard of no rows.
1323
1360
  started_here: Iterator[_ContentLine] = iter(())
1324
1361
  sbody = shard_body(cviews, shard_tail, False, started_here, num_rows=num_rows)
1325
1362
  shard_tail = shard_body_tail(num_rows, sbody)
1326
- new_cviews = []
1327
- col = 0
1328
- for _done_rows, content_iter, cv in sbody:
1329
- cv_cols = cv[2]
1330
- next_col = col + cv_cols
1331
- if content_iter is not started_here or next_col <= left or col >= right:
1363
+ for new_shards, (left, cols) in zip(results, column_ranges, strict=True):
1364
+ right = left + cols
1365
+ new_cviews = []
1366
+ col = 0
1367
+ for _done_rows, content_iter, cv in sbody:
1368
+ next_col = col + cv[2]
1369
+ if content_iter is not started_here or next_col <= left or col >= right:
1370
+ col = next_col
1371
+ continue
1372
+ if col < left:
1373
+ cv = cview_trim_left(cv, left - col) # noqa: PLW2901
1374
+ col = left
1375
+ if next_col > right:
1376
+ cv = cview_trim_cols(cv, right - col) # noqa: PLW2901
1377
+ new_cviews.append(cv)
1332
1378
  col = next_col
1333
- continue
1334
- if col < left:
1335
- cv = cview_trim_left(cv, left - col) # noqa: PLW2901
1336
- col = left
1337
- if next_col > right:
1338
- cv = cview_trim_cols(cv, right - col) # noqa: PLW2901
1339
- new_cviews.append(cv)
1340
- col = next_col
1341
- if not new_cviews:
1342
- prev_num_rows, prev_cviews = new_shards[-1]
1343
- new_shards[-1] = (prev_num_rows + num_rows, prev_cviews)
1344
- else:
1345
- new_shards.append((num_rows, new_cviews))
1346
- return new_shards
1379
+ if not new_cviews:
1380
+ prev_num_rows, prev_cviews = new_shards[-1]
1381
+ new_shards[-1] = (prev_num_rows + num_rows, prev_cviews)
1382
+ else:
1383
+ new_shards.append((num_rows, new_cviews))
1384
+ return results
1347
1385
 
1348
1386
 
1349
1387
  def shards_join(shard_lists: Iterable[Iterable[tuple[int, list[_CView]]]]) -> list[tuple[int, list[_CView]]]: