Package: commandline-config
请您Star Please Star如果你觉得此工具不错，请轻轻点击此页面右上角Star按钮增加项目曝光度，谢谢！If you think this tool is good, please gently click theStarbutton in the upper right corner at this page to increase the project exposure, thank you!中文文档点此查看中文文档Easy-to-use Commandline Configuration ToolA library for users to write (experiment in research) configurations in Python Dict or JSON format, read and write parameter value viadot .in code, while can read parameters from the command line to modify values.标签 Labels： Python, Command Line, commandline, config, configuration, parameters, 命令行，配置，传参，参数值修改。Github URL:https://github.com/NaiboWang/CommandlineConfigNew Featuresv2.2.*Support infinite level nesting of parameters in dictionaryAutomatic version checkingSupport parameter value constrained to specified value (enumeration)Support for tuple typeSupport reading configuration from local JSON fileSupport for setting parameter help and printing parameter descriptions via command line-hDocumentation updates, provide simple exampleSimple Example# Install via pippipinstallcommandline_config# import packagefromcommandline_configimportConfig# Define configuration dictionaryconfig={"index":1,"lr":0.1,"dbinfo":{"username":"NUS"}}# Generate configuration class based on configuration dictc=Config(config)# Print the configuration of the parametersprint(c)# Read and write parameters directly via dot . and support multiple layers.c.index=2c.dbinfo.username="ZJU"print(c.index,c.dbinfo.username,c["lr"])# On the command line, modify the parameter values with --pythonexample.py--index3--dbinfo.usernameXDU# Get the parameter descriptions via the help method in the code, or on the command line via -h or -help (customization required, see detailed documentation below for details)c.help()pythonexample.py-hCatalogue请您Star Please Star中文文档Easy-to-use Commandline Configuration ToolNew Featuresv2.2.*Simple ExampleCatalogueUsagePlease submit issueInstallationConfiguration WayConfiguration parameters read and write methodWrite methodReading methodPass configuration to functionsCopy configurationStore configuration parameters to local file or databaseAdvanced optionsRestrict parameter input values to fixed enum typesPrint parameter help descriptionsSet parameter descriptionsPrint parameter helpThings need attentionConflict with ArgparseInput value forced conversionThe list parameter needs to be assigned with a backslash before the string element quotes when passing by commandlineQuotes are required for command-line assignment of tuple parameters, and string elements must be preceded by a backslashParameter naming conventionUnlimited layer of nested objectsParameter integrity check, all parameters to be modified must be predefinedSpecial configurations in zsh environmentFull conversion exampleExample Running ScriptShattered thoughtsTODOUsagePlease submit issueIf you encounter any problems during using with this tool, please raise an issue in the github page of this project, I will solve the bugs and problems encountered at the first time.Meanwhile, welcome to submit issues to propose what functions you want to add to this tool and I will implement them when possible.InstallationThere are two ways to install this library:Install via pip:pipinstallcommandline_configIf already installed, you can upgrade it by the following command:pipinstallcommandline_config--upgradeImport the commandline_config.py file directly from the/commandline_configfolder of the github project into your own project directory, you need to install the dependency packageprettytable:pipinstallprettytableOr install viarequirements.txt:pipinstall-rrequirements.txtConfiguration WayImport library:fromcommandline_configimportConfigSet the parameter name and initial value in JSON/Python Dict format, and add the parameter description by#comment. Currently supports nesting a dict inside another dict, andcan nest unlimited layers.preset_config={"index":1,# Index of party"dataset":"mnist",'lr':0.01,# learning rate'normalization':True,"pair":(1,2),"multi_information":[1,0.5,'test',"TEST"],# list"dbinfo":{"username":"NUS","password":123456,"retry_interval_time":5.5,"save_password":False,"pair":("test",3),"multi":{"test":0.01,},"certificate_info":["1",2,[3.5]],}}That is, the initial configuration of the program is generated. Each key defined inpreset_configdict is the parameter name and each value is the initial value of the parameter, and at the same time, the initial value type of the parameter is automatically detected according to the type of the set value.The above configuration contains seven parameters:index, dataset, batch, normalization, pair, multi_information and dbinfo, where the type of the parameterindexis automatically detected asint, the default value is1and the description is "Index of party".Similarly, The type and default value of the second to fifth parameter are string:"mnist"; float:0.01; bool:True; tuple:(1,2); list:[1,0.5,'test', "TEST"].The seventh parameter is a nested dictionary of type dict, which also contains 7 parameters, with the same type and default values as the first 7 parameters, and will not be repeated here.Create a configuration class object by passingpreset_configdict toConfigin any function you want.if__name__=='__main__':config=Config(preset_config)# Or give the configuration a name:config_with_name=Config(preset_config,name="Federated Learning Experiments")# Or you can store the preset_config in local file configuration.json and pass the filename to the Config class.config_from_file=Config("configuration.json")This means that the configuration object is successfully generated.Configuration of parameters can be printed directly viaprintfunction:print(config_with_name)The output results are:Configurations of Federated Learning Experiments:
+-------------------+-------+--------------------------+
|        Key        |  Type | Value                    |
+-------------------+-------+--------------------------+
|       index       |  int  | 1                        |
|      dataset      |  str  | mnist                    |
|         lr        | float | 0.01                     |
|   normalization   |  bool | True                     |
|        pair       | tuple | (1, 2)                   |
| multi_information |  list | [1, 0.5, 'test', 'TEST'] |
|       dbinfo      |  dict | See sub table below      |
+-------------------+-------+--------------------------+

Configurations of dict dbinfo:
+---------------------+-------+---------------------+
|         Key         |  Type | Value               |
+---------------------+-------+---------------------+
|       username      |  str  | NUS                 |
|       password      |  int  | 123456              |
| retry_interval_time | float | 5.5                 |
|    save_password    |  bool | False               |
|         pair        | tuple | ('test', 3)         |
|        multi        |  dict | See sub table below |
|   certificate_info  |  list | ['1', 2, [3.5]]     |
+---------------------+-------+---------------------+

Configurations of dict multi:
+------+-------+-------+
| Key  |  Type | Value |
+------+-------+-------+
| test | float | 0.01  |
+------+-------+-------+Here the information of all parameters will be printed in table format. If you want to change the printing style, you can modify it byconfig_with_name.set_print_style(style=''). The values that can be taken forstyleare:both,table,jsonwhich means print both table and json at the same time, print only table, and json dictionary only.E.g.:# Only print jsonconfig_with_name.set_print_style('json')print(config_with_name)print("----------")# Print table and json at the same timeconfig_with_name.set_print_style('table')print(config_with_name)The output results are:Configurations of Federated Learning Experiments:
{'index': 1, 'dataset': 'mnist', 'lr': 0.01, 'normalization': True, 'pair': (1, 2), 'multi_information': [1, 0.5, 'test', 'TEST'], 'dbinfo': 'See below'}

Configurations of dict dbinfo:
{'username': 'NUS', 'password': 123456, 'retry_interval_time': 5.5, 'save_password': False, 'pair': ('test', 3), 'multi': 'See below', 'certificate_info': ['1', 2, [3.5]]}

Configurations of dict multi:
{'test': 0.01}

----------
  
Configurations of Federated Learning Experiments:
+-------------------+-------+--------------------------+
|        Key        |  Type | Value                    |
+-------------------+-------+--------------------------+
|       index       |  int  | 1                        |
|      dataset      |  str  | mnist                    |
|         lr        | float | 0.01                     |
|   normalization   |  bool | True                     |
|        pair       | tuple | (1, 2)                   |
| multi_information |  list | [1, 0.5, 'test', 'TEST'] |
|       dbinfo      |  dict | See sub table below      |
+-------------------+-------+--------------------------+
{'index': 1, 'dataset': 'mnist', 'lr': 0.01, 'normalization': True, 'pair': (1, 2), 'multi_information': [1, 0.5, 'test', 'TEST'], 'dbinfo': 'See below'}

Configurations of dict dbinfo:
+---------------------+-------+---------------------+
|         Key         |  Type | Value               |
+---------------------+-------+---------------------+
|       username      |  str  | NUS                 |
|       password      |  int  | 123456              |
| retry_interval_time | float | 5.5                 |
|    save_password    |  bool | False               |
|         pair        | tuple | ('test', 3)         |
|        multi        |  dict | See sub table below |
|   certificate_info  |  list | ['1', 2, [3.5]]     |
+---------------------+-------+---------------------+
{'username': 'NUS', 'password': 123456, 'retry_interval_time': 5.5, 'save_password': False, 'pair': ('test', 3), 'multi': 'See below', 'certificate_info': ['1', 2, [3.5]]}

