motia icon indicating copy to clipboard operation
motia copied to clipboard

[FEAT] : Motia Python Types

Open riturajFi opened this issue 3 months ago • 10 comments

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 avatar Sep 05 '25 12:09 riturajFi

@riturajFi is attempting to deploy a commit to the motia Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Sep 05 '25 12:09 vercel[bot]

@sergiofilhowz would like your review on the PR regarding functionality, code quality, edge cases etc on this PR.

riturajFi avatar Sep 11 '25 08:09 riturajFi

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.

rohitg00 avatar Sep 12 '25 11:09 rohitg00

Hey @riturajFi, how's it going? Do you need any help here?

rohitg00 avatar Sep 27 '25 14:09 rohitg00

Hey @riturajFi, how's it going? Do you need any help here?

Hi @rohitg00 sorry for the delay - this will be done shortly

riturajFi avatar Sep 28 '25 10:09 riturajFi

Hi @sergiofilhowz @mfpiccolo @rohitg00 would love a review of the code and approach

riturajFi avatar Oct 04 '25 08:10 riturajFi

Thanks @riturajFi, we will review it this week. Thanks again.

rohitg00 avatar Oct 06 '25 04:10 rohitg00

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.

sergiofilhowz avatar Oct 08 '25 12:10 sergiofilhowz

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:

  1. Enhance consistency and structure – Review and streamline file naming conventions (e.g., within the Motia folder) and eliminate any redundancies.
  2. Transition to Pydantic models – Replace TypedDicts with Pydantic types to improve validation and maintainability. (TypedDicts were initially used to align with the existing Python typing patterns.)
  3. Develop comprehensive test cases – Implement robust testing to ensure the reliability and accuracy of the system.
  4. Integrate with Motia Cloud – Determine how this component connects and interacts within the broader Motia Cloud ecosystem.
  5. Design an AI-driven typing framework – Draft a generic plan for enabling AI to generate similar typing protocols across multiple programming languages.
  6. 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.


riturajFi avatar Oct 08 '25 13:10 riturajFi

⚠️ This PR is quite large (>1000 lines). Consider splitting it into smaller PRs for easier review.

github-actions[bot] avatar Nov 20 '25 20:11 github-actions[bot]