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 -> id=UUID('550342d5-13ce-4ee1-b73d-d3c5e81607ce') description='string' cream=True sweetener=0 flavor=<Flavor.MOCHA: 1> brand=Brand(brand_name='string')

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

Uploaded Source

Built Distribution

lorem_pysum-0.14.9-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for lorem-pysum-0.14.9.tar.gz
Algorithm Hash digest
SHA256 e8e4c39f2e40b885dd26594feb745704082edcd842dcedf2d48aa573ce8f3c4f
MD5 641f3013ea6a1b96ab9643f04eeaafaf
BLAKE2b-256 0e666aac881c5c0dbbbdf09d16a1d0c62be01b0f1a551790460e2e82d75a2f00

See more details on using hashes here.

File details

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

File metadata

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

Hashes for lorem_pysum-0.14.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2c143918d7aaa509b65dbeb2a12ca0d6c3a95b05f88b89f3527e962a0d7397
MD5 679e17a9f69af28494158076ae25bc69
BLAKE2b-256 2168b3ae254ffa2bf243b3c9ed29abd412c6b06e93b7824103174baf192572b7

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