peng-lab/BaSiCPy

Command line interface

Closed this issue · 3 comments

We need some command-line interface. Possible packages are:

Fire is easy-to-use, but maybe too simple, if there's no other opinion, I would recommend Click.

I have some experience with argparse. Those packages are probably great but like @Nicholas-Schaub suggested, if we can stick to the standard python library as much as possible, I think maintenance will be a lot simpler.

I think we should start with argparse and then move to click or fire if we need more.

Thanks @tdmorello! I also have some experience with argparse. Sure, let's start with it and migrate to others if necessary.

In general I like to stick to Python base packages. In this particular case, I would be okay with using Click due how much it would simplify the code, it is widely used, and it solves some issues that are present in argparse.

https://click.palletsprojects.com/en/8.0.x/why/#why-not-argparse

I'm going to add this to the Project, and whoever implements it can decide how to do it. I think the more important thing to discuss is what the input arguments are going to be.

I recommend we use camelCase for CLI input parameters because we have had problems with some cloud computing infrastructure when using the Python standard underscore_variable names. Particularly Argo.

I would propose the following (I don't think this is a complete list, but it is good to get us started):

Required Arguments:

  1. --inpDir - Path to a directory with input data, should fit and apply flatfield correction to all data
  2. --outDir - Path to a directory where data should be exported

Optional Arguments:
3. All of the class attributes of the Profile class as optional inputs that default to whatever Profile defaults to. The easiest way to implement this will be to programmatically generate them from the class attributes.
4. Optional file selection parameter (such as a regular expression). We could use a package I've developed called filepattern that has an easier to use syntax than regular expressions, but it also relies on an outside package. The file selection parameter would define what images should be processed in a directory. I generally call this --pattern or --filepattern

When it gets implemented, I propose that if argparse is used that it is put in a __main__ block, and the only purpose of that block is to parse the arguments and pass them a function that does the actual work. This ticket should not include the actual processing block, just setting up argument parsing and sending to a dummy function for now. Another ticket should actually implement this batch processing method.