core-algorithms
A Python library containing common algorithm implementations, currently focused on sorting.
Installation
pip install core-algorithms
uv pip install core-algorithms
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
Quick Start
pip install core-algorithms
pip install -e ".[dev]" # For development
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(insertion_sort(data[:])) # [1, 2, 3, 5, 8, 9]
print(merge_sort(data[:])) # [1, 2, 3, 5, 8, 9]
print(selection_sort(data[:])) # [1, 2, 3, 5, 8, 9]
quick_sort(data)
print(data) # [1, 2, 3, 5, 8, 9]
Benchmark
Run the sorting benchmark to compare all implementations against Python’s built-in sorted() and list.sort():
python tests/functional/benchmark_sorting.py
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-tests
Run linting: pylint core_algorithms
Run security checks: bandit -r core_algorithms
Submit a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Links
Documentation: https://core-algorithms.readthedocs.io/en/latest/
Repository: https://gitlab.com/bytecode-solutions/core/core-algorithms
Issues: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
Changelog: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
Support
For questions or support, please open an issue on GitLab or contact the maintainers.
Metadata
Release files for core-algorithms 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| core_algorithms-1.2.1.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| core_algorithms-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / core_algorithms-1.2.1.tar.gz
| Download URL | core_algorithms-1.2.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7a86cb87a41f42403373be2aace6005e0405cc1d5cc820c29f85e83e5ee11a5
|
|
BLAKE2b-256 checksum How to use checksums |
35f9b250b669246aea2f0e2284bdcc8f5df27a9b9aa0979322c122f9a84f6368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / core_algorithms-1.2.1-py3-none-any.whl
| Download URL | core_algorithms-1.2.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40c2b702e477b1d52e48a4c337b0da9864b812d10ff291639c69a1b312660ca3
|
|
BLAKE2b-256 checksum How to use checksums |
3be159fd56837bcd2f2020f92b0baf69a8399109a2243fa1a9d7e8ee27eddfd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|