Garden-AI / garden

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

conditionally call local_data #498

Closed OwenPriceSkelly closed 2 months ago

OwenPriceSkelly commented 2 months ago

completes #496

Overview

This PR uses the environment variable introduced in #495 to use the new backend as a drop-in replacement anywhere that currently uses local_data.

Discussion

This has some ugly hacks to keep everything consistent with current behavior, especially when it comes to the Garden vs PublishedGarden distinction. Some of those Garden helper methods are pretty crufty and I can't wait to get rid of them completely.

We only even have the distinction there because of constraints due to local data in the first place -- one for normalized local_data entries, the other is for the denormalized search index entries. When the migration is through and the SDK no longer needs to worry about building the entries for the search index, we can simplify down to a single normalized GardenMetadata class.

Until then, I suppose lazy-importing a client to talk to the backend is no more hacky than lazy-importing local_data to build the nested metadata for the search index.

The only functionality we don't quite have the backend ready to replace is the list subcommands, which just print/format all the gardens/entrypoints in local data. Once we have https://github.com/Garden-AI/garden-backend/issues/111 complete we can replace these with "list gardens that belong to me" functionality, but in the meantime those commands just aren't especially meaningful in a world without local_data, so now we just don't define them unless local_data is enabled.

Testing

Sanity checked all of the garden-ai {garden, entrypoint, notebook} subcommands exhaustively from the CLI with/without having the GARDEN_DISABLE_LOCAL_DATA variable set. If unset, everything works the same as before. If set, all the commands still work as expected but by calling the backend API instead of touching local_data. The only thing that still goes in local data is the user's email for the whoami command.

Documentation

no docs


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

codecov-commenter commented 2 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 50.42735% with 58 lines in your changes missing coverage. Please review.

Project coverage is 74.81%. Comparing base (2c1a45c) to head (ba99b9e).

Files Patch % Lines
garden_ai/client.py 9.52% 19 Missing :warning:
garden_ai/app/garden.py 55.26% 17 Missing :warning:
garden_ai/gardens.py 45.83% 13 Missing :warning:
garden_ai/app/entrypoint.py 80.00% 6 Missing :warning:
garden_ai/app/main.py 0.00% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #498 +/- ## ========================================== - Coverage 75.20% 74.81% -0.40% ========================================== Files 55 55 Lines 3731 3756 +25 ========================================== + Hits 2806 2810 +4 - Misses 925 946 +21 ```

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