Metadata-Version: 2.4
Name: core-algorithms
Version: 1.2.0
Summary: This project/library contains common algorithms...
Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
Maintainer: Alejandro Cora González
License-Expression: MIT
Project-URL: Homepage, https://gitlab.com/bytecode-solutions/core/core-algorithms
Project-URL: Repository, https://gitlab.com/bytecode-solutions/core/core-algorithms
Project-URL: Documentation, https://core-algorithms.readthedocs.io/en/latest/
Project-URL: Issues, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
Project-URL: Changelog, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.9
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: core-tests>=2.1.0
Provides-Extra: dev
Requires-Dist: core-dev-tools>=2.0.0; extra == "dev"
Requires-Dist: core-tests>=2.1.0; extra == "dev"
Dynamic: license-file

core-algorithms
===============================================================================

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

===============================================================================

.. image:: https://img.shields.io/pypi/pyversions/core-algorithms.svg
    :target: https://pypi.org/project/core-algorithms/
    :alt: Python Versions

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/main/LICENSE
    :alt: License

.. image:: https://gitlab.com/bytecode-solutions/core/core-algorithms/badges/release/pipeline.svg
    :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/pipelines
    :alt: Pipeline Status

.. image:: https://readthedocs.org/projects/core-algorithms/badge/?version=latest
    :target: https://readthedocs.org/projects/core-algorithms/
    :alt: Docs Status

.. image:: https://img.shields.io/badge/security-bandit-yellow.svg
    :target: https://github.com/PyCQA/bandit
    :alt: Security

|


Installation
===============================================================================

.. code-block:: bash

    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
===============================================================================

.. code-block:: bash

    pip install core-algorithms
    pip install -e ".[dev]"    # For development


Sorting
-------------------------------------------------------------------------------

Import and use any of the available sorting algorithms directly:

.. code-block:: python

    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()``:

.. code-block:: bash

    python tests/functional/benchmark_sorting.py


Development
===============================================================================

.. code-block:: bash

    # 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.


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
* **PyPI:** https://pypi.org/project/core-algorithms/


Support
===============================================================================

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


Authors
===============================================================================

* **Alejandro Cora González** - *Initial work* - alek.cora.glez@gmail.com
