Skip to content

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?

@chadrik
Copy link
Author

chadrik commented Jul 14, 2025

This is a pretty low risk change, it would be great to get it merged.

@chadrik
Copy link
Author

chadrik commented Jul 22, 2025

Since this isn't getting any traction I'm going to push a stubs only library to pypi. When this is complete I will remove it.

@austinwitherspoon
Copy link

I'd also be very excited to get these changes in! We currently maintain our own stubs package and it would be great to be able to delete it.

@chadrik
Copy link
Author

chadrik commented Aug 3, 2025

I'd also be very excited to get these changes in! We currently maintain our own stubs package and it would be great to be able to delete it.

My stubs have been published to pypi, in case anyone needs them: https://pypi.org/project/types-shotgun-api3/

@cdombrova-scanlinevfx
Copy link

Can this PR get some attention please?

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

3 participants