Skip to main content

No project description provided

Project description

Pydantic-Choices

Build Status PyPI version Codcov

How to use

from pydantic_choices import choice

import pydantic as pd


Licenses = choice(["GPL", "GPLv3+", "MIT", "MPL 2.0"])


class Project(pd.BaseModel):
    id: str
    url: str
    license: Licenses


# Validation passes
Project(
    id="pydantic_choices",
    url="https://github.com/vinissimus/pydantic-choices",
    license="MIT",
)

# Validation fails
p1 = Project(
    id="pydantic_choices",
    url="https://github.com/vinissimus/pydantic-choices",
    license="propietary",  # value not in choice
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-choices-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pydantic_choices-0.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file pydantic-choices-0.1.1.tar.gz.

File metadata

  • Download URL: pydantic-choices-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-109-generic

File hashes

Hashes for pydantic-choices-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86d7958c43c794f35b389df3a94b680ddfa8fd12da828188b70937b7550c46b8
MD5 00ff505e2c1d8600c8534398073344f8
BLAKE2b-256 a51ae05a4ef626e0c48fffff25dc574541f621294186c6bbc0bfc415dcd3ffd9

See more details on using hashes here.

File details

Details for the file pydantic_choices-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pydantic_choices-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-109-generic

File hashes

Hashes for pydantic_choices-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 956c3e61073aabdd908e9aa4b7310445928f7d5ccde7c20823fc8e36cc697b56
MD5 565c0a41b6c2efee05b56eb1d400ca17
BLAKE2b-256 18d57012a12bb4c3f1248308f9838b70487d21160c882535810c844a342c0c4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page