sisl
sisl copied to clipboard
First try at automated data CLI
As discussed with Nick, this is a minimal first attempt for the automatic generation of a CLI to postprocess data.
The aim is to organize things in a way that new methods to generate data can be simply registered to data classes and automatically added to the CLI, without needing to maintain CLI options all across sisl.
The automatic generation of a CLI requires of course some boilerplate code, but the amount of boilerplate code is almost constant when we add new functionality.
The approach taken:
- Created data classes in
sisl.data
that should help gathering all the possible ways in which the same data can be generated. For now I only implementedDOSData
. - Then functions to create that data should be registered. For now I have only registered the function that creates
DOSData
fromeigSileSiesta
. This functions should be type annotated to be automatically supported by the CLI. - The CLI is created independently in
sisl.cli.sdata
. For now it can be ran withpython -m sisl.cli.sdata
. That file is hyper documented, and there I explain all the parts that play a role in generating the CLI.
This standarization should not only help to create sisl's CLI but also facilitate the creation of other interfaces to sisl down the line (including the GUI).
To use it, for now, you need to install nodify
's dev version, click
and rich_click
:
pip install [email protected]:pfebrer/nodify.git click rich_click
The CLI can work in two ways:
Specify the type of data that you want and how to get it.
Main:
DOS data:
DOS data from the EIG file:
Pass a file, then only specify which data you want to get
Main:
DOS data: