Skip to content

Parser that parses Python's kwargs similar to the way done by setuptools, while exporting an interface like argparse

License

Notifications You must be signed in to change notification settings

Gaming32/kwargparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI PyPI - Format License PyPI - Downloads GitHub last commit GitHub wheel size in bytes GitHub top language

Using this tool

This tool's format is very similar to that of the argparse module. Example setup:

import kwargparse

_kwarg_parser = kwargparse.KeywordArgumentParser()
def _init_kwarg_parser():
    _kwarg_parser.add_argument('hello')
    subp = _kwarg_parser.add_subparser('sub', default={'world': 20})
    subp.add_argument('world', default=20)

def main(**kwargs):
    result = _kwarg_parser.parse_kwargs(kwargs)
    print(result)
    print(result.sub.world)

_init_kwarg_parser()

if __name__ == '__main__':
    main(
        hello = 1,
        sub = dict(
            world = 2,
        ),
    )

Installing

To install simply use:

$ pip3 install kwargparse

About

Parser that parses Python's kwargs similar to the way done by setuptools, while exporting an interface like argparse

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages