Skip to content

driver: add initial type hints for common driver code - #1946

Open
rpoisel wants to merge 1 commit into
labgrid-project:masterfrom
honeytreelabs:dev-add-typing-hints-initial
Open

driver: add initial type hints for common driver code#1946
rpoisel wants to merge 1 commit into
labgrid-project:masterfrom
honeytreelabs:dev-add-typing-hints-initial

Conversation

@rpoisel

@rpoisel rpoisel commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

This PR starts adding type annotations incrementally, as discussed in #1945.

It adds ty as a development dependency and configures it to check a small initial module of the codebase: labgrid/driver/common.py.

Verified locally with:

uv run --extra dev pytest tests/test_driver_common.py
uv run ruff check labgrid/driver/common.py tests/test_driver_common.py
uv run ruff format --check --diff labgrid/driver/common.py tests/test_driver_common.py
uv run ty check

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.0%. Comparing base (424a0b7) to head (427d66f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1946   +/-   ##
======================================
  Coverage    61.0%   61.0%           
======================================
  Files         182     182           
  Lines       14898   14902    +4     
======================================
+ Hits         9094    9104   +10     
+ Misses       5804    5798    -6     
Flag Coverage Δ
3.10 61.0% <100.0%> (+<0.1%) ⬆️
3.11 61.0% <100.0%> (+<0.1%) ⬆️
3.12 61.0% <100.0%> (+<0.1%) ⬆️
3.13 61.0% <100.0%> (+<0.1%) ⬆️
3.14 61.0% <100.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@rpoisel
rpoisel force-pushed the dev-add-typing-hints-initial branch 3 times, most recently from 2631215 to 8411023 Compare July 29, 2026 13:19
@rpoisel
rpoisel marked this pull request as ready for review July 29, 2026 13:35

@Emantor Emantor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, do you also want to add a ty check run to this PR for the CI or is it too early for that?

@rpoisel

rpoisel commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Do you also want to add a ty check run to this PR for the CI or is it too early for that?

Thanks for your approval!

I'd be happy to add such check to CI. If you don't mind, I'd do that in a separate commit.

EDIT: just re-pushed to get the commit of this PR verified.

@rpoisel
rpoisel force-pushed the dev-add-typing-hints-initial branch from 8411023 to 5efa0dc Compare July 31, 2026 09:24
Add `ty` as a development dependency and configure it to check one
initial driver module.

Annotate `labgrid.driver.common` while leaving existing attrs-based
exception behavior unchanged.

Signed-off-by: Rainer Poisel <rainer@embedded-focus.com>
@rpoisel
rpoisel force-pushed the dev-add-typing-hints-initial branch from 5efa0dc to 427d66f Compare July 31, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants