-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
lldb has a minimum version of python 3.8 at the moment.
Since python 3.5, type annotations have been supported as part of the language and this can help us catch issues during testing and development.
At the moment, not much of lldb's test suite contains type annotations but if we wanted start adding them thought the tests it could be helpful for catching issues.
If we wanted to enable this on the CI systems we would need to figure out which type checker we'd want to use.
I think the most common python type checkers are mypy and pyright, although others exist as well.
Once we have that setup and configured we likely need to update lldb/test/requirements.txt to include the type checker and likely the type_extensions
library, which is a library that back ports type helpers to older versions of python.
Activity
llvmbot commentedon May 28, 2025
@llvm/issue-subscribers-lldb
Author: John Harrison (ashgti)
Since python 3.5, type annotations have been supported as part of the language and this can help us catch issues during testing and development.
At the moment, not much of lldb's test suite contains type annotations but if we wanted start adding them thought the tests it could be helpful for catching issues.
If we wanted to enable this on the CI systems we would need to figure out which type checker we'd want to use.
I think the most common python type checkers are mypy and pyright, although others exist as well.
Once we have that setup and configured we likely need to update lldb/test/requirements.txt to include the type checker and likely the
type_extensions
library, which is a library that back ports type helpers to older versions of python.ashgti commentedon May 28, 2025
For reference, I have been using:
To check the code I've been working on recently.
boomanaiden154 commentedon May 29, 2025
If we're going to be doing type checking, this should probably be monorepo wide rather than specific to lldb. This would also need to through the RFC process and we would need to settle on a type checker (mypy/pytype/others) and some other policies (post commit type checking buildbot?).
Just starting with
lldb
to gain experience might not be the worst move though.ashgti commentedon May 29, 2025
I made a post on https://discourse.llvm.org/t/rfc-type-checking-to-python-code/86605 to discuss this for lldb. If we have some traction on that, I can see about an RFC for the whole repo.
ashgti commentedon Jun 5, 2025
I made a prototype of this integration in my lldb-mypy branch:
ashgti@585ce5d
This integrates the type check into the dotest.py helper.
See https://discourse.llvm.org/t/rfc-type-checking-to-python-code/86605/7 for more details