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 -> Coffee(id=UUID('6cbe3fef-3617-4536-a8af-842221d4105b'), description='laboris', cream=True, sweetener=27, flavor=<Flavor.VANILLA: 2>, brand=Brand(brand_name='non'))
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.1.3.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file lorem-pysum-0.1.3.tar.gz
.
File metadata
- Download URL: lorem-pysum-0.1.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.6 Linux/6.0.6-76060006-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f98f7a2c3bbc3a213bba4eb8099df1235dcfcc33a83d4ccdbc64ffd7144a31 |
|
MD5 | a2f2199a9dcf889f565f04197ef8af2f |
|
BLAKE2b-256 | c2c6cfb43c40ca962c5076eb0037d9963eb720004fa9d2f2c9f654f70b21069b |
File details
Details for the file lorem_pysum-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: lorem_pysum-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.6 Linux/6.0.6-76060006-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec9f4cd4622a32e76a45f57c90a72b9ad56a0eddf6fa7bc1481b508ed1c80720 |
|
MD5 | fdac50d599d0a6aaa8c1eae205edb383 |
|
BLAKE2b-256 | b659f70cbaa0ae77ffe7287606ef160f20eac4709e3e1438414c6296520135dd |