conda-store icon indicating copy to clipboard operation
conda-store copied to clipboard

New feature : conda store CLI

Open pierrotsmnrd opened this issue 2 years ago • 5 comments

The goal of this issue is to scope what a conda-store cli should do, and how to do it.

@costrouc Let's start by listing the features you have in mind here, and we'll refine the expected behaviours, parameters, etc.

pierrotsmnrd avatar Mar 01 '22 08:03 pierrotsmnrd

Just some of my thoughts

Conda-Store CLI Brainstroming

High level design:

  • conda-store is the <command-name>
  • would like to follow <command-name> <action> <noun> ... with no more nesting only options. Accepts nouns in plural and non-plural form.
  • there will only be one way to perform each action
  • NO install, delete, update packages action. Instead we point users to use edit which will drop them into their prefered editor to edit the environment. Similar to how git commit will drop you into an editor.
  • all actions the print output will have a json option when it makes sense

Commands:

  • =auth= :: login, logout, info
    • login :: will login the user possibly sending them to a login page in their browser
    • logout :: remove local login state
    • info :: give information to user about their credentials once logged in
  • =namespace(s)= :: list, create, delete
    • list, create, delete think these are intuitive, ability to perform action will be dependant on permissions
  • =env(s)/environment(s)= :: list, create, delete, get, update, edit
    • list :: rich filtering options
    • create, delete will create or delete a given environment
    • get :: show a particular environment will default to fetching
    • update :: update current environment with given filename
    • edit :: will fetch the current environment.yaml and open an editor and once saved and editor exited the environment will be updated.
  • =pkg(s)/package(s)= :: list, get
    • list :: rich filtering options, heavily caching on the user's machine
    • get :: gets particular package
  • =channel(s)= :: list

Future

  • =conda-store environment solve =
    • this command will solve the given environment remotely via conda-store
  • =conda-store environment activate <namespace/name>=
    • this command will interact with conda-store to download the given environment and open a shell =/bin/sh= (entrypoint)
  • =conda-store environment run <namespace/name> -- =

costrouc avatar Mar 02 '22 16:03 costrouc

That was fast! You must have already started this document sometime in the past hehe.

I assume that conda-store help is just a given, and it will display something similar to what you have typed above?

If we're not going to have imperatives for what seem to me like basic operations—such as "add this package", "remove that package"—then it would be nice if conda-store help outputs a how-to section for a few of the most common tasks, like so:

How to:

Add a package

    To add a package to a Conda Store environment, you must add it to the list of dependencies 
    in the environment specification file (environment.yml). To edit that file in your default text 
    editor, run:

    conda-store env edit <namespace>/<environment>

    When you save and exit, Conda Store will start a new build.

Start a new environment from scratch

    First create an empty environment:

    conda env create <namespace>/<environment>

    Then add initial packages. The initial specification will be a skeleton file for you to fill in:

    conda env edit <namespace>/<environment>
    
Etc. (maybe just one more)

How hard would it be for me to make some aliases like csadd, csrm, csup so that I could run them like csadd nodejs=16, which would add Node.js 16 into my current or default environment?

A few more issues and questions:

  • There's probably no helping this, but conda-store feels pretty lengthy to me for a command. My fingers are lazy.
  • I might suggest replacing get with info for consistency. As in, I'm not sure why it should be auth info but env get
  • I'm worried about possible confusion between env update and env edit.
  • Given the list of proposed commands, how would a user clone an existing environment?
  • How stateful is the conda-store command? Besides keeping track of logged in, logged out, and caching package search results, does it have any notion of a current working namespace or current working environment or stuff like that?
  • What does env get do? I mean, what does that command actually return?
  • What does env solve do? The description didn't make it clear for me.
  • What does env run do?

gabalafou avatar Mar 02 '22 21:03 gabalafou

@jaimergp Your input would be helpful here as well.

dharhas avatar Jun 24 '22 16:06 dharhas

A uri is either <namespace>/<name>, <name>, <namespace>/<name>:<build id>, or <build id> which all reference a build

Currently in the PR https://github.com/Quansight/conda-store/pull/327 I have added what I would call the uncontroversial bits:

  • conda info
  • conda run <uri> --command ....
  • conda download <uri>

I'm looking for the discussion about the environment, build, namespace interaction.

costrouc avatar Jun 24 '22 17:06 costrouc

Sorry I was on PTO! I have some questions about the conda-store env subcommand:

=env(s)/environment(s)= :: list, create, delete, get, update, edit
list :: rich filtering options
create, delete will create or delete a given environment
get :: show a particular environment will default to fetching
update :: update current environment with given filename
edit :: will fetch the current environment.yaml and open an editor and once saved and editor exited the environment will be updated.
  • conda-store env list will: (A) list all available environments? (B) list the packages in that environment? I always found that bit confusing in conda.
  • edit vs create/delete: what happens if I try to edit a non-existing env? Will it default to creating it? What if I edit and remove all the packages in the environment? Will the environment be deleted as well? These are important questions for {pre,post}-{activation,link} scripts.
  • How is update different from edit? How would a file instruct a set of editions? Simply by overwriting everything, or would you try to merge?. I'd say edit could have a flag to use -f as an input file path? But we'd need to discuss interactivity expectations there.

jaimergp avatar Jul 05 '22 12:07 jaimergp

What is the status of the CLI? Can we break this down into more specific issues at this point?

kcpevey avatar Jul 06 '23 13:07 kcpevey

CLI now exists. This issue contains informations about desired features, hence marking it as META.

pierrotsmnrd avatar Aug 18 '23 15:08 pierrotsmnrd

Given that this issue is so old and we now have a CLI, can we open up new more specific issues about what is needed at this point? Its kind of hard to tell what has been done here and what has not.

kcpevey avatar Aug 21 '23 13:08 kcpevey

@kcpevey agreed. This issue is too broad and since we have a cli client we need discussion to revolve around how to improve/change it. I would consider the cli as it extremely experimental as is. I only spent a few days writing it and was not able to deeply think about the commands.

costrouc avatar Aug 24 '23 22:08 costrouc