Skip to main content

A lightweight Python library for generating Lorem Ipsum placeholder text with zero dependencies

Project description

Lorem Ipsum Generator

A simple, lightweight, and flexible Lorem Ipsum text generator for python. Generate placeholder text in various formats including words, sentences, paragraphs, and lists.

Visit our website: lorem ipsum generator

Features

  • 🚀 Zero dependencies
  • 📦 Lightweight (~2KB)
  • 🎯 Multiple output formats
  • 🌐 Online generator available at www.loremipsums.org

Installation

pip install loremipsum

Usage

This package provides two APIs:

  1. The static Lorem class (original API)
  2. The object-oriented LoremIpsum class with a pre-created loremIpsum instance (new API)

Original API - Static Lorem Class

from loremipsum import Lorem

# Generate a single random word
word = Lorem.word()
print(word)

# Generate multiple words
words = Lorem.words(5)
print(words)

# Generate a sentence (random word count between 3-15 if not specified)
sentence = Lorem.sentence()
print(sentence)
# Or with specific word count
sentence = Lorem.sentence(10)
print(sentence)

# Generate multiple sentences
sentences = Lorem.sentences(3)
print(sentences)

# Generate a paragraph (random sentence count between 3-7 if not specified)
paragraph = Lorem.paragraph()
print(paragraph)
# Or with specific sentence count
paragraph = Lorem.paragraph(5)
print(paragraph)

# Generate multiple paragraphs
paragraphs = Lorem.paragraphs(3)
print(paragraphs)
# Customize paragraph separator (default is "\n\n")
paragraphs = Lorem.paragraphs(3, separator="\n---\n")
print(paragraphs)

New API - LoremIpsum Class

from loremipsum import loremIpsum, LoremIpsum

# Use the pre-created singleton instance
# Generate words (default: 10 words)
text = loremIpsum.generateWords()
print(text)

# Generate words with capitalization
text = loremIpsum.generateWords(5, capitalize=True)
print(text)

# Generate text with specific byte size
text = loremIpsum.generateBytes(100)
print(f"{text} ({len(text.encode('utf-8'))} bytes)")

# Generate sentences (default: 3 sentences)
text = loremIpsum.generateSentences(3)
print(text)

# Generate paragraphs (default: 1 paragraph)
text = loremIpsum.generateParagraphs(2)
print(text)

# Generate paragraphs without line breaks
text = loremIpsum.generateParagraphs(2, withLineBreaks=False)
print(text)

# Generate a bullet list
text = loremIpsum.generateList(5, style="bullet")
print(text)

# Generate a numbered list
text = loremIpsum.generateList(5, style="number")
print(text)

# Generate a list with no formatting
text = loremIpsum.generateList(5, style="none")
print(text)

# Create a custom instance with your own words
custom_lorem = LoremIpsum(words=["hello", "world", "python", "programming"])
text = custom_lorem.generateSentences(2)
print(text)

License

MIT

Acknowledgements

This project was inspired by various Lorem Ipsum generators.

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

loremipsum_pro-0.1.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loremipsum_pro-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file loremipsum_pro-0.1.2.tar.gz.

File metadata

  • Download URL: loremipsum_pro-0.1.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for loremipsum_pro-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d6168d317ab43defd51ea52e1345fe19f02b3031a5f784eaaddabb59b695d24c
MD5 647baf6d6e29a3a6fd0ef11ab0a61fc6
BLAKE2b-256 1829a586d77178b6bc6029599c782691e81c41139d37a82478c6b7b6eb6d3356

See more details on using hashes here.

File details

Details for the file loremipsum_pro-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: loremipsum_pro-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for loremipsum_pro-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92e8d50fb5f9a04bbb0a61691b6e9165ff9894e724b252c1c8cbfb08a29b2b75
MD5 4029fe14ab6204c43627b794ef5e5c28
BLAKE2b-256 4eaeae28869646ab3f14fb4bc315834aead2a76ea8f0756759302bff0bb06336

See more details on using hashes here.

Supported by

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