core-algorithms#

A Python library containing common algorithm implementations — currently focused on sorting — designed for reuse across projects.


Python Versions License Pipeline Status Docs Status Security

Documentation Contents#

Index:

Features#

  • Sorting algorithms: bubble sort, insertion sort, merge sort, quick sort, and selection sort

  • Fully typed: complete type annotations with py.typed marker for PEP 561 compliance

  • Broad Python support: compatible with Python 3.9 through 3.14 and PyPy

Installation#

pip install core-algorithms
uv pip install core-algorithms  # Or using UV...
pip install -e ".[dev]"         # For development...

Quick Start#

Sorting: import and use any of the available sorting algorithms directly:

from core_algorithms.sorting import bubble_sort, insertion_sort
from core_algorithms.sorting import merge_sort, quick_sort, selection_sort

data = [5, 3, 8, 1, 9, 2]

print(bubble_sort(data))     # [1, 2, 3, 5, 8, 9]
print(quick_sort(data))      # [1, 2, 3, 5, 8, 9]
print(merge_sort(data))      # [1, 2, 3, 5, 8, 9]

Development#

# Create and activate virtual environment
virtualenv --python=python3.12 .venv
source .venv/bin/activate

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
python manager.py run-tests
python manager.py run-coverage

# Lint and security scan
pylint core_algorithms
bandit -r core_algorithms

# Run across all supported Python versions
tox

Contributing#

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Write tests for new functionality

  4. Ensure all tests pass: python manager.py run-tests

  5. Run linting: pylint core_algorithms

  6. Run security checks: bandit -r core_algorithms

  7. Submit a pull request

License#

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

Support#

For questions or support, please open an issue on GitLab or contact the maintainers.

Authors#