-
Notifications
You must be signed in to change notification settings - Fork 6
Coding
water-e edited this page May 20, 2020
·
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 main(). - The main() function should call create_argparse(), gather concrete arguments and call a function with named arguments. Do not pass around argparse objects 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.