-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remodel entry points and Command Line Interface to use "Swiss Army knife" approach #517
Open
3 of 12 tasks
Labels
Comments
Documenting possible structure/options
|
Remember to ensure |
Re-opening to undertake further modularisation as per table. Individual issues created to address each step in the processing and this issue will serve as an Epic and be closed when each is completed. |
This was referenced Nov 30, 2023
This was referenced Oct 23, 2024
ns-rse
added a commit
that referenced
this issue
Oct 28, 2024
As a step towards #517 this commit removes the legacy entry points and their associated tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it would be useful to revise the Command Line Interface (CLI) entry point to TopoStats. Currently there are two
run_topostats
andtoposum
but in order to make this extensible I feel we should adopt what is termed the "Swiss Army knife" approach to Command Line Interfaces.This is what programmes such as
git
,pre-commit
and many others use. They have a single command for invocation followed by a sub-command. Usingpre-commit
as an example (as its written in Python and provides a good pattern to emulate)...The main
pre-commit
command has the following help...That is the
positional arguments
are sub-commands, if you want torun
then you have the following options to that...I envisage replacing existing commands with the following (see also table below for further thoughts/details)...
run_topostats
topostats process
toposum
topostats summarise
run_topostats --create-config-file
topostats config
Implementation
Following the example of
pre-commit
this would entail introducing atopostats/main.py
module to provide an entry point oftopostats.main:main
.topostats/main.py
then imports the various commands from a multitude of sub-modules undertopostats/commands/*.py
(there is one for each command).Each arguments are defined for each sub-command within
main.py
in what may be an Abstract Factory design pattern (not quite sure on this front yet!).Additional Changes
In addition all documentation (
README.md
,docs/usage.md
etc.) would also require updating to reflect these changes.Modules to Add
The ground work for this has been set thanks to @SylviaWhittle work in #540. We now need to further modularise the CLI with individual steps corresponding to each class as these are the way in which we delineate the processing steps in the code to run the following processing, each step saving the results for subsequent steps to be used courtesy of #613 which introduced
io.save_topostats_file()
to save the current state to ahdf5
file.create-config
#757The text was updated successfully, but these errors were encountered: