Build a fully featured CLI for your python project with minium effort
Project description
DecoratorCLI
Enables you to build a CLI with python in the most straightforward way with the fewest lines of code:
Project Goals:
-
Use modern python language features to make invoking python functions from the command line easy. familiar CLI options like "Man" or "Help" should be populated automatically from type hints and doc strings.
-
Do not require an invocation wrapper. Invoking functions in "myPythonFile.py" should look something like: ./myPythonFile.py myFunction --myIntArgument=50 -b=True
-
Include automatic type coercion based on type hints. Invoking ./myPythonFile.py myFunction --myIntArgument=50 -b=True should convert 50 to an int, and True to a bool
-
Provide defaults, but remain un-opinionated about invocation format. It should be easy to extend the project to handle other argument formats such as: ./myPythonFile.py myFunction myIntArgument:50, b:True
-
Provide a useful utility to as large a target audience as possible. This project should be approachable for a sophomore in a non CS related STEM field. Errors should provide hints as to how to resolve issues.
-
Enable complex projects with lots of functions/targets to be well organized. Target annotations from multiple files should build a nice directory/tree structured organized man/help page, and be addressable by directory or directly if possible, eg: ./myMainPythonFile.py myImportedModule.mySecondaryFunction --myIntArgument=50 -b=True
-
These goals should be implemented with a single "@target" Annotation that takes no arguments. It should be extremely easy to add to existing code/projects
Stretch Project Goals:
-
Provide Additional arguments to the @target annotation so that common tasks don't require bespoke coding. These arguments will be "Mixed In" to the documentation and parsing for a particular targeted function
-
Concurrency argument (defaults to 1). Use the Threading library to spin up as many concurrent invocations of a task as desired. This would enable easy multi-proccessing
-
Home Directory Argument. Make a particular function always run from within a particular path.
-
Required Files Argument. Make a target require a file by moniker (such as "config.json"). And then instead of getting the path to the file just get the string of the file contents instead.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for clifunction-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 129cf54d98b2d9bb8cfe213689140572085cfe4cacbd27edff4a9c86854d9629 |
|
MD5 | feeb34bbc7ae41db0fe2b6101ca3e130 |
|
BLAKE2b-256 | bd1ebaa1431e279e4d04cb17996de25d044e2a1d255e83558c9593de86ff0fa1 |