Skip to main content

core-algorithms

A Python library containing common algorithm implementations, currently focused on sorting.


PyPI Downloads Python Versions License Pipeline Status Docs Status Security

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:

  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

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)

Source distribution for core-algorithms 1.2.1
File Size Uploaded
core_algorithms-1.2.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for core-algorithms 1.2.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page