core-algorithms#
A Python library containing common algorithm implementations — currently focused on sorting — designed for reuse across projects.
Documentation Contents#
Index:
Features#
Sorting algorithms: bubble sort, insertion sort, merge sort, quick sort, and selection sort
Fully typed: complete type annotations with
py.typedmarker for PEP 561 complianceBroad 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:
Fork the repository
Create a feature branch
Write tests for new functionality
Ensure all tests pass:
python manager.py run-testsRun linting:
pylint core_algorithmsRun security checks:
bandit -r core_algorithmsSubmit a pull request
License#
This project is licensed under the MIT License. See the LICENSE file for details.
Links#
Support#
For questions or support, please open an issue on GitLab or contact the maintainers.