Pydantic-Choices
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
)
Release files for pydantic-choices 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic-choices-0.1.1.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_choices-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.9 kB
Release files / pydantic-choices-0.1.1.tar.gz
| Download URL | pydantic-choices-0.1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d7958c43c794f35b389df3a94b680ddfa8fd12da828188b70937b7550c46b8
|
|
BLAKE2b-256 checksum How to use checksums |
a51ae05a4ef626e0c48fffff25dc574541f621294186c6bbc0bfc415dcd3ffd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-109-generic
|
Release files / pydantic_choices-0.1.1-py3-none-any.whl
| Download URL | pydantic_choices-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
956c3e61073aabdd908e9aa4b7310445928f7d5ccde7c20823fc8e36cc697b56
|
|
BLAKE2b-256 checksum How to use checksums |
18d57012a12bb4c3f1248308f9838b70487d21160c882535810c844a342c0c4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.9 CPython/3.8.2 Linux/4.15.0-109-generic
|