Skip to main content

Library to generate instances of Pydantic models.

Project description

Lorem Pysum

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

Uploaded Source

Built Distribution

lorem_pysum-1.4.7-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file lorem_pysum-1.4.7.tar.gz.

File metadata

  • Download URL: lorem_pysum-1.4.7.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/6.11.6-300.fc41.x86_64

File hashes

Hashes for lorem_pysum-1.4.7.tar.gz
Algorithm Hash digest
SHA256 80548bb924f59c2687f43caeb671715d53177be36174bde9b8a316eb085d2a7a
MD5 675b692c8ef6470534196162adcd5d5a
BLAKE2b-256 40373f3d87f7ef3588a8dbaca0375027117632cd4d65ed336b55c241564a791e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lorem_pysum-1.4.7-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/6.11.6-300.fc41.x86_64

File hashes

Hashes for lorem_pysum-1.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 460274492a9938f21944a7713ba813d2588b26f9657c892fcc32508bdfcc7c80
MD5 f644e37307362ae377002ba2493eb8ee
BLAKE2b-256 b166ae4b352f4b6dd7095dc69dfb22b7782c8ff5a7ba28df88a72dc988159dfb

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