Skip to main content

duckargs

The purpose of this package is to save some typing whenever you want to quickly create a python program that accepts command line arguments. Just run duckargs with the arguments that you want your program to accept, with example values for options, and duckargs will generate the python code for a program that uses argparse to handle those arguments.

Example

Run duckargs from the command line via python -m duckargs, followed by whatever arguments/options/flags you want your program to accept, and duckargs will print the corresponding python code.

$ python -m duckargs -i --intval 4 -f 3.3 -F --file file_that_exists -a -b -c positional_arg

import argparse

def main():
    parser = argparse.ArgumentParser(description='',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument('-i', '--intval', default=4, type=int, help='an int value')
    parser.add_argument('-f', default=3.3, type=float, help='a float value')
    parser.add_argument('-F', '--file', default='file_that_exists', type=argparse.FileType('w'), help='a filename')
    parser.add_argument('-a', action='store_true')
    parser.add_argument('-b', action='store_true')
    parser.add_argument('-c', default='positional_arg', help='a string')
    args = parser.parse_args()

if __name__ == "__main__":
    main()

Release files for duckargs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for duckargs 0.1.0
File Interpreter ABI Platform
duckargs-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / duckargs-0.1.0-py3-none-any.whl

Download URL duckargs-0.1.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b6e0a19cff72230a66852fd1401cc1f7f44c7084afa25c82fc1a722d9e179bd
BLAKE2b-256 checksum
How to use checksums
ac261bce06e2422b8ef5a6a27145655e2bf59e8c4201e894155024f6c3dce082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

1.5.1

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page