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

Get /models passing mypy checks. #15062

Merged
merged 2 commits into from
Sep 13, 2024
Merged

Get /models passing mypy checks. #15062

merged 2 commits into from
Sep 13, 2024

Conversation

bunchesofdonald
Copy link
Contributor

@bunchesofdonald bunchesofdonald commented Aug 23, 2024

This gets all of the files in /models to pass mypy checks.

Copy link
Collaborator

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

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

I am such a big fan of this effort 🙇

async def read_configuration_value(self, session: sa.orm.Session, key: str):
async def read_configuration_value(self, session: AsyncSession, key: str):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could probably just do a full-blown s/sa.orm.Session/AsyncSession/g through the whole repo because there's nowhere that we're actually using a sync session to me knowledge. I guess the imports will also need to be fixed up too, but I wonder how pervasive it is now

Copy link
Contributor Author

@bunchesofdonald bunchesofdonald Aug 23, 2024

Choose a reason for hiding this comment

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

There's only 10 left now, I can replace those in a follow-up PR.

Copy link

codspeed-hq bot commented Aug 23, 2024

CodSpeed Performance Report

Merging #15062 will not alter performance

Comparing mypy-models (5328344) with main (c846de0)

Summary

✅ 3 untouched benchmarks

@@ -86,7 +86,7 @@ class or a Block interface class
"""


def _collect_nested_reference_strings(obj: Dict):
def _collect_nested_reference_strings(obj: Dict) -> List[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm surprised mypy lets a naked generic like Dict though, is there a mypy setting that's letting this fly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe mypy just treats it as Dict[Any, Any], no particularly special config, though I am technically using a config different than what's in the repo to get stricter validation that we can't do codebase-wide yet:

[mypy]
plugins =
    pydantic.mypy

ignore_missing_imports = True
follow_imports = normal
disallow_untyped_defs = True

Copy link
Contributor

This pull request is stale because it has been open 14 days with no activity. To keep this pull request open remove stale label or comment.

Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

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

🌟 🌟 🌟 🌟 🌟

Comment on lines +381 to +386
flow_filter: Optional[schemas.filters.FlowFilter] = None,
flow_run_filter: Optional[schemas.filters.FlowRunFilter] = None,
task_run_filter: Optional[schemas.filters.TaskRunFilter] = None,
deployment_filter: Optional[schemas.filters.DeploymentFilter] = None,
work_pool_filter: Optional[schemas.filters.WorkPoolFilter] = None,
work_queue_filter: Optional[schemas.filters.WorkQueueFilter] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙌

@zzstoatzz zzstoatzz merged commit 926f7a4 into main Sep 13, 2024
30 checks passed
@zzstoatzz zzstoatzz deleted the mypy-models branch September 13, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants