Skip to main content

Library to generate instances of Pydantic models.

Project description

Lorem Pysum

Library to generate instances of Pydantic models..

License: MIT Code style: black PyPI version Code Coverage

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


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.10.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

lorem_pysum-0.10.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file lorem-pysum-0.10.0.tar.gz.

File metadata

  • Download URL: lorem-pysum-0.10.0.tar.gz
  • Upload date:
  • Size: 5.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

Hashes for lorem-pysum-0.10.0.tar.gz
Algorithm Hash digest
SHA256 8293716f17c6cd0c6d6c5624e6e8ab0c27e9e695e78e2f3f5b702621e9f5f801
MD5 a686e5ccfeb49cdfdc494927896cae80
BLAKE2b-256 651b302574fb3b13421617cfa327be54491eac5ace7f59783335d39b32ce7358

See more details on using hashes here.

File details

Details for the file lorem_pysum-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: lorem_pysum-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 5.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

Hashes for lorem_pysum-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6820d05e00f34aa5a4cca046ffbee6d9343c10e57f4545d63b58d694ed9a8ea
MD5 c359185f612d3b14d9677df6afa9cc46
BLAKE2b-256 c08785728c13beee67b8e26ddb90993dbdc6b32b4a531903c0b046081bd477fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page