pyguitest 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 (92) hide show
  1. pyguitest-0.1.0/CHANGELOG.md +32 -0
  2. pyguitest-0.1.0/LICENSE +354 -0
  3. pyguitest-0.1.0/MANIFEST.in +10 -0
  4. pyguitest-0.1.0/PKG-INFO +285 -0
  5. pyguitest-0.1.0/README.md +238 -0
  6. pyguitest-0.1.0/docs/adr-001-dependencies.md +103 -0
  7. pyguitest-0.1.0/docs/adr-002-transports.md +132 -0
  8. pyguitest-0.1.0/docs/input.md +269 -0
  9. pyguitest-0.1.0/docs/install.md +181 -0
  10. pyguitest-0.1.0/docs/structure.md +373 -0
  11. pyguitest-0.1.0/docs/validation.md +96 -0
  12. pyguitest-0.1.0/docs/wayland-audit.html +510 -0
  13. pyguitest-0.1.0/examples/01_what_can_i_do.py +28 -0
  14. pyguitest-0.1.0/examples/02_find_windows.py +35 -0
  15. pyguitest-0.1.0/examples/03_widgets.py +67 -0
  16. pyguitest-0.1.0/examples/04_drive_an_editor.py +52 -0
  17. pyguitest-0.1.0/examples/05_screenshot.py +75 -0
  18. pyguitest-0.1.0/examples/06_a_real_test.py +132 -0
  19. pyguitest-0.1.0/examples/07_keys_and_pointer.py +77 -0
  20. pyguitest-0.1.0/examples/08_find_by_image.py +70 -0
  21. pyguitest-0.1.0/examples/README.md +62 -0
  22. pyguitest-0.1.0/examples/_x11_validate.py +111 -0
  23. pyguitest-0.1.0/pyproject.toml +168 -0
  24. pyguitest-0.1.0/scripts/diagnose-x11-capture.py +101 -0
  25. pyguitest-0.1.0/scripts/validate-gnome-extension.sh +248 -0
  26. pyguitest-0.1.0/setup.cfg +4 -0
  27. pyguitest-0.1.0/src/pyguitest/__init__.py +947 -0
  28. pyguitest-0.1.0/src/pyguitest/__main__.py +331 -0
  29. pyguitest-0.1.0/src/pyguitest/backends/__init__.py +411 -0
  30. pyguitest-0.1.0/src/pyguitest/backends/atspi.py +381 -0
  31. pyguitest-0.1.0/src/pyguitest/backends/base.py +676 -0
  32. pyguitest-0.1.0/src/pyguitest/backends/capture.py +172 -0
  33. pyguitest-0.1.0/src/pyguitest/backends/composite.py +401 -0
  34. pyguitest-0.1.0/src/pyguitest/backends/crop.py +89 -0
  35. pyguitest-0.1.0/src/pyguitest/backends/eiinput.py +727 -0
  36. pyguitest-0.1.0/src/pyguitest/backends/gnomeshell.py +358 -0
  37. pyguitest-0.1.0/src/pyguitest/backends/imagesearch.py +204 -0
  38. pyguitest-0.1.0/src/pyguitest/backends/input.py +465 -0
  39. pyguitest-0.1.0/src/pyguitest/backends/null.py +31 -0
  40. pyguitest-0.1.0/src/pyguitest/backends/portal.py +401 -0
  41. pyguitest-0.1.0/src/pyguitest/backends/portalcapture.py +187 -0
  42. pyguitest-0.1.0/src/pyguitest/backends/portalrequest.py +131 -0
  43. pyguitest-0.1.0/src/pyguitest/backends/uinput.py +327 -0
  44. pyguitest-0.1.0/src/pyguitest/backends/windows.py +844 -0
  45. pyguitest-0.1.0/src/pyguitest/backends/x11.py +904 -0
  46. pyguitest-0.1.0/src/pyguitest/capabilities.py +219 -0
  47. pyguitest-0.1.0/src/pyguitest/compat.py +401 -0
  48. pyguitest-0.1.0/src/pyguitest/errors.py +69 -0
  49. pyguitest-0.1.0/src/pyguitest/hints.py +262 -0
  50. pyguitest-0.1.0/src/pyguitest/ipc.py +598 -0
  51. pyguitest-0.1.0/src/pyguitest/png.py +103 -0
  52. pyguitest-0.1.0/src/pyguitest/py.typed +0 -0
  53. pyguitest-0.1.0/src/pyguitest/roles.py +80 -0
  54. pyguitest-0.1.0/src/pyguitest/session.py +366 -0
  55. pyguitest-0.1.0/src/pyguitest/tools.py +281 -0
  56. pyguitest-0.1.0/src/pyguitest/xkb.py +308 -0
  57. pyguitest-0.1.0/src/pyguitest.egg-info/PKG-INFO +285 -0
  58. pyguitest-0.1.0/src/pyguitest.egg-info/SOURCES.txt +90 -0
  59. pyguitest-0.1.0/src/pyguitest.egg-info/dependency_links.txt +1 -0
  60. pyguitest-0.1.0/src/pyguitest.egg-info/entry_points.txt +2 -0
  61. pyguitest-0.1.0/src/pyguitest.egg-info/requires.txt +18 -0
  62. pyguitest-0.1.0/src/pyguitest.egg-info/top_level.txt +1 -0
  63. pyguitest-0.1.0/tests/test_api.py +633 -0
  64. pyguitest-0.1.0/tests/test_atspi.py +294 -0
  65. pyguitest-0.1.0/tests/test_backends.py +318 -0
  66. pyguitest-0.1.0/tests/test_capabilities.py +65 -0
  67. pyguitest-0.1.0/tests/test_capture.py +295 -0
  68. pyguitest-0.1.0/tests/test_cli_report.py +80 -0
  69. pyguitest-0.1.0/tests/test_compat.py +133 -0
  70. pyguitest-0.1.0/tests/test_composite.py +588 -0
  71. pyguitest-0.1.0/tests/test_docs.py +190 -0
  72. pyguitest-0.1.0/tests/test_eiinput.py +904 -0
  73. pyguitest-0.1.0/tests/test_eiinput_libei.py +127 -0
  74. pyguitest-0.1.0/tests/test_gnomeshell.py +442 -0
  75. pyguitest-0.1.0/tests/test_hints.py +305 -0
  76. pyguitest-0.1.0/tests/test_imagesearch.py +459 -0
  77. pyguitest-0.1.0/tests/test_input.py +243 -0
  78. pyguitest-0.1.0/tests/test_ipc.py +361 -0
  79. pyguitest-0.1.0/tests/test_main_debug.py +227 -0
  80. pyguitest-0.1.0/tests/test_migrate.py +61 -0
  81. pyguitest-0.1.0/tests/test_png.py +122 -0
  82. pyguitest-0.1.0/tests/test_portal.py +398 -0
  83. pyguitest-0.1.0/tests/test_portal_dbusmock.py +193 -0
  84. pyguitest-0.1.0/tests/test_portalcapture.py +195 -0
  85. pyguitest-0.1.0/tests/test_sendkeys.py +328 -0
  86. pyguitest-0.1.0/tests/test_session.py +201 -0
  87. pyguitest-0.1.0/tests/test_style.py +60 -0
  88. pyguitest-0.1.0/tests/test_tools.py +212 -0
  89. pyguitest-0.1.0/tests/test_uinput.py +192 -0
  90. pyguitest-0.1.0/tests/test_windows.py +818 -0
  91. pyguitest-0.1.0/tests/test_x11.py +977 -0
  92. pyguitest-0.1.0/tests/test_xkb.py +165 -0
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to pyguitest are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [semantic versioning](https://semver.org/spec/v2.0.0.html) — with the usual
6
+ 0.x caveat that the API may still change between minor versions.
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] — 2026-08-29
11
+
12
+ First public release.
13
+
14
+ ### Added
15
+
16
+ - Capability negotiation as public API: `connect()`, `supports()`,
17
+ `Capability`, `CapabilitySet` and the T1–T6 tier scale from the
18
+ X11::GUITest audit in `docs/wayland-audit.html`.
19
+ - Element automation over AT-SPI, the one layer that behaves identically
20
+ under X11 and Wayland.
21
+ - Input injection backends: X11, XDG desktop portal (RemoteDesktop),
22
+ GNOME Shell extension, libei (opt-in), uinput, and the `wdotool`/`wtype`
23
+ command-line tools.
24
+ - Screen capture and image search: portal capture, `grim`, X11, and
25
+ template matching through ImageMagick.
26
+ - Window management per compositor, including the GNOME Shell extension
27
+ path, since Mutter implements no foreign-toplevel protocol.
28
+ - A `pyguitest` command-line entry point.
29
+ - PEP 561 type information (`py.typed`); no hard runtime dependencies.
30
+
31
+ [Unreleased]: https://github.com/ctrondlp/pyguitest/compare/v0.1.0...HEAD
32
+ [0.1.0]: https://github.com/ctrondlp/pyguitest/tree/v0.1.0
@@ -0,0 +1,354 @@
1
+ pyguitest
2
+ Copyright (C) 2026 Dennis K. Paulsen
3
+
4
+ This program is free software; you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation; either version 2 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License along
15
+ with this program; if not, see <https://www.gnu.org/licenses/>.
16
+
17
+ GNU GENERAL PUBLIC LICENSE
18
+ Version 2, June 1991
19
+
20
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
21
+ <https://fsf.org/>
22
+ Everyone is permitted to copy and distribute verbatim copies
23
+ of this license document, but changing it is not allowed.
24
+
25
+ Preamble
26
+
27
+ The licenses for most software are designed to take away your
28
+ freedom to share and change it. By contrast, the GNU General Public
29
+ License is intended to guarantee your freedom to share and change free
30
+ software--to make sure the software is free for all its users. This
31
+ General Public License applies to most of the Free Software
32
+ Foundation's software and to any other program whose authors commit to
33
+ using it. (Some other Free Software Foundation software is covered by
34
+ the GNU Lesser General Public License instead.) You can apply it to
35
+ your programs, too.
36
+
37
+ When we speak of free software, we are referring to freedom, not
38
+ price. Our General Public Licenses are designed to make sure that you
39
+ have the freedom to distribute copies of free software (and charge for
40
+ this service if you wish), that you receive source code or can get it
41
+ if you want it, that you can change the software or use pieces of it
42
+ in new free programs; and that you know you can do these things.
43
+
44
+ To protect your rights, we need to make restrictions that forbid
45
+ anyone to deny you these rights or to ask you to surrender the rights.
46
+ These restrictions translate to certain responsibilities for you if you
47
+ distribute copies of the software, or if you modify it.
48
+
49
+ For example, if you distribute copies of such a program, whether
50
+ gratis or for a fee, you must give the recipients all the rights that
51
+ you have. You must make sure that they, too, receive or can get the
52
+ source code. And you must show them these terms so they know their
53
+ rights.
54
+
55
+ We protect your rights with two steps: (1) copyright the software, and
56
+ (2) offer you this license which gives you legal permission to copy,
57
+ distribute and/or modify the software.
58
+
59
+ Also, for each author's protection and ours, we want to make certain
60
+ that everyone understands that there is no warranty for this free
61
+ software. If the software is modified by someone else and passed on, we
62
+ want its recipients to know that what they have is not the original, so
63
+ that any problems introduced by others will not reflect on the original
64
+ authors' reputations.
65
+
66
+ Finally, any free program is threatened constantly by software
67
+ patents. We wish to avoid the danger that redistributors of a free
68
+ program will individually obtain patent licenses, in effect making the
69
+ program proprietary. To prevent this, we have made it clear that any
70
+ patent must be licensed for everyone's free use or not licensed at all.
71
+
72
+ The precise terms and conditions for copying, distribution and
73
+ modification follow.
74
+
75
+ GNU GENERAL PUBLIC LICENSE
76
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
77
+
78
+ 0. This License applies to any program or other work which contains
79
+ a notice placed by the copyright holder saying it may be distributed
80
+ under the terms of this General Public License. The "Program", below,
81
+ refers to any such program or work, and a "work based on the Program"
82
+ means either the Program or any derivative work under copyright law:
83
+ that is to say, a work containing the Program or a portion of it,
84
+ either verbatim or with modifications and/or translated into another
85
+ language. (Hereinafter, translation is included without limitation in
86
+ the term "modification".) Each licensee is addressed as "you".
87
+
88
+ Activities other than copying, distribution and modification are not
89
+ covered by this License; they are outside its scope. The act of
90
+ running the Program is not restricted, and the output from the Program
91
+ is covered only if its contents constitute a work based on the
92
+ Program (independent of having been made by running the Program).
93
+ Whether that is true depends on what the Program does.
94
+
95
+ 1. You may copy and distribute verbatim copies of the Program's
96
+ source code as you receive it, in any medium, provided that you
97
+ conspicuously and appropriately publish on each copy an appropriate
98
+ copyright notice and disclaimer of warranty; keep intact all the
99
+ notices that refer to this License and to the absence of any warranty;
100
+ and give any other recipients of the Program a copy of this License
101
+ along with the Program.
102
+
103
+ You may charge a fee for the physical act of transferring a copy, and
104
+ you may at your option offer warranty protection in exchange for a fee.
105
+
106
+ 2. You may modify your copy or copies of the Program or any portion
107
+ of it, thus forming a work based on the Program, and copy and
108
+ distribute such modifications or work under the terms of Section 1
109
+ above, provided that you also meet all of these conditions:
110
+
111
+ a) You must cause the modified files to carry prominent notices
112
+ stating that you changed the files and the date of any change.
113
+
114
+ b) You must cause any work that you distribute or publish, that in
115
+ whole or in part contains or is derived from the Program or any
116
+ part thereof, to be licensed as a whole at no charge to all third
117
+ parties under the terms of this License.
118
+
119
+ c) If the modified program normally reads commands interactively
120
+ when run, you must cause it, when started running for such
121
+ interactive use in the most ordinary way, to print or display an
122
+ announcement including an appropriate copyright notice and a
123
+ notice that there is no warranty (or else, saying that you provide
124
+ a warranty) and that users may redistribute the program under
125
+ these conditions, and telling the user how to view a copy of this
126
+ License. (Exception: if the Program itself is interactive but
127
+ does not normally print such an announcement, your work based on
128
+ the Program is not required to print an announcement.)
129
+
130
+ These requirements apply to the modified work as a whole. If
131
+ identifiable sections of that work are not derived from the Program,
132
+ and can be reasonably considered independent and separate works in
133
+ themselves, then this License, and its terms, do not apply to those
134
+ sections when you distribute them as separate works. But when you
135
+ distribute the same sections as part of a whole which is a work based
136
+ on the Program, the distribution of the whole must be on the terms of
137
+ this License, whose permissions for other licensees extend to the
138
+ entire whole, and thus to each and every part regardless of who wrote it.
139
+
140
+ Thus, it is not the intent of this section to claim rights or contest
141
+ your rights to work written entirely by you; rather, the intent is to
142
+ exercise the right to control the distribution of derivative or
143
+ collective works based on the Program.
144
+
145
+ In addition, mere aggregation of another work not based on the Program
146
+ with the Program (or with a work based on the Program) on a volume of
147
+ a storage or distribution medium does not bring the other work under
148
+ the scope of this License.
149
+
150
+ 3. You may copy and distribute the Program (or a work based on it,
151
+ under Section 2) in object code or executable form under the terms of
152
+ Sections 1 and 2 above provided that you also do one of the following:
153
+
154
+ a) Accompany it with the complete corresponding machine-readable
155
+ source code, which must be distributed under the terms of Sections
156
+ 1 and 2 above on a medium customarily used for software interchange; or,
157
+
158
+ b) Accompany it with a written offer, valid for at least three
159
+ years, to give any third party, for a charge no more than your
160
+ cost of physically performing source distribution, a complete
161
+ machine-readable copy of the corresponding source code, to be
162
+ distributed under the terms of Sections 1 and 2 above on a medium
163
+ customarily used for software interchange; or,
164
+
165
+ c) Accompany it with the information you received as to the offer
166
+ to distribute corresponding source code. (This alternative is
167
+ allowed only for noncommercial distribution and only if you
168
+ received the program in object code or executable form with such
169
+ an offer, in accord with Subsection b above.)
170
+
171
+ The source code for a work means the preferred form of the work for
172
+ making modifications to it. For an executable work, complete source
173
+ code means all the source code for all modules it contains, plus any
174
+ associated interface definition files, plus the scripts used to
175
+ control compilation and installation of the executable. However, as a
176
+ special exception, the source code distributed need not include
177
+ anything that is normally distributed (in either source or binary
178
+ form) with the major components (compiler, kernel, and so on) of the
179
+ operating system on which the executable runs, unless that component
180
+ itself accompanies the executable.
181
+
182
+ If distribution of executable or object code is made by offering
183
+ access to copy from a designated place, then offering equivalent
184
+ access to copy the source code from the same place counts as
185
+ distribution of the source code, even though third parties are not
186
+ compelled to copy the source along with the object code.
187
+
188
+ 4. You may not copy, modify, sublicense, or distribute the Program
189
+ except as expressly provided under this License. Any attempt
190
+ otherwise to copy, modify, sublicense or distribute the Program is
191
+ void, and will automatically terminate your rights under this License.
192
+ However, parties who have received copies, or rights, from you under
193
+ this License will not have their licenses terminated so long as such
194
+ parties remain in full compliance.
195
+
196
+ 5. You are not required to accept this License, since you have not
197
+ signed it. However, nothing else grants you permission to modify or
198
+ distribute the Program or its derivative works. These actions are
199
+ prohibited by law if you do not accept this License. Therefore, by
200
+ modifying or distributing the Program (or any work based on the
201
+ Program), you indicate your acceptance of this License to do so, and
202
+ all its terms and conditions for copying, distributing or modifying
203
+ the Program or works based on it.
204
+
205
+ 6. Each time you redistribute the Program (or any work based on the
206
+ Program), the recipient automatically receives a license from the
207
+ original licensor to copy, distribute or modify the Program subject to
208
+ these terms and conditions. You may not impose any further
209
+ restrictions on the recipients' exercise of the rights granted herein.
210
+ You are not responsible for enforcing compliance by third parties to
211
+ this License.
212
+
213
+ 7. If, as a consequence of a court judgment or allegation of patent
214
+ infringement or for any other reason (not limited to patent issues),
215
+ conditions are imposed on you (whether by court order, agreement or
216
+ otherwise) that contradict the conditions of this License, they do not
217
+ excuse you from the conditions of this License. If you cannot
218
+ distribute so as to satisfy simultaneously your obligations under this
219
+ License and any other pertinent obligations, then as a consequence you
220
+ may not distribute the Program at all. For example, if a patent
221
+ license would not permit royalty-free redistribution of the Program by
222
+ all those who receive copies directly or indirectly through you, then
223
+ the only way you could satisfy both it and this License would be to
224
+ refrain entirely from distribution of the Program.
225
+
226
+ If any portion of this section is held invalid or unenforceable under
227
+ any particular circumstance, the balance of the section is intended to
228
+ apply and the section as a whole is intended to apply in other
229
+ circumstances.
230
+
231
+ It is not the purpose of this section to induce you to infringe any
232
+ patents or other property right claims or to contest validity of any
233
+ such claims; this section has the sole purpose of protecting the
234
+ integrity of the free software distribution system, which is
235
+ implemented by public license practices. Many people have made
236
+ generous contributions to the wide range of software distributed
237
+ through that system in reliance on consistent application of that
238
+ system; it is up to the author/donor to decide if he or she is willing
239
+ to distribute software through any other system and a licensee cannot
240
+ impose that choice.
241
+
242
+ This section is intended to make thoroughly clear what is believed to
243
+ be a consequence of the rest of this License.
244
+
245
+ 8. If the distribution and/or use of the Program is restricted in
246
+ certain countries either by patents or by copyrighted interfaces, the
247
+ original copyright holder who places the Program under this License
248
+ may add an explicit geographical distribution limitation excluding
249
+ those countries, so that distribution is permitted only in or among
250
+ countries not thus excluded. In such case, this License incorporates
251
+ the limitation as if written in the body of this License.
252
+
253
+ 9. The Free Software Foundation may publish revised and/or new versions
254
+ of the General Public License from time to time. Such new versions will
255
+ be similar in spirit to the present version, but may differ in detail to
256
+ address new problems or concerns.
257
+
258
+ Each version is given a distinguishing version number. If the Program
259
+ specifies a version number of this License which applies to it and "any
260
+ later version", you have the option of following the terms and conditions
261
+ either of that version or of any later version published by the Free
262
+ Software Foundation. If the Program does not specify a version number of
263
+ this License, you may choose any version ever published by the Free Software
264
+ Foundation.
265
+
266
+ 10. If you wish to incorporate parts of the Program into other free
267
+ programs whose distribution conditions are different, write to the author
268
+ to ask for permission. For software which is copyrighted by the Free
269
+ Software Foundation, write to the Free Software Foundation; we sometimes
270
+ make exceptions for this. Our decision will be guided by the two goals
271
+ of preserving the free status of all derivatives of our free software and
272
+ of promoting the sharing and reuse of software generally.
273
+
274
+ NO WARRANTY
275
+
276
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
277
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
278
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
279
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
280
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
281
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
282
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
283
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
284
+ REPAIR OR CORRECTION.
285
+
286
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
287
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
288
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
289
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
290
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
291
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
292
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
293
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
294
+ POSSIBILITY OF SUCH DAMAGES.
295
+
296
+ END OF TERMS AND CONDITIONS
297
+
298
+ How to Apply These Terms to Your New Programs
299
+
300
+ If you develop a new program, and you want it to be of the greatest
301
+ possible use to the public, the best way to achieve this is to make it
302
+ free software which everyone can redistribute and change under these terms.
303
+
304
+ To do so, attach the following notices to the program. It is safest
305
+ to attach them to the start of each source file to most effectively
306
+ convey the exclusion of warranty; and each file should have at least
307
+ the "copyright" line and a pointer to where the full notice is found.
308
+
309
+ <one line to give the program's name and a brief idea of what it does.>
310
+ Copyright (C) <year> <name of author>
311
+
312
+ This program is free software; you can redistribute it and/or modify
313
+ it under the terms of the GNU General Public License as published by
314
+ the Free Software Foundation; either version 2 of the License, or
315
+ (at your option) any later version.
316
+
317
+ This program is distributed in the hope that it will be useful,
318
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
319
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320
+ GNU General Public License for more details.
321
+
322
+ You should have received a copy of the GNU General Public License along
323
+ with this program; if not, see <https://www.gnu.org/licenses/>.
324
+
325
+ Also add information on how to contact you by electronic and paper mail.
326
+
327
+ If the program is interactive, make it output a short notice like this
328
+ when it starts in an interactive mode:
329
+
330
+ Gnomovision version 69, Copyright (C) year name of author
331
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
332
+ This is free software, and you are welcome to redistribute it
333
+ under certain conditions; type `show c' for details.
334
+
335
+ The hypothetical commands `show w' and `show c' should show the appropriate
336
+ parts of the General Public License. Of course, the commands you use may
337
+ be called something other than `show w' and `show c'; they could even be
338
+ mouse-clicks or menu items--whatever suits your program.
339
+
340
+ You should also get your employer (if you work as a programmer) or your
341
+ school, if any, to sign a "copyright disclaimer" for the program, if
342
+ necessary. Here is a sample; alter the names:
343
+
344
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
345
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
346
+
347
+ <signature of Moe Ghoul>, 1 April 1989
348
+ Moe Ghoul, President of Vice
349
+
350
+ This General Public License does not permit incorporating your program into
351
+ proprietary programs. If your program is a subroutine library, you may
352
+ consider it more useful to permit linking proprietary applications with the
353
+ library. If this is what you want to do, use the GNU Lesser General
354
+ Public License instead of this License.
@@ -0,0 +1,10 @@
1
+ # The sdist picks up README, LICENSE, pyproject.toml and tests/ on its own.
2
+ # These are the ones setuptools does not infer, and they matter: distro
3
+ # packagers build from the sdist and expect the changelog and the docs that
4
+ # the README and the source comments point at.
5
+ include CHANGELOG.md
6
+ recursive-include docs *
7
+ recursive-include examples *
8
+ recursive-include scripts *
9
+ prune docs/__pycache__
10
+ global-exclude *.py[cod] __pycache__/*
@@ -0,0 +1,285 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyguitest
3
+ Version: 0.1.0
4
+ Summary: Cross-platform GUI automation; successor to X11::GUITest
5
+ Author: Dennis K. Paulsen
6
+ License-Expression: GPL-2.0-or-later
7
+ Project-URL: homepage, https://github.com/ctrondlp/pyguitest
8
+ Project-URL: repository, https://github.com/ctrondlp/pyguitest
9
+ Project-URL: issues, https://github.com/ctrondlp/pyguitest/issues
10
+ Project-URL: documentation, https://github.com/ctrondlp/pyguitest/tree/main/docs
11
+ Project-URL: changelog, https://github.com/ctrondlp/pyguitest/blob/main/CHANGELOG.md
12
+ Keywords: gui-automation,testing,x11,wayland,accessibility,atspi
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: POSIX :: BSD :: FreeBSD
17
+ Classifier: Operating System :: POSIX
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Environment :: X11 Applications
26
+ Classifier: Topic :: Desktop Environment
27
+ Classifier: Topic :: Software Development :: Testing
28
+ Classifier: Topic :: Software Development :: Quality Assurance
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Provides-Extra: atspi
34
+ Requires-Dist: dogtail>=2.0; extra == "atspi"
35
+ Provides-Extra: x11
36
+ Requires-Dist: python-xlib>=0.33; extra == "x11"
37
+ Provides-Extra: uinput
38
+ Requires-Dist: evdev>=1.9; extra == "uinput"
39
+ Provides-Extra: eiinput
40
+ Requires-Dist: python-libei>=0.1.0; extra == "eiinput"
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest>=7; extra == "dev"
43
+ Requires-Dist: ruff>=0.6; extra == "dev"
44
+ Requires-Dist: mypy>=1.11; extra == "dev"
45
+ Requires-Dist: python-dbusmock>=0.30; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # pyguitest
49
+
50
+ Cross-platform GUI automation for Python. Successor to
51
+ [X11::GUITest](https://metacpan.org/pod/X11::GUITest).
52
+
53
+ **Status:** every capability implemented across all backends, covering
54
+ **every X11::GUITest export**. Much of it has been run against real GNOME
55
+ Wayland and X11 sessions; some of it has not, and
56
+ [docs/validation.md](docs/validation.md) says exactly which is which, so
57
+ nothing here has to be taken on trust.
58
+
59
+ ## Why the API is not a port
60
+
61
+ `docs/wayland-audit.html` classifies all 50 X11::GUITest 0.29 exports by what it
62
+ would cost to implement each on Wayland. The distribution is the finding:
63
+
64
+ | Tier | Count | Meaning |
65
+ |------|-------|---------|
66
+ | T1 Portable | 9 | No display server involved; ports unchanged |
67
+ | T2 Direct | 4 | Core Wayland protocol gives a real equivalent |
68
+ | T3 Compositor | 19 | Needs a separate backend per desktop |
69
+ | T4 Privileged | 8 | Input injection; consent or device access |
70
+ | T5 Rework | 4 | Goal survives via AT-SPI; the model does not |
71
+ | T6 No path | 6 | Deliberately prevented; dropped from the API |
72
+
73
+ Thirteen of fifty carry over unchanged. The largest block is not "impossible"
74
+ but "possible once per desktop" — window management is where a portable Wayland
75
+ implementation actually fails, and GNOME is the worst case because Mutter
76
+ implements neither foreign-toplevel protocol.
77
+
78
+ The tier scale is a *Wayland ceiling*, not an absolute one. On Wayland every
79
+ achievable capability is served and the tier-6 ones cannot exist; the X11
80
+ backend serves those too, so an X11 session gets a strictly larger capability
81
+ set through the same API. Discovering which one you are on is what
82
+ `supports()` is for.
83
+
84
+ ## Design decisions that follow
85
+
86
+ - **Capability negotiation is public API.** With 19 functions varying by
87
+ compositor, X11::GUITest's convention of returning zero on failure is
88
+ untestable — it cannot distinguish "the click missed" from "this desktop
89
+ cannot click". Every failure here is a typed exception, and callers can ask
90
+ first.
91
+ - **Speak protocols directly; adapt tools only where no protocol exists.** sway,
92
+ Hyprland and niri window control talks to their unix sockets using nothing but
93
+ the stdlib, so no tool need be installed. dogtail covers elements, python-xlib
94
+ covers X11, python-evdev covers in-process uinput; `kdotool` and the
95
+ screenshot tools stay CLI adapters because they wrap genuinely hard work.
96
+ See [ADR 001](docs/adr-001-dependencies.md) and
97
+ [ADR 002](docs/adr-002-transports.md).
98
+ - **Input tools are ranked by keymap safety.** `wdotool` and `wtype` let the
99
+ client supply a keymap; `ydotool` injects scancodes *below* the compositor, so
100
+ `type_text("Hello")` produces different characters on an AZERTY session and no
101
+ protocol reports the active layout. That ranking is encoded in `tools.py`, and
102
+ detection warns when only keymap-unsafe tools are present.
103
+ - **AT-SPI leads.** It answers what the window-tree walk was really used for,
104
+ needs neither geometry nor injection permission, and behaves identically under
105
+ X11 and Wayland — the one layer needing no backend matrix.
106
+ - **The X11 backend is a peer, not a legacy path.** It is the surest route to
107
+ the BSDs and Solaris — python-xlib speaks the wire protocol in pure Python and
108
+ assumes no kernel — and the only backend serving tier-6 capabilities at all.
109
+ Less is Linux-only than it looks: `/dev/uinput` and libei are kernel
110
+ interfaces, but compositor IPC is a unix socket and JSON, and sway, grim and
111
+ wtype are all in FreeBSD ports. Nothing here gates on the platform; nothing
112
+ off Linux is tested either.
113
+ - **Compositor IPC fills the geometry hole.** sway, Hyprland and niri report
114
+ window rectangles, which no Wayland protocol exposes — and once every rectangle is
115
+ known, hit-testing a coordinate is arithmetic rather than a compositor query.
116
+ - **No hard dependencies.** Every mechanism is probed at runtime and degrades to
117
+ an unsupported capability rather than an import error. Extras are per-backend,
118
+ so a real install is the package plus one extra.
119
+
120
+ ## Install
121
+
122
+ Requires Python 3.10 or newer. Not published yet —
123
+ `pyproject.toml` carries the `Private :: Do Not Upload` classifier, which
124
+ PyPI rejects — so for now installation is from a checkout:
125
+
126
+ ```sh
127
+ git clone https://github.com/ctrondlp/pyguitest.git
128
+ cd pyguitest
129
+ pip install . # core; no dependencies
130
+ pip install '.[atspi]' # + element automation
131
+ ```
132
+
133
+ Once published, that becomes `pip install pyguitest` and
134
+ `pip install 'pyguitest[atspi]'`. You do not need `-e`; that flag is for
135
+ developing *this package*, and is covered in
136
+ [CONTRIBUTING.md](CONTRIBUTING.md).
137
+
138
+ **None are required.** The package imports and runs with nothing else
139
+ installed. What you add depends on which backend has to serve your desktop
140
+ — extras (`atspi`, `x11`, `uinput`, `eiinput`, `dev`), a few distribution
141
+ packages pip cannot supply, and sometimes a tool on `PATH`. Rather than work
142
+ that out from a document, ask the machine:
143
+
144
+ ```sh
145
+ pyguitest doctor
146
+ ```
147
+
148
+ It detects your distribution and prints the exact commands. For the whole
149
+ picture — a per-backend requirements matrix, the distribution package table,
150
+ and how capture chooses a path — see [docs/install.md](docs/install.md).
151
+ Injecting input has its own setup (`/dev/uinput` permissions, the `ydotool`
152
+ daemon, libei, portal consent): [docs/input.md](docs/input.md).
153
+
154
+ ## Usage
155
+
156
+ ```python
157
+ import pyguitest
158
+
159
+ gui = pyguitest.connect()
160
+
161
+ # Widgets by what they are and what they are called -- the recommended way.
162
+ gui.button("OK").click()
163
+ gui.text_field("Name").set_text("Ada Lovelace")
164
+ gui.dropdown("Country").choose("Norway")
165
+
166
+ # Windows by title regex.
167
+ window = gui.find_window("Editor")
168
+
169
+ # Coordinates and keys, when you need them.
170
+ gui.move_mouse(500, 300)
171
+ gui.click()
172
+ gui.type_text("Hello")
173
+ gui.send_keys("^(a)^(c)") # Ctrl-A, Ctrl-C
174
+ ```
175
+
176
+ Matching on role and name survives the application being moved or resized,
177
+ unlike clicking at `(842, 612)`. Ask before depending on anything that varies
178
+ by desktop:
179
+
180
+ ```python
181
+ from pyguitest import Capability
182
+
183
+ if gui.supports(Capability.WINDOW_GEOMETRY):
184
+ x, y, w, h = gui.geometry(window)
185
+ ```
186
+
187
+ `connect()` never raises on a limited desktop — a session with few capabilities
188
+ is the normal case, and `supports()` is how you find out.
189
+
190
+ A session is usually several backends at once: elements from AT-SPI, injection
191
+ from a CLI adapter, capture from another. `CompositeBackend` merges their
192
+ capabilities and routes each call to whichever member provides it, so callers
193
+ see one object. `backend.providers()` shows the routing.
194
+
195
+ ### Screenshots
196
+
197
+ ```python
198
+ gui.screenshot("desktop.png") # the whole desktop
199
+ gui.screenshot("editor.png", window=window) # one window
200
+ gui.screenshot("corner.png", region=(0, 0, 400, 300))
201
+ ```
202
+
203
+ `region` is `(x, y, width, height)` in screen coordinates — the same tuple
204
+ `gui.geometry(window)` returns, on every backend. You never write a tool's
205
+ own rectangle syntax; whichever tool the session picked gets its own built
206
+ for it. `window` is served two ways, and the difference shows in the image:
207
+ under X11 the window's own pixels are read, so anything stacked on top of it
208
+ is absent; everywhere else the rectangle is looked up and cut out of a
209
+ full-screen shot, which does include whatever is covering it.
210
+ `gui.supports(Capability.WINDOW_CAPTURE)` tells you which you are getting.
211
+
212
+ **Automatically, when a test fails.** Nothing captures on its own — a
213
+ screenshot has to be taken while the failure is still propagating, because
214
+ by the time an `except:` block runs the application under test is usually
215
+ gone. Wrap the part you want documented:
216
+
217
+ ```python
218
+ with gui.capture_on_failure("artifacts"):
219
+ gui.button("Save").click()
220
+ assert gui.element(name="Saved")
221
+ ```
222
+
223
+ Nothing is written when the block succeeds. On failure the image lands in
224
+ `artifacts/` (or `$PYGUITEST_SCREENSHOT_DIR`, or the temporary directory),
225
+ its path is attached to the exception as `.screenshot`, and the original
226
+ exception is re-raised untouched, so the test runner still reports the real
227
+ failure. A screenshot that itself fails is recorded on the exception as
228
+ `.screenshot_error` and swallowed — it never replaces the failure it was
229
+ trying to document.
230
+
231
+ ## Examples
232
+
233
+ Runnable scripts in [examples/](examples/), each degrading with an
234
+ explanation when the desktop cannot do what it asks:
235
+
236
+ ```sh
237
+ python3 examples/01_what_can_i_do.py # start here
238
+ python3 examples/03_widgets.py # buttons, text boxes, dropdowns
239
+ python3 examples/06_a_real_test.py # the one to copy: a unittest suite
240
+ ```
241
+
242
+ ## Tools
243
+
244
+ ```sh
245
+ pyguitest # what this desktop can actually do
246
+ pyguitest doctor # what to install to unlock more
247
+ pyguitest debug # everything needed to diagnose a bug report
248
+ pyguitest migrate script.pl # what porting a Perl script involves
249
+ ```
250
+
251
+ All four also work as `python -m pyguitest …` without installing.
252
+
253
+ `pyguitest debug` is what to paste into a bug report: package and Python
254
+ versions, every environment probe (not only the ones that came back true),
255
+ each detected tool's own `--version`, and whether the process is running
256
+ inside a Flatpak, toolbox, or other container -- which changes what every
257
+ other probe on this list actually sees. Add `--json` for a machine-readable
258
+ form.
259
+
260
+ The migration scanner reports the tier of every X11::GUITest call in a source
261
+ file and exits non-zero if any call has no Wayland path, so a port can be gated
262
+ in CI.
263
+
264
+ ## Documentation
265
+
266
+ - [docs/install.md](docs/install.md) — what each backend needs, per
267
+ distribution, and how capture picks a path
268
+ - [docs/input.md](docs/input.md) — injecting pointer and keyboard input:
269
+ permissions, daemons, keymap safety, libei and the portal
270
+ - [docs/validation.md](docs/validation.md) — what has been run against a real
271
+ desktop, and what has not
272
+ - [docs/structure.md](docs/structure.md) — the file tree, how a call flows
273
+ through the layers, and the backend registry
274
+ - [ADR 001](docs/adr-001-dependencies.md) — why these libraries
275
+ - [ADR 002](docs/adr-002-transports.md) — why sockets replaced CLI tools
276
+ - [docs/wayland-audit.html](docs/wayland-audit.html) — the audit all of this
277
+ derives from
278
+
279
+ ## Contributing
280
+
281
+ Tests, lint, types, CI and the D-Bus suite: [CONTRIBUTING.md](CONTRIBUTING.md).
282
+
283
+ ## License
284
+
285
+ GPL-2.0-or-later. See [LICENSE](LICENSE).