python-aos-lesson icon indicating copy to clipboard operation
python-aos-lesson copied to clipboard

Argparse

Open pletzer opened this issue 3 years ago • 1 comments

Hi @DamienIrving

This PR replaces argparse by the defopt module. Defopt automates a lot in terms of creating command line arguments. All the user needs to do is to document the code and define interfaces, which is good practice anyway. It's also easier to have default arguments.

I kept the argparse module in some files, we're not completely replacing argparse with defopt, just encouraging the use of defopt.

pletzer avatar Jan 13 '22 20:01 pletzer

Thanks, @pletzer. I wasn't aware of defopt - it looks great.

I think you should definitely go ahead and use defopt for your workshop at ICSHMO (i.e. directing participants to your forked lesson materials at https://pletzer.github.io/python-aos-lesson). I'll need to have a bit of think about whether to switch to defopt for the official PyAOS Data Carpentry lessons. The rationale for using argparse was that unless there's a very widely used alternative, I like to stick with the python standard library. I don't get the sense defopt has separated itself as the clear winner from all the other command line parsers out there, but I could be wrong?

At the very least, one thing I could do is add an information box to the command line programs lesson to tell people that defopt is a good alternative. That's what I've done in the package management lesson with mamba. It's much better than conda but hasn't overtaken it in terms of popularity/usage, so the lesson uses conda but mentions mamba in an information box.

DamienIrving avatar Jan 16 '22 22:01 DamienIrving