Skip to main content

pydantic-argparse-next

Argument parser based on pydantic v2.

Install:

pip install pydantic-argparse-next

Base usage:

from pydantic import BaseModel, Field
import pydantic_argparse_next as pa


class Temp(BaseModel):
    # Positional arguments
    a: str = pa.Arg(description="This is a required positional argument.")
    b: str = pa.Arg("defalut_value", description="This is a OPTIONAL positional argument.")

    # Keyword arguments
    # Simple attributes or pydantic.Field are keyword arguments.
    c: str
    d: str = Field(None, description="This is a OPTIONAL keyword argument.")
    e: str = pa.KwArg(description="This is a required keyword argument.")
Input: appname "test1" --c "test2" --e="test3"
Output: a='test1' b='defalut_value' c='test2' d=None e='test3'

More details in the documentation

Supports:

✅ Positional arguments

        ✅ Required positional arguments

        ✅ Optional positional arguments

✅ Keyword arguments

        ✅ Required keyword arguments

        ✅ Optional keyword arguments

✅ Subcommands

        ✅ Required subcommands

        ✅ Optional subcommands

        ✅ Subcommands within subcommands

✅ Actions

        ✅ Choice (And simple text and Enum object)

        ✅ Store True

        ✅ Store False

        ✅ Variadic arguments

⬜ Extra

        ⬜ Easy saving config to file

        ⬜ Easy load config from file

More details in the documentation

Docs and examples:

  1. Base usage

  2. Actions

    1. Choice

    2. Store True and Store False

    3. Subcommands

    4. Variadic

Metadata

Release files for pydantic-argparse-next 1.0.7

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

Source distribution (sdist)

Source distribution for pydantic-argparse-next 1.0.7
File Size Uploaded
pydantic_argparse_next-1.0.7.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-argparse-next 1.0.7
File Interpreter ABI Platform
pydantic_argparse_next-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / pydantic_argparse_next-1.0.7.tar.gz

Download URL pydantic_argparse_next-1.0.7.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
da703053ed528a49f952aca95a8907eb7241b79bea80c99dc13dc62188bb582f
BLAKE2b-256 checksum
How to use checksums
b7416a6a968981f1f98121ae08ba9a859e8f91a238d46739ebb95b4d2aecb249
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.4 Windows/11

Release files / pydantic_argparse_next-1.0.7-py3-none-any.whl

Download URL pydantic_argparse_next-1.0.7-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8c43680f2942038ecf6428c611e033275775e10f561cb7b8fb8735f5dfda983
BLAKE2b-256 checksum
How to use checksums
4d13d8d2a57e265ffa32b983a10810b0ec9ff0292a9ae63272f7dfeade51bbab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.4 Windows/11

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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