Library to generate instances of Pydantic models.
Project description
Lorem Pysum
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-1.0.1.tar.gz
(6.1 kB
view details)
Built Distribution
File details
Details for the file lorem-pysum-1.0.1.tar.gz
.
File metadata
- Download URL: lorem-pysum-1.0.1.tar.gz
- Upload date:
- Size: 6.1 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 | f3ae6634caf0f525979a7f64b2e7fc20e520c5084dc61806600cbef6d67af4c3 |
|
MD5 | bc798c03a6b46dfc316f9ee5c5c0ccde |
|
BLAKE2b-256 | 4bfce0f5c8e5397ea85406538a7a4bfa1d479374ecb2383c2bd5d40bb5a5cc4e |
File details
Details for the file lorem_pysum-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: lorem_pysum-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 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 | 2ffb819a5007f7d924b8dc808c120283ac2767506c11b5c49bfbac0b1ee8ac14 |
|
MD5 | d3e609a8382c4a2e69d06a41744731d4 |
|
BLAKE2b-256 | d2543eb6e789d3f7c8ec7be133f322de83ef2158d2a1c8f265cfc13198df159f |