Skip to content

SG-39414 Add type annotations #393

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 3 commits into
base: master
Choose a base branch
from

Conversation

chadrik
Copy link

@chadrik chadrik commented Jun 18, 2025

Resolves #307 and #233

When running mypy against the code there are still some errors, but the annotations should provide some good value to users without any real downsides.

@chadrik chadrik force-pushed the typing branch 2 times, most recently from cf7e8db to ff3a639 Compare June 18, 2025 16:24
@chadrik
Copy link
Author

chadrik commented Jun 18, 2025

I don't think these CI failures are related to my changes.

Copy link

@austinwitherspoon austinwitherspoon left a comment

Choose a reason for hiding this comment

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

It would be cool to add a blank py.typed marker file so tools like mypy know that this package has type hints!

https://peps.python.org/pep-0561/#packaging-type-information

I believe we'd also need to update setup.py to include that in the package data.


class BaseEntity(TypedDict, total=False):
id: int
type: str
Copy link
Author

Choose a reason for hiding this comment

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

I added some TypedDicts to try to fill in some of the required dictionary fields. Let me know if you see anything wrong here.

@carlos-villavicencio-adsk carlos-villavicencio-adsk changed the title Add type annotations SG-39414 Add type annotations Jun 19, 2025
entity_type: str,
data: dict[str, Any],
return_fields: Optional[list] = None,
) -> dict[str, Any]:
Copy link
Author

Choose a reason for hiding this comment

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

This should be changed to the BaseEntity TypedDict

@chadrik
Copy link
Author

chadrik commented Jun 26, 2025

Anything else I can do to help this along?

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.

Add Type hints to common API methods
2 participants