robotframework-plugins 2026.11.0__py3-none-any.whl

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 (199) hide show
  1. robotframework_plugins/__init__.py +14 -0
  2. robotframework_plugins/_assets/catalog.json +143 -0
  3. robotframework_plugins/_assets/plugins/rf-agentskills/.claude-plugin/plugin.json +25 -0
  4. robotframework_plugins/_assets/plugins/rf-agentskills/CHANGELOG.md +198 -0
  5. robotframework_plugins/_assets/plugins/rf-agentskills/README.md +27 -0
  6. robotframework_plugins/_assets/plugins/rf-agentskills/catalog.yaml +25 -0
  7. robotframework_plugins/_assets/plugins/rf-api/.claude-plugin/plugin.json +25 -0
  8. robotframework_plugins/_assets/plugins/rf-api/CHANGELOG.md +9 -0
  9. robotframework_plugins/_assets/plugins/rf-api/README.md +27 -0
  10. robotframework_plugins/_assets/plugins/rf-api/catalog.yaml +27 -0
  11. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/SKILL.md +113 -0
  12. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/authentication-patterns.robot +39 -0
  13. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/basic-crud.robot +46 -0
  14. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/file-upload.robot +28 -0
  15. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/session-handling.robot +48 -0
  16. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/async-jobs.md +42 -0
  17. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/authentication.md +58 -0
  18. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/install.md +10 -0
  19. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/loose-assertions.md +20 -0
  20. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/request-options.md +90 -0
  21. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/response-validation.md +64 -0
  22. robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/troubleshooting.md +64 -0
  23. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/SKILL.md +120 -0
  24. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/basic-rest.robot +51 -0
  25. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schema-validation.robot +38 -0
  26. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schemas/user.json +10 -0
  27. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/authentication.md +61 -0
  28. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/install.md +11 -0
  29. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/json-handling.md +89 -0
  30. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/loose-assertions.md +18 -0
  31. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/migrate-from-requests.md +15 -0
  32. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/schema-validation.md +85 -0
  33. robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/troubleshooting.md +68 -0
  34. robotframework_plugins/_assets/plugins/rf-core/.claude-plugin/plugin.json +19 -0
  35. robotframework_plugins/_assets/plugins/rf-core/CHANGELOG.md +13 -0
  36. robotframework_plugins/_assets/plugins/rf-core/README.md +38 -0
  37. robotframework_plugins/_assets/plugins/rf-core/agents/rf-debug-expert.md +120 -0
  38. robotframework_plugins/_assets/plugins/rf-core/agents/rf-migration-guide.md +73 -0
  39. robotframework_plugins/_assets/plugins/rf-core/agents/rf-test-architect.md +98 -0
  40. robotframework_plugins/_assets/plugins/rf-core/catalog.yaml +19 -0
  41. robotframework_plugins/_assets/plugins/rf-core/hooks/README.md +445 -0
  42. robotframework_plugins/_assets/plugins/rf-core/hooks/hooks.json +70 -0
  43. robotframework_plugins/_assets/plugins/rf-core/scripts/_hook_input.mjs +101 -0
  44. robotframework_plugins/_assets/plugins/rf-core/scripts/_pending_errors.mjs +65 -0
  45. robotframework_plugins/_assets/plugins/rf-core/scripts/_python_env.mjs +181 -0
  46. robotframework_plugins/_assets/plugins/rf-core/scripts/check_rf_environment.mjs +181 -0
  47. robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_inject_rf_context.mjs +74 -0
  48. robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_remind_robot_tests.mjs +128 -0
  49. robotframework_plugins/_assets/plugins/rf-core/scripts/report_pending_errors.mjs +72 -0
  50. robotframework_plugins/_assets/plugins/rf-core/scripts/rf_error_hints.mjs +126 -0
  51. robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot.mjs +517 -0
  52. robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot_project.mjs +103 -0
  53. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/SKILL.md +313 -0
  54. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/api.resource +30 -0
  55. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/calc.resource +23 -0
  56. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/embedded.resource +20 -0
  57. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/keywords.resource +26 -0
  58. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/login.resource +10 -0
  59. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/01__keyword_driven.robot +15 -0
  60. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/02__data_driven.robot +10 -0
  61. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/03__templates.robot +17 -0
  62. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/04__bdd.robot +10 -0
  63. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/05__embedded.robot +13 -0
  64. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/__init__.robot +6 -0
  65. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/__init__.robot +7 -0
  66. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/users.robot +18 -0
  67. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/env.robot +15 -0
  68. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/common.py +11 -0
  69. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/dev.yaml +3 -0
  70. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/staging.yaml +3 -0
  71. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/arguments.md +139 -0
  72. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/control-structures.md +175 -0
  73. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/embedded-arguments.md +135 -0
  74. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/migration.md +90 -0
  75. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/resources-and-variable-files.md +127 -0
  76. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/styles.md +92 -0
  77. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/suites-and-init.md +96 -0
  78. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/tags-and-selection.md +104 -0
  79. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/templates.md +124 -0
  80. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/variables-and-scopes.md +129 -0
  81. robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/scripts/rf_conventions.py +883 -0
  82. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/SKILL.md +216 -0
  83. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ExampleLibrary.py +61 -0
  84. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ResultListener.py +60 -0
  85. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.py +48 -0
  86. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.robot +20 -0
  87. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/example_library.robot +31 -0
  88. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/listener.robot +12 -0
  89. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/api-variants.md +291 -0
  90. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/communication.md +248 -0
  91. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/conversion.md +347 -0
  92. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/listeners.md +150 -0
  93. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/packaging-and-docs.md +155 -0
  94. robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/scripts/check_library.py +842 -0
  95. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/SKILL.md +159 -0
  96. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/github-actions-robot.yml +32 -0
  97. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/gitignore.txt +22 -0
  98. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.poetry.toml +28 -0
  99. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.uv.toml +20 -0
  100. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/requirements.txt +9 -0
  101. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/robot.toml +16 -0
  102. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/smoke.robot +22 -0
  103. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/ci.md +61 -0
  104. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/cli-tools.md +33 -0
  105. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/libraries.md +47 -0
  106. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/poetry.md +77 -0
  107. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/project-layout.md +86 -0
  108. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/troubleshooting.md +73 -0
  109. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/uv.md +108 -0
  110. robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/venv-pip.md +71 -0
  111. robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-debug-expert.toml +119 -0
  112. robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-migration-guide.toml +72 -0
  113. robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-test-architect.toml +97 -0
  114. robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-debug-expert.md +123 -0
  115. robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-migration-guide.md +76 -0
  116. robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-test-architect.md +101 -0
  117. robotframework_plugins/_assets/plugins/rf-core/variants/opencode/plugins/rf-core.js +93 -0
  118. robotframework_plugins/_assets/plugins/rf-desktop/.claude-plugin/plugin.json +24 -0
  119. robotframework_plugins/_assets/plugins/rf-desktop/CHANGELOG.md +10 -0
  120. robotframework_plugins/_assets/plugins/rf-desktop/README.md +26 -0
  121. robotframework_plugins/_assets/plugins/rf-desktop/catalog.yaml +23 -0
  122. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/SKILL.md +268 -0
  123. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot +45 -0
  124. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot +33 -0
  125. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/cli-and-inspector.md +82 -0
  126. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/install.md +14 -0
  127. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md +102 -0
  128. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/locators-and-queries.md +95 -0
  129. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md +65 -0
  130. robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md +41 -0
  131. robotframework_plugins/_assets/plugins/rf-mobile/.claude-plugin/plugin.json +24 -0
  132. robotframework_plugins/_assets/plugins/rf-mobile/CHANGELOG.md +9 -0
  133. robotframework_plugins/_assets/plugins/rf-mobile/README.md +26 -0
  134. robotframework_plugins/_assets/plugins/rf-mobile/catalog.yaml +23 -0
  135. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/SKILL.md +134 -0
  136. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/android-basic.robot +60 -0
  137. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/gestures-example.robot +59 -0
  138. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/hybrid-app.robot +54 -0
  139. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/ios-basic.robot +48 -0
  140. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/capabilities.md +117 -0
  141. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/gestures-touch.md +84 -0
  142. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/install.md +21 -0
  143. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/locators-mobile.md +74 -0
  144. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/platform-specific.md +105 -0
  145. robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/troubleshooting.md +70 -0
  146. robotframework_plugins/_assets/plugins/rf-web/.claude-plugin/plugin.json +25 -0
  147. robotframework_plugins/_assets/plugins/rf-web/CHANGELOG.md +9 -0
  148. robotframework_plugins/_assets/plugins/rf-web/README.md +27 -0
  149. robotframework_plugins/_assets/plugins/rf-web/catalog.yaml +27 -0
  150. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/SKILL.md +134 -0
  151. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/authentication-flow.robot +34 -0
  152. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/basic-web-test.robot +29 -0
  153. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/form-handling.robot +49 -0
  154. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/iframe-shadow-dom.robot +31 -0
  155. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/assertion-engine.md +79 -0
  156. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/authentication-storage.md +86 -0
  157. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/browser-context-page.md +110 -0
  158. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/downloads-uploads.md +51 -0
  159. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/iframes-shadow-dom.md +67 -0
  160. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/install.md +67 -0
  161. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/locators.md +83 -0
  162. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/migrate-from-selenium.md +22 -0
  163. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/selector-drift.md +29 -0
  164. robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/troubleshooting.md +100 -0
  165. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/SKILL.md +123 -0
  166. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/basic-web-test.robot +64 -0
  167. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/multi-window.robot +55 -0
  168. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/wait-patterns.robot +53 -0
  169. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/browser-setup.md +103 -0
  170. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/frames-windows.md +84 -0
  171. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/install.md +12 -0
  172. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/javascript-execution.md +65 -0
  173. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/locators.md +86 -0
  174. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/troubleshooting.md +122 -0
  175. robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/waiting-strategies.md +84 -0
  176. robotframework_plugins/_assets.py +120 -0
  177. robotframework_plugins/_catalog.py +123 -0
  178. robotframework_plugins/_snapshot.py +320 -0
  179. robotframework_plugins/adapters/__init__.py +53 -0
  180. robotframework_plugins/adapters/_base.py +400 -0
  181. robotframework_plugins/adapters/claude_code.py +312 -0
  182. robotframework_plugins/adapters/claude_desktop.py +129 -0
  183. robotframework_plugins/adapters/codex.py +276 -0
  184. robotframework_plugins/adapters/copilot.py +87 -0
  185. robotframework_plugins/adapters/cursor.py +295 -0
  186. robotframework_plugins/adapters/goose.py +240 -0
  187. robotframework_plugins/adapters/opencode.py +170 -0
  188. robotframework_plugins/bundle.py +85 -0
  189. robotframework_plugins/cli.py +1311 -0
  190. robotframework_plugins/detect.py +121 -0
  191. robotframework_plugins/manifest.py +338 -0
  192. robotframework_plugins/py.typed +0 -0
  193. robotframework_plugins/skillzip.py +39 -0
  194. robotframework_plugins/transforms.py +725 -0
  195. robotframework_plugins-2026.11.0.dist-info/METADATA +198 -0
  196. robotframework_plugins-2026.11.0.dist-info/RECORD +199 -0
  197. robotframework_plugins-2026.11.0.dist-info/WHEEL +4 -0
  198. robotframework_plugins-2026.11.0.dist-info/entry_points.txt +2 -0
  199. robotframework_plugins-2026.11.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: rf-python-library
