Closed kcpevey closed 2 months ago
Related issue on conda-store requesting moving this into the package: https://github.com/conda-incubator/conda-store/issues/853
Its possible to programmatically create conda-store environments, but currently, the process is not part of a formal api. Until it becomes part of an api, I suggest documenting the code.
I think you mean an SDK here right? instead of an API , i.e
conda-store create-env
or
from conda_store import create_env
also, not the actual solution but you might be able to get some of the logic by pulling out conda-store as a package and calling some of the functions from there, might help you reduce some of the logic https://github.com/conda-incubator/conda-store/blob/main/conda-store/conda_store/api.py
Yeah you're right, I'm using it as an SDK here. Really I'd be fine with SDK or CLI, but I actually think there may already be a way (an easier way) to go about this, its just not documented. I think it's best to close this and follow the related conda-store issue for documenting this process.
Preliminary Checks
Summary
In order to automate the creation of conda-store environments, it is necessary to interact with conda-store programmatically.
Nebari provides the ability to auto-pull git repositories and place them in users's private directories. This is useful for providing examples to users, but in order to truly prepare Nebari for new users running such examples, it must also create the environment(s) to go along with it. Doing this manually with every change to examples is tedious to maintain.
And just in general - developers often prefer doing things programmatically.
Its possible to programmatically create conda-store environments, but currently, the process is not part of a formal api. Until it becomes part of an api, I suggest documenting the code.
Steps to Resolve this Issue
I started with https://github.com/conda-incubator/conda-store/blob/524a1cc7313f3eca0d63d096ffc478df344b88ea/conda-store-server/tests/user_journeys/utils/api_utils.py as mentioned above, but removed parts that I couldn't get to work (login->token creation) and other things an end user on nebari shouldn't mess with (create/delete namespace). I also manually logged into conda-store before running this code.
First, you must go to
{your nebari domain}/conda-store/admin/user
and create a token.There is a LOT of boilerplate here, but the important calls are down at the bottom.