Skip to content

refactor: improve import formatting and type hinting consistency across modules #4058

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cofin
Copy link
Member

@cofin cofin commented Mar 18, 2025

This PR also updates the dependency and tests against the latest versions of ruff and pyright.

There are also a few documentations related updates for Advanced Alchemy 1.0

@cofin cofin requested review from a team as code owners March 18, 2025 21:50
@github-actions github-actions bot added area/contrib This PR involves changes to the contrib (Deprecated) area/datastructures area/dependencies This PR involves changes to the dependencies area/dto This PR involves changes to the DTOs area/kwargs area/plugins This PR involves changes to the plugins area/private-api This PR involves changes to the privatized API area/router area/signature area/template size: large pr/internal labels Mar 18, 2025
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Good call, thank you!

@github-actions github-actions bot added area/docs This PR involves changes to the documentation area/logging labels Mar 19, 2025
@cofin cofin enabled auto-merge (squash) March 19, 2025 02:49
@@ -80,7 +80,7 @@ def create_string_constrained_field_schema(
schema.max_length = kwarg_definition.max_length
if kwarg_definition.pattern:
schema.pattern = (
kwarg_definition.pattern.pattern # type: ignore[attr-defined]
kwarg_definition.pattern.pattern # type: ignore[attr-defined,unused-ignore]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
kwarg_definition.pattern.pattern # type: ignore[attr-defined,unused-ignore]
kwarg_definition.pattern.pattern

Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason this is raising linter errors locally but not in CI. I'm wondering if it's a difference between pylance/pyright?

@@ -22,5 +22,5 @@ def get_typed_init(self, type_: Any) -> tuple[Signature, dict[str, Any]]:
inspect.Parameter(name=field_name, kind=inspect.Parameter.KEYWORD_ONLY, annotation=Any)
for field_name in model_fields
]
type_hints = {field_name: Any for field_name in model_fields}
type_hints = dict.fromkeys(model_fields, Any)
Copy link
Member

Choose a reason for hiding this comment

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

I personally find the other method more readable as it's more explicit

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a Ruff automated upgrade that's been recently added.

Copy link
Member

Choose a reason for hiding this comment

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

Can we ignore it?

@cofin
Copy link
Member Author

cofin commented Mar 20, 2025

I'm not sure why the documentation tests are hanging. I'll have to take a deeper look at this. I haven't another PR that's doing the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/contrib This PR involves changes to the contrib (Deprecated) area/datastructures area/dependencies This PR involves changes to the dependencies area/docs This PR involves changes to the documentation area/dto This PR involves changes to the DTOs area/kwargs area/logging area/plugins This PR involves changes to the plugins area/private-api This PR involves changes to the privatized API area/router area/signature area/template pr/internal size: large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants