Library to generate instances of Pydantic models.
Project description
Lorem Pysum
Library to generate instances of Pydantic models..
Install
Lorem Pysum is on PyPI and can be installed with:
poetry add lorem-pysum
or
pip install lorem-pysum
Usage
Given a Pydantic model type Lorem Pysum can generate instances of that model with randomly generated values.
Example
from enum import auto, Enum
from uuid import UUID
import lorem_pysum
from pydantic import BaseModel
class Flavor(Enum):
MOCHA = auto()
VANILLA = auto()
class Brand(BaseModel):
brand_name: str
class Coffee(BaseModel):
id: UUID
description: str
cream: bool
sweetener: int
flavor: Flavor
brand: Brand
lorem_pysum.generate(Coffee)
# Result -> id=UUID('550342d5-13ce-4ee1-b73d-d3c5e81607ce') description='string' cream=True sweetener=0 flavor=<Flavor.MOCHA: 1> brand=Brand(brand_name='string')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lorem-pysum-0.12.2.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file lorem-pysum-0.12.2.tar.gz
.
File metadata
- Download URL: lorem-pysum-0.12.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.4.6-76060406-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da1575604ec179e18e1810ed20265ad111d9c4fe8441acb1887f35cb684d60bb |
|
MD5 | 12b5ede671bfa2ff53cfbd4de63682f7 |
|
BLAKE2b-256 | 3aaa8aaa0fa80e31a27144ae475ef6f53da358a44bde416de8a2ce9706056408 |
File details
Details for the file lorem_pysum-0.12.2-py3-none-any.whl
.
File metadata
- Download URL: lorem_pysum-0.12.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.4.6-76060406-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648bf3a89af68bc0df93e72b3ba700894b4e737cc35830458adc541795d6470b |
|
MD5 | ef411e751064fa5c51ba276353fc7fb9 |
|
BLAKE2b-256 | 857c636d56685ea46bf3b9b79efba51de3eed8c35edcbe0c7d46d5787811bfb8 |