3
+ description: "Use first, before answering, to write or fix Robot Framework keyword libraries or listeners in Python."
4
+ license: Apache-2.0
5
+ compatibility: "Requires Python 3.10+ with robotframework>=7 in the project environment for the bundled check_library script, and robotcode[all]>=2.8 there for keyword listing and static checks; guidance is version-gated from RF 6.1 to 7.5 and the examples need RF 7.0+."
6
+ metadata:
7
+ author: manykarim
8
+ version: "1.0.0"
9
+ ---
10
+
11
+ # Robot Framework Python Library
12
+
13
+ Writing and fixing keyword libraries and listeners in Python: the default library shape, scope, argument conversion, failures, logging and the checks that catch Robot Framework-specific defects before a test runs.
14
+ Tests, user keywords and `.resource` files belong to rf-language; using an existing library (Browser, RequestsLibrary, …) belongs to that library's skill.
15
+ Rule of thumb: logic goes into Python, composition of existing keywords into a user keyword.
16
+
17
+ ## When to use
18
+
19
+ Load this skill first, before exploring the project, reading or creating .py files, or answering from memory, when Robot Framework keywords, libraries or listeners are written in Python:
20
+
21
+ - a new keyword library (around an API, database or device client), `@keyword` and `@library` decorators;
22
+ - `ROBOT_LIBRARY_SCOPE` and state kept between tests (a library that loses its state, a connection scope);
23
+ - argument conversion from type hints (Enum, Literal, custom converters), failures and logging via `robot.api`, libdoc docs;
24
+ - a library that "contains no keywords";
25
+ - a listener that reacts to or reports results (chat, dashboards).
26
+
27
+ Not this skill: keywords in .robot/.resource files use `rf-language`; using an existing library such as Browser or RequestsLibrary uses its library skill.
28
+
29
+ ## Quick reference and version gate
30
+
31
+ Check the version in the project environment first (`robot --version` exits 251 even on success):
32
+
33
+ ```bash
34
+ uv run python -c "import robot; print(robot.__version__)"
35
+ ```
36
+
37
+ | Feature | Min RF |
38
+ |---|---|
39
+ | `async def` keywords, `BuiltIn().dry_run_active` | 6.1 |
40
+ | `Literal` conversion, embedded plus normal arguments in one library keyword, listener API v3 as the default | 7.0 |
41
+ | `ROBOT_LISTENER_PRIORITY` | 7.1 |
42
+ | `@library` selects the decorated class in a module whose name differs | 7.2 |
43
+ | `robot.errors.TimeoutExceeded` (named `TimeoutError` before 7.3) | 7.3 |
44
+ | `Secret` (`robot.api.types`) and `object` type hints | 7.4 |
45
+ | Markdown doc format (`doc_format="MARKDOWN"`); RF timeouts no longer derive from `Exception` | 7.5 |
46
+
47
+ ## Default library template
48
+
49
+ Save it as `libraries/<Name>.py`; the class name equals the file name.
50
+
51
+ ```python
52
+ # file: MyLibrary.py
53
+ """Keywords for <what the library does>."""
54
+
55
+ from enum import Enum
56
+
57
+ from robot.api import logger
58
+ from robot.api.deco import keyword, library
59
+
60
+
61
+ class Mode(Enum):
62
+ ON = "ON"
63
+ OFF = "OFF"
64
+
65
+
66
+ # scope: pick it by how long the library state must live (scope table below).
67
+ @library(scope="TEST", version="0.1.0")
68
+ class MyLibrary:
69
+ """One-line summary: libdoc shows it as the library introduction.
70
+
71
+ Import: ``Library MyLibrary timeout=5``.
72
+ """
73
+
74
+ def __init__(self, timeout: float = 5.0) -> None:
75
+ self._timeout = timeout # state is set here only
76
+
77
+ @keyword
78
+ def set_mode(self, mode: Mode) -> str:
79
+ """Switch the mode; ``on`` and ``off`` are accepted case-insensitively.
80
+
81
+ Args:
82
+ mode: ``ON`` or ``OFF``.
83
+ """
84
+ logger.info(f"mode {mode.name}, timeout {self._timeout}")
85
+ return mode.name
86
+
87
+ @keyword
88
+ def value_should_be(self, actual: int, expected: int) -> None:
89
+ """Fail unless ``actual`` equals ``expected``."""
90
+ if actual != expected:
91
+ raise AssertionError(f"expected {expected}, got {actual}")
92
+ ```
93
+
94
+ Why each part: `@library` turns off automatic discovery, so only `@keyword` methods become keywords; type hints drive argument conversion and libdoc; the docstring's first line is the short doc; `AssertionError` marks a verification failure; `robot.api.logger` writes to the log.
95
+
96
+ ## Decisions
97
+
98
+ **Module or class**
99
+
100
+ | Library needs | Use |
101
+ |---|---|
102
+ | A few stateless functions | Module library; set `ROBOT_AUTO_KEYWORDS = False` and decorate keywords with `@keyword`, so imported names do not become keywords |
103
+ | State, init arguments, converters or a listener | Class library with `@library` (the template) |
104
+
105
+ **Library scope** (Robot Framework User Guide, "Creating test libraries" → "Library scope"). Choose by how long the state must live:
106
+
107
+ | State must live … | Scope | Note |
108
+ |---|---|---|
109
+ | per test, or must not leak between tests | `TEST` (default) | a new instance for every test keeps tests independent; suite setup and teardown share another instance |
110
+ | across the tests of one suite (client, connection, accumulated data) | `SUITE` | a new instance per suite; add a cleanup keyword (`Clear …`) for a suite setup or teardown |
111
+ | across suites for the whole run (one browser or session) | `GLOBAL` | one instance for the run; add a cleanup keyword (`Close All …`); module libraries are always global |
112
+ | no state at all | any; `GLOBAL` avoids needless instances | a stateless library does not need new instances |
113
+
114
+ Importing the same library with different arguments creates a new instance regardless of scope; give each import a name with `AS`.
115
+
116
+ **Static, hybrid or dynamic API**
117
+
118
+ | Situation | API |
119
+ |---|---|
120
+ | Normal library | Static: methods are keywords (the template) |
121
+ | Keyword names computed at runtime, implementations are real methods | Hybrid: `get_keyword_names` |
122
+ | Proxy to another tool or process, or keywords generated from a spec | Dynamic: `get_keyword_names` + `run_keyword`; PythonLibCore helps compose large libraries |
123
+
124
+ **Failures and logging**
125
+
126
+ | Want | Use |
127
+ |---|---|
128
+ | Verification failed | `AssertionError` (or `robot.api.Failure`) |
129
+ | Fail but continue the test | `robot.api.ContinuableFailure` |
130
+ | Mark the test skipped | `robot.api.SkipExecution` |
131
+ | Stop the whole run | `robot.api.FatalError` |
132
+ | Keyword used incorrectly | `ValueError` / `robot.api.Error` |
133
+ | Log for the report | `logger.info` / `logger.debug`; `html=True` for HTML; `logger.warn` for warnings |
134
+ | Show progress on the console | `logger.console` |
135
+
136
+ ## Placement and import
137
+
138
+ Project libraries live in `libraries/` on the python-path that rf-setup's project layout defines, and are imported by name:
139
+
140
+ ```toml
141
+ # robot.toml
142
+ python-path = ["resources", "libraries"]
143
+ ```
144
+
145
+ ```robotframework
146
+ *** Settings ***
147
+ Library MyLibrary timeout=10
148
+ Library MyLibrary timeout=60 AS SlowLibrary
149
+ ```
150
+
151
+ Plain `robot` needs `--pythonpath libraries`. Import by name, not by a relative `../libraries/X.py` path, so the same import works from every suite. Add third-party runtime dependencies with the project's tool (`uv add <package>`; see rf-setup).
152
+
153
+ ## Agent workflow
154
+
155
+ 1. Check the version: `uv run python -c "import robot; print(robot.__version__)"`, then use only features from the gate table.
156
+ 2. Write or edit `libraries/<Name>.py` from the template; pick the scope from the scope table.
157
+ 3. Run the checker and fix every `error` and `warning` finding (or state why one stays). It runs the library's import and `__init__` code, so use it on your own project libraries only:
158
+
159
+ ```bash
160
+ uv run python "${CLAUDE_SKILL_DIR}/scripts/check_library.py" libraries/<Name>.py
161
+ ```
162
+
163
+ 4. List the keyword names the tests will call: `uv run robotcode doc keywords libraries/<Name>.py` (one keyword in full: `uv run robotcode doc keyword libraries/<Name>.py "<Keyword>"`).
164
+ 5. Pure Python logic with branches gets pytest unit tests.
165
+ 6. `uv run robotcode analyze code tests/` on the suites that import the library (with `libraries` on the python-path in `robot.toml`). It finds unknown keywords and wrong argument counts without running anything, so it misses variables set at run time, named-argument typos, embedded-argument mismatches and `str` in unions; the real run in step 7 catches them.
166
+ 7. `uv run robot --pythonpath libraries --outputdir results tests/` (or `uv run robotcode robot` with the `robot.toml` python-path); on failure rerun with `--loglevel DEBUG` for tracebacks and read the results with `uv run robotcode results show --failed` and `uv run robotcode results log --failed`.
167
+ 8. Fix and go back to step 3.
168
+
169
+ The script path is relative to this skill's directory; library paths are relative to the project root. More checker calls:
170
+
171
+ ```bash
172
+ uv run python "${CLAUDE_SKILL_DIR}/scripts/check_library.py" libraries/*.py --pretty
173
+ uv run python "${CLAUDE_SKILL_DIR}/scripts/check_library.py" Client --init-arg https://staging.example.com --pythonpath libraries
174
+ uv run python "${CLAUDE_SKILL_DIR}/scripts/check_library.py" libraries/Inventory.py --json-out results/check_library.json
175
+ ```
176
+
177
+ Not using uv? Run the same commands with `.venv/bin/python` or `poetry run python` instead of `uv run python`; see rf-setup.
178
+
179
+ The JSON lists per library the scope, API style and keywords with arguments, plus findings (`id`, `severity`, `keyword`, `message`, `hint`), errors first. Exit 0 means checked (findings do not change it); 4 means the input is outside the project root or no library loaded (stderr has the error line and a hint); 3 means Robot Framework is missing from the interpreter.
180
+
181
+ ## Gotchas
182
+
183
+ - `@library` disables automatic keyword discovery: a public method without `@keyword` is silently not a keyword (→ `public_method_not_keyword`); mark helpers `@not_keyword` or prefix them with `_`.
184
+ - Functions imported into a module library, and public base-class methods, become keywords: `from os.path import join` adds `Join` (→ `leaked_keyword`). Import modules (`import os`) or use `ROBOT_AUTO_KEYWORDS = False`.
185
+ - The default `TEST` scope creates a new instance for every test, by design, so tests stay independent: a counter or cache set in one test is gone in the next (→ `state_in_test_scope`). State that must span tests needs `SUITE` or `GLOBAL` plus a cleanup keyword. `__init__` also runs during libdoc and `--dryrun`, so it must not connect anywhere unguarded (→ `output_during_import`).
186
+ - An inline type in a library embedded-argument name, `@keyword("Take ${qty: int} pears")`, makes RF 7.3+ reject the keyword, and the library then "contains no keywords" (→ `keyword_creation_failed`, `no_keywords`; before 7.3, `: int` is read as a regex and the keyword never matches). Put the type on the Python argument: `def take(self, qty: int)`.
187
+ - A union that contains `str`, such as `int | str`, never converts a string argument: `"10"` stays a string (→ `union_with_str`). Drop `str` or convert explicitly.
188
+ - Implicit typing from defaults is lenient: `def kw(n=3)` passes `abc` through as a string (not detected). Use real type hints.
189
+ - `bool` conversion passes unknown strings through: `flag: bool` with `maybe` gives the string `maybe` (not detected). Use `Literal` or an `Enum` when only fixed values are valid.
190
+ - Positional-only arguments (`def kw(a, /)`) cannot be passed by name: `a=1` arrives as the string `a=1` (→ `positional_only_argument`).
191
+ - A broad `except Exception:` swallows Robot Framework timeouts before RF 7.5 (they derive from `Exception` until then) (→ `broad_except`). Catch specific exceptions, or re-raise `robot.errors.TimeoutExceeded`.
192
+ - Logging or raising from a non-main thread is silently dropped from the log (not detected). Collect results in the thread and log them from the keyword's own thread.
193
+ - A decorator without `functools.wraps` hides the signature: the keyword takes only `*args, **kwargs` and loses conversion (→ `signature_lost`). Add `@functools.wraps(func)` to the wrapper.
194
+ - Listener methods (`end_test`, `close`, …) on a class that is also a library become keywords unless the class uses `@library(listener="SELF")` (→ `listener_method_exposed`).
195
+ - Importing the same library twice with different arguments needs `AS` names, otherwise the second import is ignored with a warning (not detected; it lives in `.robot` data).
196
+
197
+ ## When to read the references
198
+
199
+ | Read | When |
200
+ |---|---|
201
+ | `references/conversion.md` | Choosing argument types: built-ins, Enum, Literal, TypedDict, containers, unions, `Secret`, custom converters |
202
+ | `references/api-variants.md` | Module vs class details, scope and init arguments, embedded arguments, async, hybrid and dynamic APIs, PythonLibCore, Remote |
203
+ | `references/listeners.md` | Writing a listener (API v3), a library that is also a listener, listener priority, changing results |
204
+ | `references/communication.md` | Exceptions, HTML messages, logging levels, threads, timeouts, calling BuiltIn from a library |
205
+ | `references/packaging-and-docs.md` | libdoc output, doc formats, versioning, packaging a library with resources, tests for a library |
206
+
207
+ The runnable examples in `assets/examples/` (`ExampleLibrary.py`, `converters.py`, `ResultListener.py` and their suites) pass with `uv run robot --pythonpath assets/examples --listener ResultListener assets/examples`.
208
+
209
+ ## Companion Skills
210
+
211
+ | Need | Skill |
212
+ |------|-------|
213
+ | Write tests, suites, user keywords, resources and variables in Robot Framework syntax | `rf-language` |
214
+ | Install Robot Framework or a library, fix the environment | `rf-setup` |
215
+
216
+ For running, discovering, keyword documentation, result analysis and debugging with the robotcode CLI, use the `robotcode` skill of the robotcode plugin (`robotcode@robotframework-agent-plugins`); the commands above work without it.
@@ -0,0 +1,61 @@
1
+ """Example keyword library for the rf-python-library skill (RF 7.0+).
2
+
3
+ The default template applied to an in-memory inventory. The tests of one suite
4
+ share the stock, so the library uses ``SUITE`` scope (see the scope table in
5
+ SKILL.md) and offers `Clear Inventory` for a suite setup or teardown.
6
+ """
7
+
8
+ from typing import Literal
9
+
10
+ from robot.api import logger
11
+ from robot.api.deco import keyword, library
12
+
13
+
14
+ @library(scope="SUITE", version="1.0.0")
15
+ class ExampleLibrary:
16
+ """Keeps an in-memory inventory that the tests of one suite share.
17
+
18
+ Import it with an optional unit: ``Library ExampleLibrary unit=boxes``.
19
+ Call `Clear Inventory` in a suite setup or teardown to start from an empty stock.
20
+ """
21
+
22
+ def __init__(self, unit: str = "pcs") -> None:
23
+ self._unit = unit
24
+ self._stock: dict[str, int] = {}
25
+ self._mode = "OFF"
26
+
27
+ @keyword
28
+ def add_item(self, name: str, quantity: int = 1) -> int:
29
+ """Add ``quantity`` items called ``name`` and return the new count.
30
+
31
+ Args:
32
+ name: Item name, for example ``apple``.
33
+ quantity: Number of items to add; must be positive.
34
+
35
+ Example:
36
+ | ${count}= Add Item apple 3
37
+ """
38
+ if quantity < 1:
39
+ raise ValueError(f"quantity must be positive, got {quantity}")
40
+ self._stock[name] = self._stock.get(name, 0) + quantity
41
+ logger.info(f"{name}: {self._stock[name]} {self._unit}")
42
+ return self._stock[name]
43
+
44
+ @keyword
45
+ def item_count_should_be(self, name: str, expected: int) -> None:
46
+ """Fail unless ``name`` has exactly ``expected`` items."""
47
+ actual = self._stock.get(name, 0)
48
+ if actual != expected:
49
+ raise AssertionError(f"{name}: expected {expected} {self._unit}, got {actual}")
50
+
51
+ @keyword
52
+ def set_mode(self, mode: Literal["ON", "OFF"]) -> str:
53
+ """Switch the inventory mode. ``on``/``off`` are accepted case-insensitively."""
54
+ self._mode = mode
55
+ return self._mode
56
+
57
+ @keyword
58
+ def clear_inventory(self) -> None:
59
+ """Remove every item. Use it in a suite setup or teardown."""
60
+ self._stock.clear()
61
+ self._mode = "OFF"
@@ -0,0 +1,60 @@
1
+ """Listener API v3 example (RF 7.0+): write a JSON summary of the run.
2
+
3
+ Use it as a plain listener:
4
+
5
+ robot --pythonpath libraries --listener ResultListener tests/
6
+ robot --pythonpath libraries --listener ResultListener:summary.json tests/
7
+
8
+ It records every finished test and writes ``<output dir>/<file>`` when the run
9
+ closes. To post the summary to a chat or webhook instead, send ``summary`` from
10
+ ``close`` (keep secrets in environment variables, never in the file).
11
+
12
+ The class is also a valid library (``@library(listener="SELF")``): imported
13
+ with ``Library ResultListener`` it listens to the suite that imports it and
14
+ offers the `Result Summary` keyword. Do not use both forms in the same run.
15
+ """
16
+
17
+ import json
18
+ from pathlib import Path
19
+
20
+ from robot.api.deco import keyword, library
21
+ from robot.libraries.BuiltIn import BuiltIn
22
+
23
+
24
+ @library(scope="GLOBAL", listener="SELF")
25
+ class ResultListener:
26
+ """Records test results and writes them as JSON when the run closes."""
27
+
28
+ ROBOT_LISTENER_API_VERSION = 3
29
+
30
+ def __init__(self, filename: str = "result-summary.json") -> None:
31
+ self._filename = filename
32
+ self._outdir: str | None = None
33
+ self._tests: list[dict[str, str]] = []
34
+
35
+ def start_suite(self, data, result) -> None:
36
+ if self._outdir is None:
37
+ self._outdir = BuiltIn().get_variable_value("${OUTPUT DIR}")
38
+
39
+ def end_test(self, data, result) -> None:
40
+ self._tests.append({"name": result.full_name, "status": result.status, "message": result.message})
41
+
42
+ def close(self) -> None:
43
+ if self._outdir:
44
+ path = Path(self._outdir) / self._filename
45
+ path.write_text(json.dumps(self._summary(), indent=2), encoding="utf-8")
46
+
47
+ def _summary(self) -> dict:
48
+ statuses = [t["status"] for t in self._tests]
49
+ return {
50
+ "total": len(statuses),
51
+ "passed": statuses.count("PASS"),
52
+ "failed": statuses.count("FAIL"),
53
+ "skipped": statuses.count("SKIP"),
54
+ "failed_tests": [t for t in self._tests if t["status"] == "FAIL"],
55
+ }
56
+
57
+ @keyword
58
+ def result_summary(self) -> dict:
59
+ """Return the summary of the tests finished so far (when used as a library listener)."""
60
+ return self._summary()
@@ -0,0 +1,48 @@
1
+ """Custom argument converter example (RF 7.0+): ``Money`` from ``12.50 EUR``.
2
+
3
+ A module library. ``ROBOT_AUTO_KEYWORDS = False`` keeps the imported names
4
+ (``dataclass``, ``Decimal``) and the converter function from becoming keywords;
5
+ only ``@keyword`` functions are exposed.
6
+ """
7
+
8
+ from dataclasses import dataclass
9
+ from decimal import Decimal, InvalidOperation
10
+
11
+ from robot.api.deco import keyword
12
+
13
+ ROBOT_AUTO_KEYWORDS = False
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class Money:
18
+ """An amount of money in one currency."""
19
+
20
+ amount: Decimal
21
+ currency: str
22
+
23
+
24
+ def parse_money(value: str) -> Money:
25
+ """Convert ``'12.50 EUR'`` to ``Money``; raise ``ValueError`` on bad input."""
26
+ try:
27
+ amount, currency = value.split()
28
+ return Money(Decimal(amount), currency.upper())
29
+ except (ValueError, InvalidOperation):
30
+ raise ValueError(f"expected '<amount> <currency>' like '12.50 EUR', got '{value}'") from None
31
+
32
+
33
+ ROBOT_LIBRARY_CONVERTERS = {Money: parse_money}
34
+
35
+
36
+ @keyword
37
+ def add_prices(first: Money, second: Money) -> Money:
38
+ """Add two prices in the same currency, for example ``12.50 EUR`` and ``7.50 EUR``."""
39
+ if first.currency != second.currency:
40
+ raise ValueError(f"currency mismatch: {first.currency} and {second.currency}")
41
+ return Money(first.amount + second.amount, first.currency)
42
+
43
+
44
+ @keyword
45
+ def price_should_be(actual: Money, expected: Money) -> None:
46
+ """Fail unless ``actual`` equals ``expected`` (a ``Money`` or a string such as ``20 EUR``)."""
47
+ if actual != expected:
48
+ raise AssertionError(f"price {actual.amount} {actual.currency} != {expected.amount} {expected.currency}")
@@ -0,0 +1,20 @@
1
+ *** Settings ***
2
+ Documentation Custom argument converter (RF 7.0+): strings such as "12.50 EUR"
3
+ ... become Money objects before the keyword runs.
4
+ ... Run: robot --pythonpath assets/examples assets/examples/converters.robot
5
+ Library converters
6
+
7
+
8
+ *** Test Cases ***
9
+ Strings Are Converted To Money
10
+ ${total}= Add Prices 12.50 EUR 7.50 eur
11
+ Price Should Be ${total} 20.00 EUR
12
+
13
+ Returned Money Is Passed Through Unchanged
14
+ ${total}= Add Prices 1 EUR 2 EUR
15
+ ${again}= Add Prices ${total} 0 EUR
16
+ Price Should Be ${again} 3 EUR
17
+
18
+ Bad Input Fails With The Converter Message
19
+ Run Keyword And Expect Error *expected '<amount> <currency>'*
20
+ ... Add Prices twelve 1 EUR
@@ -0,0 +1,31 @@
1
+ *** Settings ***
2
+ Documentation ExampleLibrary in use (RF 7.0+). The stock is shared by the tests
3
+ ... of this suite (SUITE scope); the suite teardown clears it.
4
+ ... Run: robot --pythonpath assets/examples assets/examples/example_library.robot
5
+ Library ExampleLibrary unit=boxes
6
+ Suite Setup Clear Inventory
7
+ Suite Teardown Clear Inventory
8
+
9
+
10
+ *** Test Cases ***
11
+ Add Items
12
+ ${count}= Add Item apple 3
13
+ Should Be Equal ${count} ${3}
14
+
15
+ Stock Survives Between Tests
16
+ Add Item apple 2
17
+ Item Count Should Be apple 5
18
+
19
+ Count Mismatch Fails With A Clear Message
20
+ Run Keyword And Expect Error apple: expected 1 boxes, got 5
21
+ ... Item Count Should Be apple 1
22
+
23
+ Mode Accepts Lower Case
24
+ ${mode}= Set Mode on
25
+ Should Be Equal ${mode} ON
26
+
27
+ Invalid Mode Is Rejected By Conversion
28
+ Run Keyword And Expect Error *'ON'*'OFF'* Set Mode maybe
29
+
30
+ Quantity Is Converted To An Integer
31
+ Run Keyword And Expect Error *cannot be converted to integer* Add Item pear many
@@ -0,0 +1,12 @@
1
+ *** Settings ***
2
+ Documentation Run with the example listener (RF 7.0+):
3
+ ... robot --pythonpath assets/examples --listener ResultListener assets/examples/listener.robot
4
+ ... It writes result-summary.json into the output directory when the run closes.
5
+
6
+
7
+ *** Test Cases ***
8
+ Passing Test
9
+ Should Be Equal ${{ 1 + 1 }} ${2}
10
+
11
+ Skipped Test
12
+ Skip Skipped tests are counted separately in the summary