Skip to content

Commit ab7d3e5

Browse files
authored
Update contribution guidelines (#5375)
- Remove Python 2 reference - Add section about type hints
1 parent 30d87e4 commit ab7d3e5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

CONTRIBUTING.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ new code. An important guideline is that the code should be clear enough that
133133
comments are generally not needed.
134134

135135
All code, including test code, must be compatible with all supported Python
136-
interpreters and versions. Most importantly this means that the code must
137-
support both Python 2 and Python 3.
136+
interpreters and versions.
138137

139138
Line length
140139
'''''''''''
@@ -174,6 +173,24 @@ internal code. When docstrings are added, they should follow `PEP-257
174173
section below for more details about documentation syntax, generating
175174
API docs, etc.
176175

176+
Type hints / Annotations
177+
''''''''''''''''''''''''
178+
179+
Keywords and functions / methods in the public api should be annotated with type hints.
180+
These annotations should follow the Python `Typing Best Practices
181+
<https://typing.python.org/en/latest/reference/best_practices.html>`_ with the
182+
following exceptions / restrictions:
183+
184+
- Annotation features are restricted to the minimum Python version supported by
185+
Robot Framework.
186+
- This means that at this time, for example, `TypeAlias` can not yet be used.
187+
- Annotations should use the stringified format for annotations not natively
188+
availabe by the minimum supported Python version. For example `'int | float'`
189+
instead of `Union[int, float]` or `'list[int]'` instead of `List[int]`.
190+
- Due to automatic type conversion by Robot Framework, `'int | float'` should not be
191+
annotated as `'float'` since this would convert any `int` argument to a `float`.
192+
- No `-> None` annotation on functions / method that do not return.
193+
177194
Documentation
178195
~~~~~~~~~~~~~
179196

0 commit comments

Comments
 (0)