[FEAT] : Motia Python Types
Solves: #485
Description This update introduces strongly typed Python definitions for:
Input Types
API request and response objects
FlowContext types across all step files
It also resolves the previous issue where nested objects were incorrectly inferred as unknown in Python type definitions.
@riturajFi is attempting to deploy a commit to the motia Team on Vercel.
A member of the Team first needs to authorize it.
@sergiofilhowz would like your review on the PR regarding functionality, code quality, edge cases etc on this PR.
Hey @riturajFi, Thanks for your contribution - This is big!
Team is going to review this as soon as possible, currently working on a big release for the cloud.
Hey @riturajFi, how's it going? Do you need any help here?
Hey @riturajFi, how's it going? Do you need any help here?
Hi @rohitg00 sorry for the delay - this will be done shortly
Hi @sergiofilhowz @mfpiccolo @rohitg00 would love a review of the code and approach
Thanks @riturajFi, we will review it this week. Thanks again.
Thank you @riturajFi I checked your PR and it looks great, I need to test to understand how it ties to Motia Cloud and Motia self-host deployment. This PR is a solid contribution, but I appreciate your patience and hope you understand this can take some time to be merged.
Thank you @riturajFi I checked your PR and it looks great, I need to test to understand how it ties to Motia Cloud and Motia self-host deployment. This PR is a solid contribution, but I appreciate your patience and hope you understand this can take some time to be merged.
Absolutely! If the current approach proves effective, my next steps will be as follows:
- Enhance consistency and structure – Review and streamline file naming conventions (e.g., within the Motia folder) and eliminate any redundancies.
- Transition to Pydantic models – Replace
TypedDictswith Pydantic types to improve validation and maintainability. (TypedDictswere initially used to align with the existing Python typing patterns.) - Develop comprehensive test cases – Implement robust testing to ensure the reliability and accuracy of the system.
- Integrate with Motia Cloud – Determine how this component connects and interacts within the broader Motia Cloud ecosystem.
- Design an AI-driven typing framework – Draft a generic plan for enabling AI to generate similar typing protocols across multiple programming languages.
- Execute end-to-end testing – Validate the entire workflow through E2E test execution.
Current Concerns
The current workflow involves generating types in the following sequence:
Python file → TypeScript generics generated → Parsed back into Python types
This indirect approach was necessary to maintain consistency between the Python types and the TypeScript generics used in Motia operations.
All things considered, with a bit more work—perhaps over the weekend—everything should be fully aligned and complete.
⚠️ This PR is quite large (>1000 lines). Consider splitting it into smaller PRs for easier review.