Configurations of dict multi:
+------+-------+-------+
| Key  |  Type | Value |
+------+-------+-------+
| test | float | 0.01  |
+------+-------+-------+
{'test': 0.01}Configuration parameters read and write methodWrite methodConfiguration parameter values can be written in three ways.To receive command line arguments, simply pass--index 1on the command line to modify the value ofindexto1. Also, the considerations for passing values to different types of arguments are：When passing bool type, you can use0orFalseforFalse,1orTrueorno value after the parameterforTrue:--normalization 1or--normalization Trueor--normalizationall can set the value of parameternormalizationin the configuration toTrue.When passing list type, empty array and multi-dimensional arrays can be passed.To modify the value in the nested dict, please use--nested-parameter-name.sub-parameter-name.sub-parameter-name.….sub-parameter-name valueto modify the value in the nested object, such as--dbinfo.password 987654to change the value of thepasswordparameter in thedbinfosubobject to987654;--dbinfo.multi.test 1to change the value of thetestparameter in themultidict which is indbinfosubobject to ```. Currently this tool can supports unlimited layers/levels of nesting.Note thatthe argument index must be in thepreset_configobject defined above:pythontest.py--dbinfo.password987654--dbinfo.multi.test1--index0--datasetemnist--normalization0--multi_information[\'sdf\',1,\"3.3\",,True,[1,[]]]Useconfig.index = 2directly in the code to change the value of the parameterindexto2. Again, list type parameters can be assigned as empty or multidimensional arrays. For nested objects, you can useconfig.dbinfo.save_password=Trueto modify the value of thesave_passwordparameter in sub dictdbinfotoTrue.Way 1 and 2 will trigger type checking, that is, if the type of the assigned value and the type of the default value in the predefined dictpreset_configdoes not match, the program will report an error, therefore, if you do not want to force type checking, you can useconfig["index"] = "sdf"to force the value of the parameter index to the stringsdf(not recommended, it will cause unexpected impact).Reading methodRead the value of the parameterdatasetdirectly by means ofconfig.datasetorconfig["dataset"].print(config.dataset,config["index"])The value of an argumentawill be read by this order: the last value modified byconfig.a = *> the value of--a 2specified by the command line > the initial value specified by"a":1defined by preset_config.For the list type, if a multidimensional array is passed, the information can be read via standard slice of python:config.dbinfo.certificate_info=[1,[],[[2]]]print(config.dbinfo.certificate_info[2][0][0])For parameters in a single nested object, there are four ways to read the values of the parameters, all of which can be read successfully:print(config.dbinfo.username)
print(config["dbinfo"].password)
print(config.dbinfo["retry_interval_time"])
print(config["dbinfo"]["save_password"])Pass configuration to functionsSimply pass the above config object as a parameter to the function and call it:defprint_dataset_name(c):print(c.dataset,c["dataset"],c.dbinfo.certificate_info)print_dataset_name(c=config)Copy configurationA deep copy of the configuration object can be made by thedeepcopymethod:fromcopyimportdeepcopycopy_config=deepcopy(config)# Modify new configuration's parameter value, will not affect the orignal configurationcopy_config.index=15Store configuration parameters to local file or databaseThe entire parameter configuration can be stored to a local file or uploaded to a remote server such as mongodb, simply byconfig.save()storing the configuration as aconfig name (or config if there is no name).jsonfile in the directory, or you can specify the file name and path as follows:config.save("config/test_config.json")Then we successfully save the configuration to the localconfiguration.jsonfile inside theconfigfolder. The file content is as follows:{"index":1,"dataset":"mnist","lr":0.01,"normalization":true,"pair":[1,2],"multi_information":[1,0.5,"test","TEST"],"dbinfo":{"username":"NUS","password":123456,"retry_interval_time":5.5,"save_password":false,"pair":["test",3],"multi":{"test":0.01},"certificate_info":["1",2,[3.5]]}}To store it into the database such asmongodb, you need to get the json sequence first corresponding to the parameters with theinfo = config.get_config()command, and serialize it with thejsonlibrary.For example, to store theconfig_with_nameconfiguration tomongodb:importpymongomyclient=pymongo.MongoClient('mongodb://username:example.com:27017/',connect=False)mydb=myclient['exps']table=mydb["table"]# Get the configurationsconfiguration=config.get_config()# Insert configuration dict into mongodb tabletable.insert_one(configuration)# Or make configuration as part of a bigger dictall_info={"exp_time":"20220925","configuration":configuration}table.insert_one(all_info)Note that tuples are not supported by JSON, so whether stored locally or in a database, tuple arguments will be converted to lists.Advanced optionsRestrict parameter input values to fixed enum typesSet advanced options, such as enumerating Enum types, by passing theoptionsparameter of theConfigargument to theConfigclass.option={}config=Config(preset_config,options=option)If you want to limit the value of a parameter to a certain range, you can do so by configuring:advanced_options={'lr':{"enum":[0.001,15.5,0.01,0.1]# restrict the lr value to one of 0.001, 15.5, 0.01, 0.1},'index':{"enum":[1,2,3]# Restrict the index value to 1, 2 and 3},"dbinfo":{"username":{"enum":["XDU","ZJU","NUS"]# restrict the dbinfo.username field to XDU, ZJU and NUS},"multi":{"test":{"enum":[1,0.1,0.01,15]# 3 layers nested}}},}config=Config(preset_config,options=advanced_options)If enum is set, the following three ways to set a parameter to a value other than the qualified/speficied value will all report an error.The initial value ofindexis set to a value other than1,2,3inpreset_config:preset_config={"index":4,}The command line passes unqualified/unspecified values for thelrargumentpythonexample.py--lr0.02The code changes the value ofdbinfo.usernameto a value other thanXDU, ZJU and NUS.config.dbinfo.username="UEST"The output are:AttributeError:Cannotsetvalue4becausethekey'index'hassetenumlistandyouthevalue4isnotintheenumlist[1,2,3]!

AttributeError:Cannotsetvalue0.02becausethekey'lr'hassetenumlistandyouthevalue0.02isnotintheenumlist[0.001,15.5,0.01,0.1]!

AttributeError:Cannotsetvaluenusbecausethekey'username'hassetenumlistandyouthevaluenusisnotintheenumlist['XDU','ZJU','NUS']!Print parameter help descriptionsSet parameter descriptionsSet the parameter description helpers by specifying thehelpersparameter in theConfigclass.helpers={"index":"index of information","dbinfo_help":"information dict for database","dbinfo":{"username":"username for database","multi":{"test":"test information"}}}config=Config(preset_config,helpers=helpers)Note that since thedbinfoparameter is adict, if you want to set the parameter description fordbinfo, you need to set adbinfo_helpparameter to write the description in thehelpersdictionary, i.e. add_helpafter the dict parameter name to set the parameter description for the dict field.Print parameter helpTwo ways to print parameter descriptions, by passing-hor-helpon the command line, or by calling thehelp()function in code.config_with_name.help()orpythonexample.py-h# ORpythonexample.py-helpNote that it is only one short slash-and no other command line arguments be added to get help instructions, and the output of both methods is:Parameter helps for Federated Learning Experiments:
+-------------------+-------+-------------------------------+
|        Key        |  Type | Comments                      |
+-------------------+-------+-------------------------------+
|       index       |  int  | index of information          |
|      dataset      |  str  | -                             |
|         lr        | float | -                             |
|   normalization   |  bool | -                             |
|        pair       | tuple | -                             |
| multi_information |  list | -                             |
|       dbinfo      |  dict | information dict for database |
+-------------------+-------+-------------------------------+

Parameter helps for dict dbinfo:
+---------------------+-------+-----------------------+
|         Key         |  Type | Comments              |
+---------------------+-------+-----------------------+
|       username      |  str  | username for database |
|       password      |  int  | -                     |
| retry_interval_time | float | -                     |
|    save_password    |  bool | -                     |
|         pair        | tuple | -                     |
|        multi        |  dict | Multiple Parameters   |
|   certificate_info  |  list | -                     |
+---------------------+-------+-----------------------+

Parameter helps for dict multi:
+------+-------+------------------+
| Key  |  Type | Comments         |
+------+-------+------------------+
| test | float | test information |
+------+-------+------------------+Things need attentionConflict with ArgparseThis library cannot read command line arguments at the same time with the argparse library, so please do not useargs = parser.parse_args()to read command line arguments while using this library.Input value forced conversionThe type of the parameter will be automatically detected as the same type of the initial value set inpreset_config, and the value of the command line parameter will be forced converted to the corresponding type value, such as the default value ofindexin the abovepreset_configdict is1, then the type of the parameter index isintwith the initial value of1. If you specify--index 15.5on the command line, the parameterindexwill be automatically assigned to value15, that is,15.5will be automatically forced converted tointtype.If the parameter value specified on the command line parameters can not be forcedly converted to specific type, it will report an error, such as if the command line specified--index sdf, as sdf with orignal format ofstringcan not be converted tointtype, so it will report an error.The list parameter needs to be assigned with a backslash before the string element quotes when passing by commandlineWhen the command line argument is set to the inputlisttype, if the element in the list is astring,you must use add abackslash \before eachsingle/double quoteto parse it correctly, otherwise the argument value will be treated as anintorfloattype. If there arespacesin the command line they will be merged automatically (but the command line environment can not bezsh, if it is zsh environment then must remove all the spaces inside the list,bashandshdoes not have this problem, that is, in the zsh environment, you cannot add any space(s) between15and\'12\'in--a [15,\'12\']).If the parameters can be set as follows:python test.py --array [1,2.3,\'sdf\']That can correctly resolve the array parameter whose value is alist, and the content of[1,2.3,'sdf', "qwe"], that is, a list containing int, float, string type of data simultaneously.Quotes are required for command-line assignment of tuple parameters, and string elements must be preceded by a backslashWhen the command line parameter is set to the inputtupletype, the specified tuple type value must be enclosed inquotes; and if the element in the tuple is astring, abackslashmust be added before each single/double quote\for proper parsing, otherwise the parameter value will be treated as anintorfloattype. Similarly, if there arespacesin the command line they will be merged automatically (but the command line environment cannot bezsh, if it is zsh environment then all internal spaces must be removed, bash and sh do not have this problem).For example, the parameter can be set topython test.py --pair "(1,2,\'msg\')"The value of the pair parameter is a tuple of type(1,2, "msg"), i.e. a tuple of typeint,float,string.Parameter naming conventionIf the parameter name contains special characters such as-+.orspaceorother python reserved characters, you must use themiddle bracket []to read and write the parameter value instead of.E.g., if the parameter name ismulti-information, it can only be accessed byconfig["multi-information"], cannot doconfig.multi-information, because the minussign -is a python language's reserved symbol.Unlimited layer of nested objectsNow the tool can support unlimited layers of nesting, other supported parameter types are:int, float, string, bool, tuple and list.Parameter integrity check, all parameters to be modified must be predefinedThe name of the parameter passed on the command linemust be defined inpreset_configin advance, otherwise an error will be reported, e.g.pythontest.py--arg11Since the parameter namearg1is not defined inpreset_configdict, an error is reported indicating that thearg1parameter is not defined. This function is set to perform parameter integrity checking to avoid entering incorrect parameter names through the command line.Special configurations in zsh environmentIfzsh: no matches foundoccurs when passing list arguments in the zsh Shell environment, please add a linesetopt no_nomatchat the end of the~/.zshrcfile, after save it then runsource ~/.zshrcon the command line to refresh zsh, then the problem will be solved.Full conversion exampleAn example will be given below to demonstrate the convenience of this tool compared to theargparsetool.The code that needs to be written using theargparsetool:parser=argparse.ArgumentParser(description='PyTorch local error training')parser.add_argument('--model',default='vgg8b',help='model, mlp, vgg13, vgg16, vgg19, vgg8b, vgg11b, resnet18, resnet34, wresnet28-10 and more (default: vgg8b)')parser.add_argument('--dataset',default='CIFAR10',help='dataset, MNIST, KuzushijiMNIST, FashionMNIST, CIFAR10, CIFAR100, SVHN, STL10 or ImageNet (default: CIFAR10)')parser.add_argument('--batch-size',type=int,default=128,help='input batch size for training (default: 128)')parser.add_argument('--num-layers',type=int,default=1,help='number of hidden fully-connected layers for mlp and vgg models (default: 1')parser.add_argument('--lr',type=float,default=5e-4,help='initial learning rate (default: 5e-4)')parser.add_argument('--lr-decay-milestones',nargs='+',type=int,default=[200,300,350,375],help='decay learning rate at these milestone epochs (default: [200,300,350,375])')parser.add_argument('--optim',default='adam',help='optimizer, adam, amsgrad or sgd (default: adam)')parser.add_argument('--beta',type=float,default=0.99,help='fraction of similarity matching loss in predsim loss (default: 0.99)')args=parser.parse_args()args.cuda=notargs.no_cudaandtorch.cuda.is_available()ifargs.cuda:cudnn.enabled=Truecudnn.benchmark=TrueCode to be written after conversion with this tool:''':param model: model, mlp, vgg13, vgg16, vgg19, vgg8b, vgg11b, resnet18, resnet34, wresnet28-10 and more (default: vgg8b):param dataset: dataset, MNIST, KuzushijiMNIST, FashionMNIST, CIFAR10, CIFAR100, SVHN, STL10 or ImageNet (default: CIFAR10):param batch-size: input batch size for training (default: 128):param num-layers: number of hidden fully-connected layers for mlp and vgg models (default: 1):param lr: initial learning rate (default: 5e-4):param lr-decay-milestones: decay learning rate at these milestone epochs (default: [200,300,350,375]):param optim: optimizer, adam, amsgrad or sgd (default: adam):param beta: fraction of similarity matching loss in predsim loss (default: 0.99)'''config={'model':'vgg8b','dataset':'CIFAR10','batch-size':128,'num-layers':1,'lr':5e-4,'lr-decay-milestones':[200,300,350,375],'optim':'adam','beta':0.99,}args=Config(config,name='PyTorch local error training')args.cuda=notargs.no_cudaandtorch.cuda.is_available()ifargs.cuda:cudnn.enabled=Truecudnn.benchmark=TrueAs we can see, the amount of code has been reduced and is more structured and neat.Another case with library click:importclick@click.command()@click.option('--count',default=1,help='Number of greetings.')@click.option('--name',prompt='Your name',help='The person to greet.')defhello(count,name):"""Simple program that greets NAME for a total of COUNT times."""forxinrange(count):click.echo(f"Hello{name}!")if__name__=='__main__':hello()Can be converted to the following code:fromcommandline_configimportConfigdefhello(o):"""Simple program that greets NAME for a total of COUNT times."""forxinrange(o.count):print(f"Hello{o.name}!")if__name__=='__main__':args={"count":1,# Number of greetings."name":"",# The person to greet.}options=Config(args)hello(options)Example Running ScriptYou can runexample.pyin the Github project to test the whole tool, most functions's codes had been provided inside the file:# Get help for all parameters of example.py
python example.py -h
# Specify parameter values
python example.py --dbinfo.multi.test 0.01 --dbinfo.username NUSShattered thoughtsThe following describes the author's personal reasons for developing and the benefits/conveniences of this package.For us who often run research experiments, do you often need to set a lot of command line arguments at the beginning of a python file and call them in the following code asargs.*：For example, the following example paragraph:parser=argparse.ArgumentParser(description='index')parser.add_argument('--index',default=0,type=int,help='party index')parser.add_argument('--party_num',default=100,type=int)args=parser.parse_args()print(args.index)With one more additional parameter, we need to write one line ofparser.add_argument(...), when handwriting configuration of each parameter, it will be very tedious such as the name needs to add --, and modify the default value, type and description of the time is very troublesome, finally will lead to very long code and inconvenient to maintain.Even if you use a more advanced libraryclick, you still need to write option constantly, and you need to write the same amount of parameters at the input parameter field of the function to match all the option, writing code is really tedious, such as the following Click code:importclickfromcaesar_encryptionimportencrypt@click.command()@click.argument('text',nargs=-1)@click.option('--decrypt/--encrypt','-d/-e')@click.option('--key','-k',default=1)defcaesar(text,decrypt,key):text_string=' '.join(text)ifdecrypt:key=-keycyphertext=encrypt(text_string,key)click.echo(cyphertext)if__name__=='__main__':caesar()I don't want to specify option over and over again when writing code, and write a lot of corresponding parameters in the function name parameter field, which is very troublesome.So would it make the code look more structured and clearer if the parameter configuration could be written in the format of Python objects/JSON?Also, is it possible to directly read and write command line arguments as if they were Python objects, or deep copy them, as if no command line arguments had been configured?Most importantly, can we make the process of writing code faster, instead of adding a little bit of configuration line by line?In order to solve the above pain points, this tool has been developed.My goal is to make it easier for us to write more concise codes that works as the same as verbose command line parsing packages like Argparse or Click, while also making the configuration look structured and easy to maintain. Json was chosen because the Python dictionary type Dict is native in JSON format, so can make the same format as Python code. In this way, the configuration information can be directly embedded in the Python code file (anywhere), without the need to establish a separate configuration file such as TOML. At the same time, you can use the library to write the configuration at any position within the code file to read the command line parameters and modify the value of each field at any time.Similar tools including:NameAdvantageDisadvantageFireCan direct do conversion of function parameters to command line parametersCannot pass parameters to other functions.hydraEasy to read and write to yamlNeed additional yaml file with specifed path, also cannot perform integrity check and type conversion/check, not friendly for printingml_collectionsSimilar functionality to this tool with more configurable itemsA little tideous to pass commandline parameters, when nesting need to artificially set specifed Class, and also without integrity check, not friendly for printingTODOWelcome to submit issues to propose what functions you want to add to this tool and I will implement them when possible.Advanced options to support more advanced features such as commandline style (instead of use --, can change to - or +), etc.