Garden-AI / garden

https://garden-ai.readthedocs.io
MIT License
21 stars 4 forks source link

Modal class support #554

Closed WillEngler closed 3 days ago

WillEngler commented 4 days ago

Second part of #198. Closes #198

Overview

This PR accommodates Modal class methods. They come over as metadata just as normal functions do - they just have dots in their names, like "MyClass.my_method". The SDK will construct wrappers on the fly so that users can invoke class methods like my_garden.MyClass.my_method

Discussion

Testing

Added a new unit test to exercise the chain of __getattr__s. Also did manual testing to check tab completion and HTML rendering.

Manual testing was limited as I mostly used fixture data.

Documentation

Not yet, but this will definitely merit some mention in the docs


📚 Documentation preview 📚: https://garden-ai--554.org.readthedocs.build/en/554/

codecov[bot] commented 4 days ago

Codecov Report

Attention: Patch coverage is 71.42857% with 16 lines in your changes missing coverage. Please review.

Project coverage is 74.52%. Comparing base (a268082) to head (2cd34cf). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
garden_ai/gardens.py 71.87% 9 Missing :warning:
garden_ai/modal/classes.py 70.83% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #554 +/- ## ========================================== - Coverage 74.66% 74.52% -0.15% ========================================== Files 38 39 +1 Lines 2424 2473 +49 ========================================== + Hits 1810 1843 +33 - Misses 614 630 +16 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: