Skip to main content

Generate Lorem Ipsum placeholder text via CLI or Python API

Project description

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.

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_gen-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

lorem_gen-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file lorem_gen-0.1.0.tar.gz.

File metadata

  • Download URL: lorem_gen-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.15

File hashes

Hashes for lorem_gen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42196cde22ef051458ba6049cae36c6a2561cfaaf9a2c64c199ba6b9c233e0e2
MD5 12da55ac5d452bed88d868bd12d0c3e7
BLAKE2b-256 345cd67ec9aeffd7195fcb1230710f247cb47d1bb59fe1393de6b9e540b5a39d

See more details on using hashes here.

File details

Details for the file lorem_gen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lorem_gen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.15

File hashes

Hashes for lorem_gen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4da2b77a98034224a68b53a42250cc141e89737dd9a28ec5753709f28c250ca2
MD5 b439e7cdf5a221999de67b3a9028024f
BLAKE2b-256 10e167f992a0606ed8d726ca1d71e09a0439687146280a581dfbf6e9322e6580

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