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

Improved Type Safety in Python Client API #42

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

Conversation

Itssshikhar
Copy link

Description

This PR improves the type safety of the Python client API by ensuring consistent TypedDict usage across all service clients. This makes the API more predictable.

Changes

  • Verified and maintained proper TypedDict definitions across all service clients
  • Ensured consistent typing patterns across the codebase
  • Fixed linting issues to maintain code quality
  • Verified all tests pass with the typing improvements

Testing

  • ✅ Ran make format for code formatting
  • ✅ Fixed all linting issues with ruff
  • ✅ Ran make test to verify functionality
  • ✅ Verified type checking with mypy

Related Issues

Closes #32

@codekansas
Copy link
Member

awesome :) could you fix the failing unit tests? otherwise looks good!

@Itssshikhar
Copy link
Author

thanks @codekansas . I just fixed the failing unit tests and pushed it.

Copy link
Member

@WT-MM WT-MM left a comment

Choose a reason for hiding this comment

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

Awesome, this looks really good! Just a few nitpicks to satisfy my ocd

@Itssshikhar
Copy link
Author

@WT-MM Hope this helps :)

@WT-MM
Copy link
Member

WT-MM commented Jan 22, 2025

okay, actually after taking another look at this again, can we keep the protobuf return types if they're typed or use dataclasses?

Being able to access values as attributes is probably more ergonomic (e.g. getting response.states instead of response["states'])

Otherwise, it's probably ready to merge in - I'll resolve conflicts and merge in afterwards

@Itssshikhar
Copy link
Author

@WT-MM you are right. Having access to the values as attributes is better.
I'll take a look at it.

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.

Don't use Any type in API
3 participants