Metadata-Version: 2.1
Name: pydantic-choices
Version: 0.1.1
Summary: 
Home-page: https://github.com/vinissimus/pydantic-choices
License: MIT
Author: Jordi Masip
Author-email: jordi@masip.cat
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Project-URL: Repository, https://github.com/vinissimus/pydantic-choices
Description-Content-Type: text/markdown

# Pydantic-Choices

[![Build Status](https://travis-ci.com/vinissimus/pydantic-choices.svg?branch=master)](https://travis-ci.com/vinissimus/pydantic-choices) [![PyPI version](https://badge.fury.io/py/pydantic-choices.svg)](https://badge.fury.io/py/pydantic-choices) ![](https://img.shields.io/pypi/pyversions/pydantic-choices.svg) [![Codcov](https://codecov.io/gh/vinissimus/pydantic-choices/branch/master/graph/badge.svg)](https://codecov.io/gh/vinissimus/pydantic-choices/branch/master) ![](https://img.shields.io/github/license/vinissimus/pydantic-choices)

## How to use

```python
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
)
```

