ART icon indicating copy to clipboard operation
ART copied to clipboard

Refactor: Simplify TrajectoryGroup and remove monkey-patching

Open Mirza-Samad-Ahmed-Baig opened this issue 7 months ago • 4 comments

This pull request refactors the TrajectoryGroup class to simplify its initialization and remove the need for monkey-patching in the ART CLI. Previously, the TrajectoryGroup class had a complex new method to handle both synchronous and asynchronous creation, which required monkey-patching in the server environment to function correctly. This approach made the code harder to understand and maintain. This refactoring addresses the issue by: - Moving the asynchronous instantiation logic to a new from_awaitables class method. This separates the asynchronous and synchronous creation paths, making the code more explicit and easier to follow. - Simplifying the new and init methods to handle only the standard, synchronous case. - Removing the monkey-patching code from src/art/cli.py, as it is no longer necessary. These changes improve code clarity, maintainability, and eliminate the potential side effects of modifying a class at runtime. The TrajectoryGroup class is now more robust and easier to use in different contexts without workarounds.

Mirza-Samad-Ahmed-Baig avatar Aug 06 '25 06:08 Mirza-Samad-Ahmed-Baig

@bradhilton you're probably the best person to review here!

corbt avatar Aug 07 '25 02:08 corbt

@Mirza-Samad-Ahmed-Baig could you review the failing code quality checks and fix if necessary?

corbt avatar Aug 07 '25 02:08 corbt

Thank you for reviewing, oh man how can I leave that like that. I will correct that soon.

Mirza-Samad-Ahmed-Baig avatar Aug 07 '25 05:08 Mirza-Samad-Ahmed-Baig

Done, further lowered the required uv version to 0.6.13 to align with the available development environment.

Mirza-Samad-Ahmed-Baig avatar Aug 07 '25 07:08 Mirza-Samad-Ahmed-Baig