Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type annotations to function signatures in credential_plugins_test and importable_test modules #26

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

djyasin
Copy link
Member

@djyasin djyasin commented Aug 30, 2024

This PR contains the type annotations to function signatures for credential_plugins_test.py and tests/importable_test.py

@djyasin djyasin mentioned this pull request Aug 30, 2024
@webknjaz
Copy link
Member

Judging by the RTD failures, the branch needs to be rebased (and some CI jobs will become green as a result).

@webknjaz webknjaz self-requested a review September 2, 2024 14:15
@webknjaz
Copy link
Member

webknjaz commented Sep 2, 2024

@djyasin here's the current state of MyPy coverage: https://app.codecov.io/gh/ansible/awx-plugins?flags%5B0%5D=MyPy. You can look into that or check what's in python3 -Im webbrowser $(ls -1 .tox/.tmp/.test-results/mypy--py-*/index.html | head -n 1) after each time you re-run tox r -e pre-commit -q -- mypy --all-files locally.

@djyasin djyasin force-pushed the linting_fix_mypy_29442 branch from 98e015d to 2d542a7 Compare September 3, 2024 14:56
@djyasin
Copy link
Member Author

djyasin commented Sep 6, 2024

This PR contains all of the fixes for credential_plugins_test.py and tests/importable_test.py

@djyasin djyasin marked this pull request as ready for review September 6, 2024 14:42
@webknjaz
Copy link
Member

webknjaz commented Sep 6, 2024

This problem https://github.com/ansible/awx-plugins/actions/runs/10740379607/job/29788419764?pr=26#step:18:29 shows that there is a dependency on awx:

src/awx_plugins/credentials/plugins.py:7:1: error: Cannot find implementation
or library stub for module named "awx.main.models.credential" 
[import-not-found]

Though, we cannot physically declare it due to it not being on PyPI (well, there's a wrong awx there but not ours). So we have no choice but to ignore it since we can't check against it until we decouple the two projects, exterminating the circular dependencies between them.

The way to do it is by reproducing a section like https://github.com/sphinx-contrib/sphinxcontrib-towncrier/blob/b01f3b0/.mypy.ini#L36-L40 and configuring just that section to pretend there are no such imports...

@djyasin djyasin marked this pull request as draft September 6, 2024 22:33
@djyasin djyasin force-pushed the linting_fix_mypy_29442 branch 2 times, most recently from 5019634 to 0bb608f Compare September 10, 2024 14:43
@djyasin djyasin force-pushed the linting_fix_mypy_29442 branch 5 times, most recently from 7696c90 to 2f3e80d Compare September 11, 2024 19:03
@djyasin djyasin marked this pull request as ready for review September 11, 2024 19:06
@djyasin djyasin changed the title [WIP] MyPy Linting Fixes MyPy Linting Fixes Sep 11, 2024
@webknjaz
Copy link
Member

FYI, this failure https://github.com/ansible/awx-plugins/actions/runs/10818045643/job/30012894850?pr=26#step:18:49 is flaky. I reported it upstream via sphinx-contrib/spelling#227. For now, just restart the job if you see this error.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Let's move the unrelated fixes elsewhere so that this PR won't have to accumulate more changes required for those unrelated fixes to be complete.

@webknjaz
Copy link
Member

@djyasin I just realized that the PR description and title need to be updated to reflect what's fixed. And also to be accurate...

@djyasin djyasin changed the title MyPy Linting Fixes MyPy linting fixes for credential_plugins_test.py and tests/importable_test.py Sep 12, 2024
@djyasin djyasin force-pushed the linting_fix_mypy_29442 branch from 683df2a to 37b4d90 Compare September 13, 2024 14:49
@djyasin djyasin requested a review from webknjaz September 13, 2024 15:20
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

There's a few places that need to be addressed still.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

@djyasin feel free to squash the commits and put this into the merge queue.

@webknjaz
Copy link
Member

@djyasin I think the PR title needs to be clarified still. It's pretty generic in describing what is done. It would be nice to see what exactly is being changed.

Also, some MyPy violations going away is one of the effects of the patch. The title should be talking about the change that leads to those effects. Like adding typing. Or rather adding type annotations to function signatures in these modules. Not sure if this covers all violations in these modules (probably not?)

@djyasin djyasin changed the title MyPy linting fixes for credential_plugins_test.py and tests/importable_test.py Add type annotations to function signatures in credential_plugins_test and importable_test modules Sep 13, 2024
…table_test.py

Update tests/credential_plugins_test.py

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>

Add type annotation to line 19
@djyasin djyasin force-pushed the linting_fix_mypy_29442 branch from a30e167 to a9c9702 Compare September 13, 2024 19:56
@djyasin djyasin enabled auto-merge September 13, 2024 20:06
@djyasin djyasin added this pull request to the merge queue Sep 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 13, 2024
@webknjaz webknjaz added this pull request to the merge queue Sep 13, 2024
Merged via the queue into ansible:devel with commit 989b46c Sep 13, 2024
30 of 40 checks passed
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