Skip to main content

lorem_gen

lorem_gen is a lightweight Python package and command-line tool that generates Lorem Ipsum placeholder text. It supports generating a specified number of words, sentences, or paragraphs. This package can be used both as a CLI and as an importable library in other Python projects.

Features

  • Generate a custom number of Lorem Ipsum words, sentences, or paragraphs.
  • Simple, dependency-free implementation (built-in Python standard library only).
  • CLI interface via the genrqtor command.
  • Programmatic API through the LoremGenerator class.

Installation

Install lorem_gen in editable (development) mode or as a regular package. It requires Python 3.8 or newer.

# (Optional) Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Upgrade packaging tools
pip install --upgrade pip setuptools wheel

# Install lorem_gen in editable mode
pip install -e .

After installation, the package is importable via import lorem_gen and the CLI command genrqtor is registered on your PATH.

Usage

Command-Line Interface (CLI)

The tool is exposed as genrqtor. Run the following for help:

genrqtor --help

Output:

usage: genrqtor [-h] [--words WORDS | --sentences SENTENCES | --paragraphs PARAGRAPHS]

Generate Lorem Ipsum text.

optional arguments:
  -h, --help           show this help message and exit
  --words WORDS        Number of words to generate (e.g., --words 50).
  --sentences SENTENCES
                       Number of sentences to generate (e.g., --sentences 5).
  --paragraphs PARAGRAPHS
                       Number of paragraphs to generate (e.g., --paragraphs 2).

Examples:

  • Generate 50 words of Lorem Ipsum:

    genrqtor --words 50
    
  • Generate 5 sentences of Lorem Ipsum:

    genrqtor --sentences 5
    
  • Generate 2 paragraphs of Lorem Ipsum:

    genrqtor --paragraphs 2
    
  • Default (no flags) generates a single paragraph:

    genrqtor
    

Programmatic API

You can also use lorem_gen in your own Python code by importing the LoremGenerator class.

from lorem_gen.generator import LoremGenerator

# Generate 20 words:
gen_words = LoremGenerator(words=20)
print(gen_words.generate())

# Generate 3 sentences:
gen_sentences = LoremGenerator(sentences=3)
print(gen_sentences.generate())

# Generate 2 paragraphs:
gen_paragraphs = LoremGenerator(paragraphs=2)
print(gen_paragraphs.generate())

API Reference

  • LoremGenerator(words: int = 0, sentences: int = 0, paragraphs: int = 0)

    • Constructor. Specify exactly one of words, sentences, or paragraphs to control output. If none provided, defaults to 1 paragraph.
  • LoremGenerator.generate() -> str

    • Returns the generated Lorem Ipsum text as a string.
  • --words <int>

    • CLI flag to generate a certain number of words.
  • --sentences <int>

    • CLI flag to generate a certain number of sentences.
  • --paragraphs <int>

    • CLI flag to generate a certain number of paragraphs.

Development & Testing

Running Tests

A basic pytest-based test suite is provided in the tests/ directory. To run tests:

pip install pytest         # If not already installed
pytest

Linting & Formatting

You can add flake8 or other linters to your development dependencies. A sample requirements-dev.txt may include:

pytest>=7.0
flake8>=5.0

Install with:

pip install -r requirements-dev.txt

Then run:

flake8 src/lorem_gen
tests

Contributing

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/my-new-feature.
  3. Make your changes and commit: git commit -am 'Add new feature'.
  4. Push to the branch: git push origin feature/my-new-feature.
  5. Open a Pull Request.

Please follow the existing code style, include tests for new features, and update this README as needed.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for lorem-gen 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lorem-gen 0.1.1
File Size Uploaded
lorem_gen-0.1.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lorem-gen 0.1.1
File Interpreter ABI Platform
lorem_gen-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / lorem_gen-0.1.1.tar.gz

Download URL lorem_gen-0.1.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e8a5b66de5318906dfe374888d558004c5f9f79fa30579d158cfa927a5033cf9
BLAKE2b-256 checksum
How to use checksums
b2c74a4575bc58d73dad8a0e89fd9a49b26135708000e7fe50be5373efa730d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.15

Release files / lorem_gen-0.1.1-py3-none-any.whl

Download URL lorem_gen-0.1.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd549cba2c015994da8d81dff201ff2851aea468d4c9c0fda45f5d18532f717
BLAKE2b-256 checksum
How to use checksums
be0e11e39df049d1325256b3c1ff5050f51053359c260c0cabb3254d1a1039ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page