Skip to main content

Simple pattern generation library for Python

Project description

patlab

patlab-logo

PyPI version Python License Downloads DOI Code Style: Black Linting: Ruff Issues Stars

Patlab is a lightweight Python library for generating common text-based patterns such as squares, pyramids, and triangles with clean and customizable APIs.

It’s designed for beginners, educators, and developers who want a simple way to generate patterns programmatically.

✨ Features

  • Generate common patterns easily:
    • Squares
    • Pyramids (centered, right-aligned, numeric)
    • Right-angled triangles (classic, inverted)
  • Support for:
    • Custom characters
    • Hollow patterns
    • Numeric patterns
  • Clean, readable API design
  • Minimal dependencies

📦 Installation

Install via pip:

pip install patlab

🚀 Quick Start

from patlab import *

print(square(3))
print(pyramid(4))
print(right_triangle(4))

📐 Examples

Square

from patlab import square as sq

print(sq(4))
print(sq(4, "#"))
****
****
****
****

####
####
####
####

For full documentation, see: https://sayampradhan.github.io/patlab/

📜 License

This project is licensed under the terms of the MIT License. See: https://github.com/sayampradhan/patlab/blob/main/LICENSE

🤝 Contributing

Contributions are welcome!

If you’d like to improve Patlab, please visit the repository and submit a pull request: https://github.com/sayampradhan/patlab

💡 Inspiration

Patlab is inspired by classic programming exercises used to teach loops, logic, and formatting in Python.

If you've ever written code to print stars (*) in shapes like pyramids, triangles, or squares while learning Python, you've already experienced the core idea behind this library.

Patlab builds on those foundational exercises by:

  • Turning repetitive pattern-printing logic into reusable functions
  • Providing clean abstractions over nested loops
  • Making it easier to experiment with variations (hollow, numeric, aligned patterns)
  • Helping beginners transition from practice problems to structured code

It aims to bridge the gap between learning concepts and building reusable tools, making pattern generation both educational and practical.

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

patlab-0.2.14.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

patlab-0.2.14-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file patlab-0.2.14.tar.gz.

File metadata

  • Download URL: patlab-0.2.14.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for patlab-0.2.14.tar.gz
Algorithm Hash digest
SHA256 2e1b5503f6d73e67b701094e32ba606880ce2b1bc72840036c2be2c4bae62585
MD5 4ade2bb0ec5fa3d54474e38d95dedaa1
BLAKE2b-256 02e294173344f91b2bb87e57968275ebdbe81ea50c0411596f33fae0af7ec090

See more details on using hashes here.

File details

Details for the file patlab-0.2.14-py3-none-any.whl.

File metadata

  • Download URL: patlab-0.2.14-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for patlab-0.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 e17776668331858ac082589c9b22d5152c5afa3fc700fa19bc157fc02f79028f
MD5 54f154c531dff2ca4e53d674f05cf8b4
BLAKE2b-256 43d06e0cf469ac00a1a29e8411c5898a241cc267e64f3aee67b4ba8f08ee59f2

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