Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
14.65k stars 1.78k forks source link

Autocompletion and typing support for Taipy State variables #2024

Open FlorianJacta opened 1 week ago

FlorianJacta commented 1 week ago

Description

Problem: When developing with Taipy, there is currently no easy way to know the variables inside the State, along with their types. This makes it difficult to benefit from IDE autocompletion or assistance, causing more manual work, especially when tracking variables in multi-page applications. Without proper typing, developers cannot rely on their IDEs to prevent typos or suggest available methods, such as when working with a Pandas DataFrame or Plotly Figure stored in the state.

Proposed Solutions:

  1. TypedState Class: Creating a TypedState class manually or dynamically could give developers insight into the variables in the State object, allowing autocompletion and type-checking.

  2. Command Line Tool: A taipy generate-pyi command that could generate a .pyi file from the current state of the code could be useful to integrate variable typing with minimal manual effort.

  3. Taipy Studio Integration: Generating typed variables directly in Taipy Studio might smooth the process and reduce manual work. This would allow the IDE to recognize and autocomplete variable types within the state.

  4. Manual Variable Definition: Similar to what has been done with Taipy users, developers could manually define all the variables they use in their state. While effective, this approach might be difficult to maintain for large applications where states change frequently during interactions.

Challenges:

This issue focuses on improving IDE support for Taipy users, so developers can easily track and manage state variables. Integration of typed classes or better tooling in Taipy Studio could significantly enhance the coding experience.

Acceptance Criteria

Code of Conduct

mitgajera commented 1 week ago

@FlorianJacta /assign to me under Hacktoberfest 2024

FlorianJacta commented 1 week ago

This issue is not open for contribution at the moment (no "good first issue" or "help wanted" labels on it). @AdibaNaushad @mitgajera