Package: confused-argparse
confused-argparseNote: VERY Beta, please wait for relase 1.0, since it is not even complete yet"My standard" goto package for all my scripts/apps. Get argparse cli and configuration management in ONE LINE per parameter ;-)With minimal boilerplate to handle:System, default and script level configuration management files withconfuseusingYAMLOS enviromentdoes overwite settings fromYAMLAutomagicargparseCLI creation and handling. Will overwrite all settings fromYAMLandos enviromentSetting thelogginglevelAnd:Creating the user default and script levelYAMLfiles at first runOptional: Saving state at exitand so much more ...See:confused-argparseTHIS PACKAGEvenvfor python virtual enviromentconfusefor handling configurationTOMLfilesargparsefor creating aCLI parseros.environfor readingenviromentvariablesloggingforloggingto consoleYAMLfor saving configuration dataInstall:bash Shell:$python3-mvenv/path/to/new/virtual/environment
$cd/path/to/new/virtual/environment
$source./bin/activate
$pipinstallconfused-argparseFirst ExcamplePROGNAME.py:importconfused-argparseca=confused-argparse.set_var()ca('input_file',str,'Input file: Read from a local file')Behind the scenes:Ifinput_filewas set in any of theYAMLfiles, it will already have a value (Actually views of values, seeconfuse)Ifinput_filewas set in theos enviroment,input_filewill be set accrodingly, overriting theYAMLsettingIf--input_filewas set via thecommand lineinterface withpython3 PROGNAME.py --input_file my_file.txt, overriting theYAMLandos enviromentsetting tomy_file.txtIn the bash shell:$python3PROGNAME.py-h

usage:PROGNAME.py[-h][--input_fileINPUT_FILE]optionalarguments:-h,--helpshowthishelpmessageandexit--input_fileINPUT_FILEInputfile:ReadfromalocalfileNext level:PROGNAME.py:importconfused-argparseca=confused-argparse.set_var(standard=True,description='My App: Solves a problem')ca('input_file',str,'Input file: Read from a local file',group='I/O')Behind the scenes:standard=True:There are a number of standard argparse options already set, like--verbose,--debug,--cronScans and read the values defined in theos enviroment, case independant, so also the enviroment variableVERBOSEFor excample:--verbosewill set the logging level toINFOdescription='My App: Solves a problem'argparse will print thisgroup='I/O':argparsewill group options with this optional parameter$python3PROGNAME.py-h

usage:PROGNAME.py[-h][--input_fileINPUT_FILE][--list_defaults][--debug][--verbose][--cron]MyApp:Solvesaproblem

optionalarguments:-h,--helpshowthishelpmessageandexitI/O:--input_fileINPUT_FILEInputfile:Readfromalocalfile[str]=''Debugoptions:
Note:Willoverride--list_defaultsList:ListallVarsindictwiththereDefaults[bool]=False--debugDebug:LoggingDEBUGMessages(ifnot--cron,overrides--verbose)[bool]=False--verboseVerbose:LoggingINFOMessages(ifnot--cron)[bool]=False--cronCalledfromCronjob[bool]=FalseWant more?See Documentation. (Soon)Pull Requests?Will be welcomed, when we reached the firstbetaNote: The confused-argparsegithub repositoryis still private/closedDEVSupports latestpython3.7+poetryfor managing dependencies and build & publish topypywemake-python-packagefor steting up a out of the box ready building enviromentMinor tweaks to.gitignoreandMakefilegitfor version management ongithubgnu makefor runing tests and building docsjupyterfor quick tests and some developmentsphinxandreadthedocs.orgfor documentationtravisorGithub Actionsas the default CI@dependabotfor always up-to-date dependenciesmypyfor optional static typingpytestfor testingflake8andwemake-python-styleguidefor lintingLicenseMIT(c) 2020 Nikolai von KrusenstiernCreditsThis project was generated withwemake-python-package. Current template version is:69435b231f7f398474073ac6dd14868dd3edf2c1. See what isupdatedsince then.