-
Notifications
You must be signed in to change notification settings - Fork 6
Coding
water-e edited this page Jul 8, 2022
·
4 revisions
schimpy has a number of standalone command line scripts. In order to make sure that our command line scripts work well please follow these guidelines:
- The script should have a
if __name__ == __main__block that does nothing but call a function calledmain(). - The main() function should be called main().
- In main, the main thing you want to do is call create_argparse(), gather concrete arguments and call a function with named arguments.This will be called the work function
- As an extension of (3), please do not pass around argparse objects, dictionaries or namespaces unless you are passing through arguments to libraries that expect this (matplotlib for instance). Otherwise it thwarts documentation and API usage of the concrete function.
- The concrete function should, be named the same thing as the file to reflect the centrality of purpose.
- The concrete function should be documented using numpydoc conventions.
- The function create_argparse should be named create_argparse. We use this to hook up to sphinx.
- Once stable, recommend you add standalones as entry points in setup.py.
For newer libraries feel free to use fancier CLI methods.