Reputation: 561
I having been looking to find ways to achieve this but couldn't find one.
I have multiple python scripts some of them are preprocessing utility tools, some performs data analysis and some of creates visualizations. They are all related but may or may not be dependent and may have individual input arguments. I am trying to create a suite of tools in one package and want the user to choose and run the tool/module as they want.
Eg: Here is a java based software called GATK. "gatk" is a .jar which contains several tools, one of them is "AnnotateIntervals" and it has its set of input requirements. User runs it like this
gatk AnnotateIntervals \
-R reference.fa \
-L intervals.interval_list \
--interval-merging-rule OVERLAPPING_ONLY \
-O annotated_intervals.tsv
https://gatk.broadinstitute.org/hc/en-us/articles/360040098252-AnnotateIntervals
I want to develop something exactly like this in python,
main_app.py first_module -l <> -m <>
is this even possible? if so how can I achieve this?
Upvotes: 1
Views: 201
Reputation: 22295
You may want to read on setuptools' entry-points and/or on argparse's sub-commands. This is just one combination, probably the most "standard" one, but there are many other alternatives (poetry, flit, click, fire, and more).
Upvotes: 2