Skip to main content

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

Project description

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

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

kwargparse-1.0.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

kwargparse-1.0.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file kwargparse-1.0.0.tar.gz.

File metadata

  • Download URL: kwargparse-1.0.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for kwargparse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9290d59567438ad20b8adb07d7b006daa629be1fa2fda10cef6229bf8da46996
MD5 6e4d9257ddb63d448946155e72719082
BLAKE2b-256 1e7cb55be4d53506826a7c4e9082935c9badb6d73d98cae2cb7cca9159108738

See more details on using hashes here.

File details

Details for the file kwargparse-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kwargparse-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for kwargparse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a403a25f2b8fbbe96948f1f96f1c6ee0fb7a328699d69f785ece951d48ec875
MD5 33e2cccc932268ba8c35158ead2a646f
BLAKE2b-256 d0788e0b098bff711bb8f2d15a06cce5f945f5030e876cba3ee8aa512e860af3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page