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.3.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.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loremipsum_pro-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 080378978639cd39af2e1499383b448002e6b36fd865c1490fcb12f173507675
MD5 087292690d70d98774ecb30a72c69f88
BLAKE2b-256 47b6c92e7442c1eb01562f131e778624007e7509ed29fd3fefe15eff8dee1da9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loremipsum_pro-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3bced43a2b35ec2138db65d562c4571c4fd1167e2ea82d43b6df0dd1825c0383
MD5 e53060761a596ad444f5021ef67fd2ec
BLAKE2b-256 b91a3201d7511c3de1f09e930f2c38a40f71fdd1588154b9f0ab8378d47c21e7

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