Inside a notebook, you can tag a function that tests an entrypoint like this:
@entrypoint_test(classify_irises)
def test_the_classifier():
example_input = [[5.1, 3.5, 1.4, 0.2]]
result = classify_irises(example_input)
return result
And then that function's text will be available in the entrypoint's metadata object in the test_functions list. This will let us display an example of how to use the entrypoint on the UI or in an autogenerated "Try it in Colab" notebook.
Discussion
I deliberately kept this first draft of this super simple. There is no validation of the test function's contents or anything like that. And this just passes along the raw text of the test function. Enough to display the example in the UI and no more.
Also I was getting some weird behavior with container selection on publish so I went ahead and refactored so that it shares the same helper for selecting the base container with start.
Testing
I tested this with the sklearn seedling. I confirmed that the new metadata made it up in the JSON response in the expected place in the frontend.
Documentation
None yet. This would be good to add to the template notebooks if we like it.
Closes #342
Overview
Inside a notebook, you can tag a function that tests an entrypoint like this:
And then that function's text will be available in the entrypoint's metadata object in the
test_functions
list. This will let us display an example of how to use the entrypoint on the UI or in an autogenerated "Try it in Colab" notebook.Discussion
I deliberately kept this first draft of this super simple. There is no validation of the test function's contents or anything like that. And this just passes along the raw text of the test function. Enough to display the example in the UI and no more.
Also I was getting some weird behavior with container selection on
publish
so I went ahead and refactored so that it shares the same helper for selecting the base container withstart
.Testing
I tested this with the sklearn seedling. I confirmed that the new metadata made it up in the JSON response in the expected place in the frontend.
Documentation
None yet. This would be good to add to the template notebooks if we like it.
📚 Documentation preview 📚: https://garden-ai--369.org.readthedocs.build/en/369/