Socket
Book a DemoInstallSign in
Socket

pydantic-cli-model

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pydantic-cli-model

Parse cli arguments directly into Pydantic models with help from click!

pipPyPI
Version
0.1.5
Maintainers
1

Pydantic CLI Models

Pydantic + Click == Perfection (with love to Rust's clap library)

Github

Issues

Reduce boilerplate by 2x (at least), turning this:

import click
from pydantic import BaseModel

class Person(BaseModel):
    name: str
    age: int

@click.command()
@click.option("--name", type=str)
@click.option("--age", type=int)
def main(name, age):
    person = Person(name=name, age=age)
    # ... do something with person ...

Into this:

from pydantic_cli_model import CLIModel


class Person(CLIModel):
    name: str
    age: int

@Person.cli
def main(person:Person):
    ...
    # ... do something with person ...

And get data validation for free!

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts