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

Improve typing completeness of internal base models #16217

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Dec 4, 2024

Fully defines the base models in prefect._internal.schemas.base to improve type completeness by 2.1%.

@desertaxle desertaxle added the development Tech debt, refactors, CI, tests, and other related work. label Dec 4, 2024
Copy link

codspeed-hq bot commented Dec 4, 2024

CodSpeed Performance Report

Merging #16217 will not alter performance

Comparing improve-base-model-typing (9d4cb45) with main (93d59f3)

Summary

✅ 3 untouched benchmarks

@desertaxle desertaxle changed the title Improve typing of base models Improve typing completeness of internal base models Dec 4, 2024
@desertaxle desertaxle marked this pull request as ready for review December 4, 2024 18:50
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.

📈

@desertaxle desertaxle merged commit ae3ae3e into main Dec 4, 2024
45 checks passed
@desertaxle desertaxle deleted the improve-base-model-typing branch December 4, 2024 18:56
@@ -58,7 +58,7 @@ def __eq__(self, other: Any) -> bool:
else:
return copy_dict == other

def __rich_repr__(self):
def __rich_repr__(self) -> Generator[tuple[str, Any, Any], None, None]:
Copy link
Contributor

@mjpieters mjpieters Dec 4, 2024

Choose a reason for hiding this comment

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

Pro tip: use rich.repr.RichReprResult for annotating these methods.

Otherwise, when only using yield and not other generator features like sending and returning, it's often sufficient to use Iterator[..] to annotate methods like these. That you used a generator function to implement the iterator is then a mere implementation detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Tech debt, refactors, CI, tests, and other related work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants