Skip to main content

argparse_types

Special argparse types

How to install

pip install argparse-types

description

Additional types to use with argparse

how to use

Import argparse_types pass the argparse_types."type" to the type keyword in argparse.add_argument. Remember to pass not to call.

example.py

import argparse

import argparse_types


parser = argparse.ArgumentParser()
parser.add_argument("-n", dest="number", type=argparse_types.pos_int)
args = parser.parse_args()
print(args.number)

python3 example.py -n 34

34

python3 example.py -n -34

example.py: error: argument -n: -34 is an invalid positive int value

types

  • pos_int - Positive int value not including 0
  • neg_int - Negative int value not including 0
  • zero_int - Zero int value
  • pos_float - Positive float value not including 0
  • neg_float - Negative float value not including 0
  • zero_float - Zero float value
  • int_float - Any int or float value
  • bool_none - True, False, None value
  • ip4 - ip address 0.0.0.0 to 255.255.255.255 not including port

Metadata

Release files for argparse-types 0.2.0

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

Source distribution (sdist)

Source distribution for argparse-types 0.2.0
File Size Uploaded Provenance Actions
argparse_types-0.2.0.tar.gz 2.9 kB Without provenance Details for argparse_types-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argparse-types 0.2.0
File Interpreter ABI Platform Actions
argparse_types-0.2.0-py3-none-any.whl Python 3 none any Details for argparse_types-0.2.0-py3-none-any.whl

Total release size: 6.3 kB

Release files / argparse_types-0.2.0.tar.gz

Download URL argparse_types-0.2.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6908c7dd6cb36f15313ff85f74a3f3a8fa66e6d425bfb5126d59bc0711f2c149
BLAKE2b-256 checksum
How to use checksums
c12582fdd53b38db713f46ca6d7a63a2669003c56c2972b8f904f221d8052eb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Release files / argparse_types-0.2.0-py3-none-any.whl

Download URL argparse_types-0.2.0-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c59cb0dd19a0cf56d68aaed89607558d103423c0d78b24b6437729def3c0f9be
BLAKE2b-256 checksum
How to use checksums
84ab9139537c87bdecb4f8df26a0da4e71588637232c8d834911fc089f5ca0dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Security for argparse-types 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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