---
title: "argparse-addons | pypx"
description: "Additional argparse types and actions."
canonical_url: "https://pypx.app/packages/argparse-addons"
meta:
  "og:description": "Additional argparse types and actions."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_argparse-addons%2Cversion_0.12.0%2Csummary_Additional%2Bargparse%2Btypes%2Band%2Bactions.%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9hcmdwYXJzZS1hZGRvbnMi%2Cs_ttxZCc6F-ass1g2Q.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "argparse-addons 0.12.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_argparse-addons%2Cversion_0.12.0%2Csummary_Additional%2Bargparse%2Btypes%2Band%2Bactions.%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9hcmdwYXJzZS1hZGRvbnMi%2Cs_ttxZCc6F-ass1g2Q.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **argparse-addons**

v0.12.0

Additional argparse types and actions.

3 KB Python 3.6+ py3-none-anyMIT License Likely Unmaintained

[** Diff **](https://pypx.app/packages/argparse-addons/diff)

`$ uv add argparse-addons`

# About

Additional Python argparse types and actions.

Project homepage: https://github.com/eerimoq/argparse\_addons

# Installation

```text
$ pip install argparse_addons
```

# Examples

## Integer type

The script. See `examples/integer.py`\_ for the complete script.

```python
parser.add_argument('--min-max',
                    type=argparse_addons.Integer(0, 255))
parser.add_argument('--min',
                    type=argparse_addons.Integer(0, None))
parser.add_argument('--max',
                    type=argparse_addons.Integer(None, 255))
parser.add_argument('--any',
                    type=argparse_addons.Integer())
```

Error message for the --min-max argument.

```text
$ python3 examples/integer.py --min-max -1
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --min-max: -1 is not in the range 0..255
```

Error message for the --min argument.

```text
$ python3 examples/integer.py --min -1
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --min: -1 is not in the range 0..inf
```

Error message for the --max argument.

```text
$ python3 examples/integer.py --max 1000
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --max: 1000 is not in the range -inf..255
```

Error message for the --any argument.

```text
$ python3 examples/integer.py --any a
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --any: invalid integer value: 'a'
```

All values within allowed ranges.

```text
$ python3 examples/integer.py --min-max 47 --min 1000 --max -5 --any 1
--min-max: 47
--min:     1000
--max:     -5
--any:     1
```

# Contributing

#. Fork the repository.

#. Install prerequisites.

```text
pip install -r requirements.txt
```

#. Implement the new feature or bug fix.

#. Implement test case(s) to ensure that future changes do not break legacy.

#. Run the tests.

```text
make test
```

#. Create a pull request.

## **Details **

<dl>

<dt>Version</dt>
<dd>0.12.0</dd>

<dt>License</dt>
<dd>MIT License</dd>

<dt>Python</dt>
<dd>&gt;=3.6</dd>

<dt>Maintainer</dt>
<dd>Erik Moqvist</dd></dl>

## **Links**

- [Homepage](https://github.com/eerimoq/argparse_addons)
- [View on PyPI](https://pypi.org/project/argparse-addons/)

## **Maintainers **

- Erik Moqvist · [erik.moqvist@gmail.com](mailto:erik.moqvist@gmail.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/argparse-addons#webpage","@type":"WebPage","description":"Additional argparse types and actions.","name":"argparse-addons","url":"https://pypx.app/packages/argparse-addons","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/argparse-addons"]}]},{"@id":"https://pypx.app/packages/argparse-addons#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Additional argparse types and actions.","license":"MIT License","name":"argparse-addons","softwareVersion":"0.12.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
