Skip to main content

A beginner-friendly Python package for learning data structures, algorithms, recursion, and logic.

Project description

PyLenza

PyLenza is a small, beginner-friendly Python library of readable implementations for common data structures and algorithms. Use it when you want clear, well- documented examples for teaching, learning, or quick prototyping — not when you need optimized production-grade data structures.

Quick highlights

  • Lightweight, readable implementations for common data structures (arrays, linked lists, stacks, queues, trees).
  • Algorithm templates for search & sort plus algorithmic patterns and puzzles (Tower of Hanoi, Kadane, etc.).
  • Helpers for recursion, string manipulation, numeric operations and small utilities for learning.

Installation

The package is ready to publish; for local development you can install in editable mode:

python -m pip install -e .

install with:

pip install pylenza

Usage (copy-paste friendly)

from pylenza import PyArray

arr = PyArray([1, 2, 3, 4])
arr.append(5)
print(arr.mean())  # prints the mean

Minimal runnable example

python examples/canonical_example.py

This prints the package version and runs a couple of small operations so you can verify the package works directly from the repository.

Modules (overview)

  • arrays — PyArray: list-like API + numeric, transform, search & sort helpers
  • linkedlist — Singly LinkedList with traversal, mutators and utilities
  • queue / stack — Teaching-friendly FIFO / LIFO containers with helpers
  • search / sort — Classic search and sorting implementations for learning
  • strings — String helpers (palindromes, parsing, substring utilities)
  • recursion / trees — Recursion exercises and BinaryTree / BST utilities
  • logic — patterns, puzzles, reasoning for algorithmic thinking

Examples & how to run

  • Examples are available in the examples/ folder. Each script is standalone and runnable:

    • python examples/array_examples.py
    • python examples/logic_examples.py
    • python examples/recursion_examples.py

    Publishing to PyPI

    There are two common ways to publish releases:

    1. Manual local publish (useful for quick releases):

      1. Create an API token on PyPI (Account → API tokens) and copy it.
      2. Either create a local ~/.pypirc following .pypirc.example (username token, password = token), or pass credentials directly to twine.
      3. Build and upload:
     python -m pip install --upgrade build twine
     python -m build  # produces dist/ wheel and sdist
     python -m twine upload dist/* --username __token__ --password ${PYPI_TOKEN}
    
    1. Automated CI publishing (recommended):

      • A GitHub Actions workflow is included at .github/workflows/publish.yml. It will:

        • run on pushed git tags that start with v (for example v0.1.0)
        • build wheel and sdist, then publish to PyPI via twine.
      • To enable it create a repository secret named PYPI_API_TOKEN with the token value (generated at https://pypi.org/manage/account/ ). Then push a tag:

     git tag v0.1.0
     git push origin v0.1.0
    

    Security note

    • Do NOT store PyPI tokens or credentials in source control. Use GitHub repository secrets for CI or ~/.pypirc locally.

License

This project is distributed under the MIT License.

Contributing

  • Pull requests and issues are welcome — keep contributions small and well-documented so they are easy to review.

Contact

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

pylenza-0.1.2.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

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

pylenza-0.1.2-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pylenza-0.1.2.tar.gz
Algorithm Hash digest
SHA256 34d67284881bae278eab7edd4c60477c2a70580e34b136219ba3d962c58c212a
MD5 c9a457c5fb440b86591b1a2585f4977f
BLAKE2b-256 8c83a9bf419197bfd27ec55e03fce56ce3847e28fe0c65304b8f2afb923a656c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pylenza-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4bc5934cf967955694b0ad4f167c7ea1aeb0e41f96076ba40aa61ad8c24e483
MD5 dc310a4c94c9068b7eb25be9552ae75f
BLAKE2b-256 402f3802ad9967359d357b0a104ac0302fe2b98b91c9365ad6f46ac0904a5f45

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