You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Came here looking for this. I'd been experimenting with custom argument converters and was disappointed to see that they aren't invoked for standard keywords because there are no type hints. Am I correct in assuming that this would correct that?
@twbecker Standard libraries predate all automatic argument conversion support so they needed to implement their own argument conversion. All that custom code can be removed when we add type hints, but that probably doesn't bring any concrete benefits for normal users. Libdoc documentation getting better is nice, though.
In order to get RF 7.3 out soon, I move this issue to RF 7.4 scope. It would still be possible to add type hints to some library or libraries in RF 7.3, though. My plan is to get RF 7.3 release candidate out early next week and that's a deadline for all code changes (which includes annotations). Are there any libraries you'd like to work on in that time frame @robinmackaij? If there are, please submit separate issues for each library and I can add them to RF 7.3 scope.
Are there any libraries you'd like to work on in that time frame @robinmackaij? If there are, please submit separate issues for each library and I can add them to RF 7.3 scope.
I need to work on training-related material at the moment and I also need to work towards an OpenApiTools release, so I have little time to work on this atm. It'd be good to get the sub-issues in the tracker when 7.3 is out, then it's easier to keep track and create the PRs (especially if there's others interested in contributing to this and we need to coordinate on the effort).
Some keywords accepting configuration parameters as **config instead of named-only arguments makes adding type hints to them annoying. The reason to use **config is Python 2 support, so these keywords can be updated. I submitted #5412 about that and try to get it done still in RF 7.3 timeline.
provide param str | bytes args where possible (i have to check for each parameter, if the functions in the keyword can also be called on a buytes objects - no quick job)
add tests too (i hope this will not take forever, will only include basics)
(no code changes to add bytes support (stay with str))
Literal support (see DateTime)
Adding a note like "Some keywords also work with bytes in addition to strings."
I also implemnted typing for diaglogs but forgot to push it. Even if it seemed to be quiet easy/straigt forward, there was a problem in atests (manuel GUI dialog tests). Something seemed incorrect there. If I remember correctly, some value in a diaglog that should have been hidden was exposed, or the other way around? Maybe you could double check that. :)
my old changes/commit: silentw0lf@e206cc0
(but maybe I just did something incorrectly for implementation)
by reading through our discussions above, I see the the following tasks:
Remove check within function that test differnt type (than in param, andthen raise) + there tests[x] remove @keyword(types=None) since types provided* [ ] backwards compatibility (potentially > 30 functions)
provide param str | bytes args where possible (i have to check for each parameter, if the functions in the keyword can also be called on a buytes objects - no quick job)* add tests too (i hope this will not take forever, will only include basics)* (no code changes to add bytes support (stay with str))[x] Literal support (see DateTime)[ ] Adding a note like "Some keywords also work with bytes in addition to strings."
@pekkaklarck) I have implemented the tasks as far as I can. Problems remain with bytes support. Where I couldn't make a decision myself, I added a TODO(@pekkaklarck) to the functions with information.
The problem concerns backwards compatibility for keywords. Either
[1] You allow bytes—then a test function must truly support it (which is particularly difficult when there are 2-3 parameters that can each be either bytes or str influencing each other during code paths; in many cases that's simply not possible -> high risk for bugs).
[2] You don't allow bytes, because you can't support all parameter combinations—however, this would break older Robot versions if a user happened to use the one parameter combination that used to work (other type combinations would also then not work).
[3] Where bytes can't be safely introduced 100%, we can leave it as str, and there will be a few special cases where backwards compatibility cannot be maintained.
Could you perhaps adjust the remaining places according to your preferences in the MR?
Otherwise, I think the discussions will drag on for a long time back and forth, even though the implementation is already 95% finished.
local latests and utests PASS but there is some empty error porblem in the pipeline:
Quick comments about String and other topics mentioned above.
I created a dedicated issue (Add annotations to String #5558) for String typing. Could you @silentw0lf list the open design decisions and other issues there so that we don't flood this main issue with String related comments. Sub-issues have turned out to be pretty useful!
@silentw0lf, I reviewed this String PR. Do you have idea when you'd have time to look at the comments? I'd like to get the PR closed soonish so that I can finish #5537 and #5548 that are dependent on it.
String got typing in PR #5554 by @silentw0lf. Thanks for the contribution!
String typing may still change as part of #5548, but the library now has typing so I closed #5558. Now all libraries that we wanted to add typing have them, so also this issue can be finally closed.
Thanks all who participated! I knew this was going to be a big task, but it turned out to be even bigger than I anticipated. Had I known how much work this is, I'd probably moved this to RF 7.5 or only covered some libraries now. Anyway, the results are good so we should be proud!
Activity
twbecker commentedon Mar 20, 2025
Came here looking for this. I'd been experimenting with custom argument converters and was disappointed to see that they aren't invoked for standard keywords because there are no type hints. Am I correct in assuming that this would correct that?
pekkaklarck commentedon Mar 27, 2025
@twbecker Standard libraries predate all automatic argument conversion support so they needed to implement their own argument conversion. All that custom code can be removed when we add type hints, but that probably doesn't bring any concrete benefits for normal users. Libdoc documentation getting better is nice, though.
pekkaklarck commentedon Apr 7, 2025
In order to get RF 7.3 out soon, I move this issue to RF 7.4 scope. It would still be possible to add type hints to some library or libraries in RF 7.3, though. My plan is to get RF 7.3 release candidate out early next week and that's a deadline for all code changes (which includes annotations). Are there any libraries you'd like to work on in that time frame @robinmackaij? If there are, please submit separate issues for each library and I can add them to RF 7.3 scope.
robinmackaij commentedon Apr 7, 2025
I need to work on training-related material at the moment and I also need to work towards an OpenApiTools release, so I have little time to work on this atm. It'd be good to get the sub-issues in the tracker when 7.3 is out, then it's easier to keep track and create the PRs (especially if there's others interested in contributing to this and we need to coordinate on the effort).
pekkaklarck commentedon Apr 24, 2025
Some keywords accepting configuration parameters as
**configinstead of named-only arguments makes adding type hints to them annoying. The reason to use**configis Python 2 support, so these keywords can be updated. I submitted #5412 about that and try to get it done still in RF 7.3 timeline.[-]Add annotations / type hints to the standard libraries[/-][+]Add type hints to the standard libraries[/+]pekkaklarck commentedon Jun 19, 2025
Also return type hints should be added where applicable.
silentw0lf commentedon Aug 17, 2025
@robinmackaij I would be interested to work on it too.
Any updates for coordination?
silentw0lf commentedon Aug 17, 2025
Libraries would be (vias docs):
(x) BuiltIn.py
(x) Collections.py
(x) DateTime.py
(x) Dialogs.py
(x) OperatingSystem.py
(x) Process.py
(x) Screenshot.py
(x) String.py
(x) Telnet.py
(x) XML.py
I do not know how to create sub-issues here (probably no permissions).
I will start working on 1 library for the beginning: DateTime.py .
49 remaining items
silentw0lf commentedon Nov 20, 2025
I will look into the MR for Strings now: #5554
by reading through our discussions above, I see the the following tasks:
@keyword(types=None)since types providedstr | bytesargs where possible (i have to check for each parameter, if the functions in the keyword can also be called on a buytes objects - no quick job)str))Literalsupport (see DateTime)silentw0lf commentedon Nov 20, 2025
A hint for: Dialogs (@pekkaklarck)
I also implemnted typing for diaglogs but forgot to push it. Even if it seemed to be quiet easy/straigt forward, there was a problem in atests (manuel GUI dialog tests). Something seemed incorrect there. If I remember correctly, some value in a diaglog that should have been hidden was exposed, or the other way around? Maybe you could double check that. :)
my old changes/commit:
silentw0lf@e206cc0
(but maybe I just did something incorrectly for implementation)
silentw0lf commentedon Nov 20, 2025
rebased upstream/master and pushed commits: #5554
@pekkaklarck) I have implemented the tasks as far as I can. Problems remain with bytes support. Where I couldn't make a decision myself, I added a TODO(@pekkaklarck) to the functions with information.
The problem concerns backwards compatibility for keywords. Either
[1] You allow
bytes—then a test function must truly support it (which is particularly difficult when there are 2-3 parameters that can each be eitherbytesorstrinfluencing each other during code paths; in many cases that's simply not possible -> high risk for bugs).[2] You don't allow
bytes, because you can't support all parameter combinations—however, this would break older Robot versions if a user happened to usethe oneparameter combination that used to work (other type combinations would also then not work).[3] Where
bytescan't be safely introduced 100%, we can leave it asstr, and there will be a few special cases where backwards compatibility cannot be maintained.Could you perhaps adjust the remaining places according to your preferences in the MR?
Otherwise, I think the discussions will drag on for a long time back and forth, even though the implementation is already 95% finished.
local latests and utests PASS but there is some empty error porblem in the pipeline:
pekkaklarck commentedon Nov 21, 2025
Quick comments about String and other topics mentioned above.
bytessupport is the same as we had with BuiltIn and to some extend with Collections (Enhanced and explicitbytessupport in BuiltIn, String and Collections #5548). I just got that issue done and it was a relatively big task. I think that similarly as with BuiltIn, it's best to just add typing first and usestr | byteswith all keywords that would benefit from bytes support. Adding explicit tests and making needed fixes can be done separately and I can take care of that. Possibly we could extend the scope of Enhanced and explicitbytessupport in BuiltIn, String and Collections #5548 to cover also String. Let's discuss this more in Add annotations to String #5558.Add annotations to XML (#5542)
Enhance XML typing.
pekkaklarck commentedon Nov 27, 2025
XML is in! Thanks @robinmackaij!
The last one is String. I'll review the PR next @silentw0lf, but I won't have time for it today.
pekkaklarck commentedon Nov 28, 2025
@silentw0lf, I reviewed this String PR. Do you have idea when you'd have time to look at the comments? I'd like to get the PR closed soonish so that I can finish #5537 and #5548 that are dependent on it.
Add type hints to String library (#5554)
pekkaklarck commentedon Dec 1, 2025
String got typing in PR #5554 by @silentw0lf. Thanks for the contribution!
String typing may still change as part of #5548, but the library now has typing so I closed #5558. Now all libraries that we wanted to add typing have them, so also this issue can be finally closed.
Thanks all who participated! I knew this was going to be a big task, but it turned out to be even bigger than I anticipated. Had I known how much work this is, I'd probably moved this to RF 7.5 or only covered some libraries now. Anyway, the results are good so we should be proud!