core-algorithms 1.0.2__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. core_algorithms-1.2.0/PKG-INFO +188 -0
  2. core_algorithms-1.2.0/README.rst +153 -0
  3. core_algorithms-1.2.0/core_algorithms/__init__.py +18 -0
  4. core_algorithms-1.2.0/core_algorithms/sorting/__init__.py +18 -0
  5. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms/sorting/bubble_sort.py +7 -0
  6. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms/sorting/insertion_sort.py +8 -2
  7. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms/sorting/merge_sort.py +8 -2
  8. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms/sorting/quick_sort.py +13 -6
  9. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms/sorting/selection_sort.py +8 -1
  10. core_algorithms-1.2.0/core_algorithms.egg-info/PKG-INFO +188 -0
  11. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms.egg-info/SOURCES.txt +2 -1
  12. core_algorithms-1.2.0/core_algorithms.egg-info/requires.txt +5 -0
  13. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/pyproject.toml +27 -10
  14. core-algorithms-1.0.2/PKG-INFO +0 -54
  15. core-algorithms-1.0.2/README.md +0 -33
  16. core-algorithms-1.0.2/core_algorithms/sorting/__init__.py +0 -0
  17. core-algorithms-1.0.2/core_algorithms.egg-info/PKG-INFO +0 -54
  18. core-algorithms-1.0.2/core_algorithms.egg-info/requires.txt +0 -3
  19. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/LICENSE +0 -0
  20. /core-algorithms-1.0.2/core_algorithms/__init__.py → /core_algorithms-1.2.0/core_algorithms/py.typed +0 -0
  21. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms.egg-info/dependency_links.txt +0 -0
  22. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/core_algorithms.egg-info/top_level.txt +0 -0
  23. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/setup.cfg +0 -0
  24. {core-algorithms-1.0.2 → core_algorithms-1.2.0}/setup.py +0 -0
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: core-algorithms
3
+ Version: 1.2.0
4
+ Summary: This project/library contains common algorithms...
5
+ Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
+ Maintainer: Alejandro Cora González
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://gitlab.com/bytecode-solutions/core/core-algorithms
9
+ Project-URL: Repository, https://gitlab.com/bytecode-solutions/core/core-algorithms
10
+ Project-URL: Documentation, https://core-algorithms.readthedocs.io/en/latest/
11
+ Project-URL: Issues, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
12
+ Project-URL: Changelog, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: Utilities
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/x-rst
29
+ License-File: LICENSE
30
+ Requires-Dist: core-tests>=2.1.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: core-dev-tools>=2.0.0; extra == "dev"
33
+ Requires-Dist: core-tests>=2.1.0; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ core-algorithms
37
+ ===============================================================================
38
+
39
+ A Python library containing common algorithm implementations, currently
40
+ focused on sorting.
41
+
42
+ ===============================================================================
43
+
44
+ .. image:: https://img.shields.io/pypi/pyversions/core-algorithms.svg
45
+ :target: https://pypi.org/project/core-algorithms/
46
+ :alt: Python Versions
47
+
48
+ .. image:: https://img.shields.io/badge/license-MIT-blue.svg
49
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/main/LICENSE
50
+ :alt: License
51
+
52
+ .. image:: https://gitlab.com/bytecode-solutions/core/core-algorithms/badges/release/pipeline.svg
53
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/pipelines
54
+ :alt: Pipeline Status
55
+
56
+ .. image:: https://readthedocs.org/projects/core-algorithms/badge/?version=latest
57
+ :target: https://readthedocs.org/projects/core-algorithms/
58
+ :alt: Docs Status
59
+
60
+ .. image:: https://img.shields.io/badge/security-bandit-yellow.svg
61
+ :target: https://github.com/PyCQA/bandit
62
+ :alt: Security
63
+
64
+ |
65
+
66
+
67
+ Installation
68
+ ===============================================================================
69
+
70
+ .. code-block:: bash
71
+
72
+ pip install core-algorithms
73
+ uv pip install core-algorithms
74
+
75
+
76
+ Features
77
+ ===============================================================================
78
+
79
+ * **Sorting algorithms**: bubble sort, insertion sort, merge sort, quick sort, and selection sort
80
+ * **Fully typed**: complete type annotations with ``py.typed`` marker for PEP 561 compliance
81
+ * **Broad Python support**: compatible with Python 3.9 through 3.14 and PyPy
82
+
83
+
84
+ Quick Start
85
+ ===============================================================================
86
+
87
+ .. code-block:: bash
88
+
89
+ pip install core-algorithms
90
+ pip install -e ".[dev]" # For development
91
+
92
+
93
+ Sorting
94
+ -------------------------------------------------------------------------------
95
+
96
+ Import and use any of the available sorting algorithms directly:
97
+
98
+ .. code-block:: python
99
+
100
+ from core_algorithms.sorting import bubble_sort, insertion_sort
101
+ from core_algorithms.sorting import merge_sort, quick_sort, selection_sort
102
+
103
+ data = [5, 3, 8, 1, 9, 2]
104
+
105
+ print(bubble_sort(data[:])) # [1, 2, 3, 5, 8, 9]
106
+ print(insertion_sort(data[:])) # [1, 2, 3, 5, 8, 9]
107
+ print(merge_sort(data[:])) # [1, 2, 3, 5, 8, 9]
108
+ print(selection_sort(data[:])) # [1, 2, 3, 5, 8, 9]
109
+
110
+ quick_sort(data)
111
+ print(data) # [1, 2, 3, 5, 8, 9]
112
+
113
+
114
+ Benchmark
115
+ -------------------------------------------------------------------------------
116
+
117
+ Run the sorting benchmark to compare all implementations against Python's
118
+ built-in ``sorted()`` and ``list.sort()``:
119
+
120
+ .. code-block:: bash
121
+
122
+ python tests/functional/benchmark_sorting.py
123
+
124
+
125
+ Development
126
+ ===============================================================================
127
+
128
+ .. code-block:: bash
129
+
130
+ # Create and activate virtual environment
131
+ virtualenv --python=python3.12 .venv
132
+ source .venv/bin/activate
133
+
134
+ # Install with dev dependencies
135
+ pip install -e ".[dev]"
136
+
137
+ # Run tests
138
+ python manager.py run-tests
139
+ python manager.py run-coverage
140
+
141
+ # Lint and security scan
142
+ pylint core_algorithms
143
+ bandit -r core_algorithms
144
+
145
+ # Run across all supported Python versions
146
+ tox
147
+
148
+
149
+ Contributing
150
+ ===============================================================================
151
+
152
+ Contributions are welcome! Please:
153
+
154
+ 1. Fork the repository
155
+ 2. Create a feature branch
156
+ 3. Write tests for new functionality
157
+ 4. Ensure all tests pass: ``python manager.py run-tests``
158
+ 5. Run linting: ``pylint core_algorithms``
159
+ 6. Run security checks: ``bandit -r core_algorithms``
160
+ 7. Submit a pull request
161
+
162
+
163
+ License
164
+ ===============================================================================
165
+
166
+ This project is licensed under the MIT License. See the LICENSE file for details.
167
+
168
+
169
+ Links
170
+ ===============================================================================
171
+
172
+ * **Documentation:** https://core-algorithms.readthedocs.io/en/latest/
173
+ * **Repository:** https://gitlab.com/bytecode-solutions/core/core-algorithms
174
+ * **Issues:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
175
+ * **Changelog:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
176
+ * **PyPI:** https://pypi.org/project/core-algorithms/
177
+
178
+
179
+ Support
180
+ ===============================================================================
181
+
182
+ For questions or support, please open an issue on GitLab or contact the maintainers.
183
+
184
+
185
+ Authors
186
+ ===============================================================================
187
+
188
+ * **Alejandro Cora González** - *Initial work* - alek.cora.glez@gmail.com
@@ -0,0 +1,153 @@
1
+ core-algorithms
2
+ ===============================================================================
3
+
4
+ A Python library containing common algorithm implementations, currently
5
+ focused on sorting.
6
+
7
+ ===============================================================================
8
+
9
+ .. image:: https://img.shields.io/pypi/pyversions/core-algorithms.svg
10
+ :target: https://pypi.org/project/core-algorithms/
11
+ :alt: Python Versions
12
+
13
+ .. image:: https://img.shields.io/badge/license-MIT-blue.svg
14
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/main/LICENSE
15
+ :alt: License
16
+
17
+ .. image:: https://gitlab.com/bytecode-solutions/core/core-algorithms/badges/release/pipeline.svg
18
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/pipelines
19
+ :alt: Pipeline Status
20
+
21
+ .. image:: https://readthedocs.org/projects/core-algorithms/badge/?version=latest
22
+ :target: https://readthedocs.org/projects/core-algorithms/
23
+ :alt: Docs Status
24
+
25
+ .. image:: https://img.shields.io/badge/security-bandit-yellow.svg
26
+ :target: https://github.com/PyCQA/bandit
27
+ :alt: Security
28
+
29
+ |
30
+
31
+
32
+ Installation
33
+ ===============================================================================
34
+
35
+ .. code-block:: bash
36
+
37
+ pip install core-algorithms
38
+ uv pip install core-algorithms
39
+
40
+
41
+ Features
42
+ ===============================================================================
43
+
44
+ * **Sorting algorithms**: bubble sort, insertion sort, merge sort, quick sort, and selection sort
45
+ * **Fully typed**: complete type annotations with ``py.typed`` marker for PEP 561 compliance
46
+ * **Broad Python support**: compatible with Python 3.9 through 3.14 and PyPy
47
+
48
+
49
+ Quick Start
50
+ ===============================================================================
51
+
52
+ .. code-block:: bash
53
+
54
+ pip install core-algorithms
55
+ pip install -e ".[dev]" # For development
56
+
57
+
58
+ Sorting
59
+ -------------------------------------------------------------------------------
60
+
61
+ Import and use any of the available sorting algorithms directly:
62
+
63
+ .. code-block:: python
64
+
65
+ from core_algorithms.sorting import bubble_sort, insertion_sort
66
+ from core_algorithms.sorting import merge_sort, quick_sort, selection_sort
67
+
68
+ data = [5, 3, 8, 1, 9, 2]
69
+
70
+ print(bubble_sort(data[:])) # [1, 2, 3, 5, 8, 9]
71
+ print(insertion_sort(data[:])) # [1, 2, 3, 5, 8, 9]
72
+ print(merge_sort(data[:])) # [1, 2, 3, 5, 8, 9]
73
+ print(selection_sort(data[:])) # [1, 2, 3, 5, 8, 9]
74
+
75
+ quick_sort(data)
76
+ print(data) # [1, 2, 3, 5, 8, 9]
77
+
78
+
79
+ Benchmark
80
+ -------------------------------------------------------------------------------
81
+
82
+ Run the sorting benchmark to compare all implementations against Python's
83
+ built-in ``sorted()`` and ``list.sort()``:
84
+
85
+ .. code-block:: bash
86
+
87
+ python tests/functional/benchmark_sorting.py
88
+
89
+
90
+ Development
91
+ ===============================================================================
92
+
93
+ .. code-block:: bash
94
+
95
+ # Create and activate virtual environment
96
+ virtualenv --python=python3.12 .venv
97
+ source .venv/bin/activate
98
+
99
+ # Install with dev dependencies
100
+ pip install -e ".[dev]"
101
+
102
+ # Run tests
103
+ python manager.py run-tests
104
+ python manager.py run-coverage
105
+
106
+ # Lint and security scan
107
+ pylint core_algorithms
108
+ bandit -r core_algorithms
109
+
110
+ # Run across all supported Python versions
111
+ tox
112
+
113
+
114
+ Contributing
115
+ ===============================================================================
116
+
117
+ Contributions are welcome! Please:
118
+
119
+ 1. Fork the repository
120
+ 2. Create a feature branch
121
+ 3. Write tests for new functionality
122
+ 4. Ensure all tests pass: ``python manager.py run-tests``
123
+ 5. Run linting: ``pylint core_algorithms``
124
+ 6. Run security checks: ``bandit -r core_algorithms``
125
+ 7. Submit a pull request
126
+
127
+
128
+ License
129
+ ===============================================================================
130
+
131
+ This project is licensed under the MIT License. See the LICENSE file for details.
132
+
133
+
134
+ Links
135
+ ===============================================================================
136
+
137
+ * **Documentation:** https://core-algorithms.readthedocs.io/en/latest/
138
+ * **Repository:** https://gitlab.com/bytecode-solutions/core/core-algorithms
139
+ * **Issues:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
140
+ * **Changelog:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
141
+ * **PyPI:** https://pypi.org/project/core-algorithms/
142
+
143
+
144
+ Support
145
+ ===============================================================================
146
+
147
+ For questions or support, please open an issue on GitLab or contact the maintainers.
148
+
149
+
150
+ Authors
151
+ ===============================================================================
152
+
153
+ * **Alejandro Cora González** - *Initial work* - alek.cora.glez@gmail.com
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """Common algorithm implementations."""
4
+
5
+ from importlib.metadata import PackageNotFoundError
6
+ from importlib.metadata import version
7
+
8
+
9
+ try:
10
+ __version__ = version("core-algorithms")
11
+
12
+ except PackageNotFoundError:
13
+ __version__ = "unknown"
14
+
15
+
16
+ __all__ = [
17
+ "__version__",
18
+ ]
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """Sorting algorithm implementations."""
4
+
5
+ from .bubble_sort import bubble_sort
6
+ from .insertion_sort import insertion_sort
7
+ from .merge_sort import merge_sort
8
+ from .quick_sort import quick_sort
9
+ from .selection_sort import selection_sort
10
+
11
+
12
+ __all__ = [
13
+ "bubble_sort",
14
+ "insertion_sort",
15
+ "merge_sort",
16
+ "quick_sort",
17
+ "selection_sort",
18
+ ]
@@ -1,9 +1,16 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ """Bubble sort algorithm implementation."""
4
+
3
5
  from typing import List
4
6
 
5
7
 
6
8
  def bubble_sort(array: List):
9
+ """
10
+ Sort *array* in ascending order using bubble
11
+ sort and return it.
12
+ """
13
+
7
14
  def swap(x: int, y: int):
8
15
  array[x], array[y] = array[y], array[x]
9
16
 
@@ -1,11 +1,17 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ """Insertion sort algorithm implementation."""
4
+
3
5
  from typing import List
4
6
 
5
7
 
6
8
  def insertion_sort(array: List):
7
- for i in range(len(array)):
8
- cursor, pos = array[i], i
9
+ """
10
+ Sort *array* in ascending order using insertion
11
+ sort and return it."""
12
+
13
+ for i, cursor in enumerate(array):
14
+ pos = i
9
15
  while pos > 0 and array[pos - 1] > cursor:
10
16
  array[pos] = array[pos - 1]
11
17
  pos = pos - 1
@@ -1,9 +1,15 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ """Merge sort algorithm implementation."""
4
+
3
5
  from typing import List
4
6
 
5
7
 
6
8
  def merge_sort(array: List):
9
+ """
10
+ Sort *array* in ascending order using merge
11
+ sort and return it."""
12
+
7
13
  # The last array split...
8
14
  if len(array) <= 1:
9
15
  return array
@@ -13,10 +19,10 @@ def merge_sort(array: List):
13
19
  left, right = merge_sort(array[:mid]), merge_sort(array[mid:])
14
20
 
15
21
  # Merge each side together...
16
- return merge(left, right, array.copy())
22
+ return _merge(left, right, array.copy())
17
23
 
18
24
 
19
- def merge(left, right, merged):
25
+ def _merge(left, right, merged):
20
26
  left_cursor, right_cursor = 0, 0
21
27
 
22
28
  while left_cursor < len(left) and right_cursor < len(right):
@@ -1,9 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ """Quick sort algorithm implementation."""
4
+
3
5
  from typing import List
4
6
 
5
7
 
6
- def partition(array: List, begin: int, end: int):
8
+ def _partition(array: List, begin: int, end: int):
7
9
  pivot_idx = begin
8
10
  for i in range(begin + 1, end + 1):
9
11
  if array[i] <= array[begin]:
@@ -14,17 +16,22 @@ def partition(array: List, begin: int, end: int):
14
16
  return pivot_idx
15
17
 
16
18
 
17
- def quick_sort_recursion(array: List, begin: int, end: int):
19
+ def _quick_sort_recursion(array: List, begin: int, end: int):
18
20
  if begin >= end:
19
21
  return
20
22
 
21
- pivot_idx = partition(array, begin, end)
22
- quick_sort_recursion(array, begin, pivot_idx - 1)
23
- quick_sort_recursion(array, pivot_idx + 1, end)
23
+ pivot_idx = _partition(array, begin, end)
24
+ _quick_sort_recursion(array, begin, pivot_idx - 1)
25
+ _quick_sort_recursion(array, pivot_idx + 1, end)
24
26
 
25
27
 
26
28
  def quick_sort(array: List, begin=0, end=None):
29
+ """
30
+ Sort *array* in ascending order using quick
31
+ sort and return it.
32
+ """
33
+
27
34
  if not end:
28
35
  end = len(array) - 1
29
36
 
30
- return quick_sort_recursion(array, begin, end)
37
+ return _quick_sort_recursion(array, begin, end)
@@ -1,10 +1,17 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ """Selection sort algorithm implementation."""
4
+
3
5
  from typing import List
4
6
 
5
7
 
6
8
  def selection_sort(array: List):
7
- for i in range(len(array)):
9
+ """
10
+ Sort *array* in ascending order using selection
11
+ sort and return it.
12
+ """
13
+
14
+ for i, _ in enumerate(array):
8
15
  minimum = i
9
16
  for j in range(i + 1, len(array)):
10
17
  # Select the smallest value...
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: core-algorithms
3
+ Version: 1.2.0
4
+ Summary: This project/library contains common algorithms...
5
+ Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
+ Maintainer: Alejandro Cora González
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://gitlab.com/bytecode-solutions/core/core-algorithms
9
+ Project-URL: Repository, https://gitlab.com/bytecode-solutions/core/core-algorithms
10
+ Project-URL: Documentation, https://core-algorithms.readthedocs.io/en/latest/
11
+ Project-URL: Issues, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
12
+ Project-URL: Changelog, https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: Utilities
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/x-rst
29
+ License-File: LICENSE
30
+ Requires-Dist: core-tests>=2.1.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: core-dev-tools>=2.0.0; extra == "dev"
33
+ Requires-Dist: core-tests>=2.1.0; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ core-algorithms
37
+ ===============================================================================
38
+
39
+ A Python library containing common algorithm implementations, currently
40
+ focused on sorting.
41
+
42
+ ===============================================================================
43
+
44
+ .. image:: https://img.shields.io/pypi/pyversions/core-algorithms.svg
45
+ :target: https://pypi.org/project/core-algorithms/
46
+ :alt: Python Versions
47
+
48
+ .. image:: https://img.shields.io/badge/license-MIT-blue.svg
49
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/main/LICENSE
50
+ :alt: License
51
+
52
+ .. image:: https://gitlab.com/bytecode-solutions/core/core-algorithms/badges/release/pipeline.svg
53
+ :target: https://gitlab.com/bytecode-solutions/core/core-algorithms/-/pipelines
54
+ :alt: Pipeline Status
55
+
56
+ .. image:: https://readthedocs.org/projects/core-algorithms/badge/?version=latest
57
+ :target: https://readthedocs.org/projects/core-algorithms/
58
+ :alt: Docs Status
59
+
60
+ .. image:: https://img.shields.io/badge/security-bandit-yellow.svg
61
+ :target: https://github.com/PyCQA/bandit
62
+ :alt: Security
63
+
64
+ |
65
+
66
+
67
+ Installation
68
+ ===============================================================================
69
+
70
+ .. code-block:: bash
71
+
72
+ pip install core-algorithms
73
+ uv pip install core-algorithms
74
+
75
+
76
+ Features
77
+ ===============================================================================
78
+
79
+ * **Sorting algorithms**: bubble sort, insertion sort, merge sort, quick sort, and selection sort
80
+ * **Fully typed**: complete type annotations with ``py.typed`` marker for PEP 561 compliance
81
+ * **Broad Python support**: compatible with Python 3.9 through 3.14 and PyPy
82
+
83
+
84
+ Quick Start
85
+ ===============================================================================
86
+
87
+ .. code-block:: bash
88
+
89
+ pip install core-algorithms
90
+ pip install -e ".[dev]" # For development
91
+
92
+
93
+ Sorting
94
+ -------------------------------------------------------------------------------
95
+
96
+ Import and use any of the available sorting algorithms directly:
97
+
98
+ .. code-block:: python
99
+
100
+ from core_algorithms.sorting import bubble_sort, insertion_sort
101
+ from core_algorithms.sorting import merge_sort, quick_sort, selection_sort
102
+
103
+ data = [5, 3, 8, 1, 9, 2]
104
+
105
+ print(bubble_sort(data[:])) # [1, 2, 3, 5, 8, 9]
106
+ print(insertion_sort(data[:])) # [1, 2, 3, 5, 8, 9]
107
+ print(merge_sort(data[:])) # [1, 2, 3, 5, 8, 9]
108
+ print(selection_sort(data[:])) # [1, 2, 3, 5, 8, 9]
109
+
110
+ quick_sort(data)
111
+ print(data) # [1, 2, 3, 5, 8, 9]
112
+
113
+
114
+ Benchmark
115
+ -------------------------------------------------------------------------------
116
+
117
+ Run the sorting benchmark to compare all implementations against Python's
118
+ built-in ``sorted()`` and ``list.sort()``:
119
+
120
+ .. code-block:: bash
121
+
122
+ python tests/functional/benchmark_sorting.py
123
+
124
+
125
+ Development
126
+ ===============================================================================
127
+
128
+ .. code-block:: bash
129
+
130
+ # Create and activate virtual environment
131
+ virtualenv --python=python3.12 .venv
132
+ source .venv/bin/activate
133
+
134
+ # Install with dev dependencies
135
+ pip install -e ".[dev]"
136
+
137
+ # Run tests
138
+ python manager.py run-tests
139
+ python manager.py run-coverage
140
+
141
+ # Lint and security scan
142
+ pylint core_algorithms
143
+ bandit -r core_algorithms
144
+
145
+ # Run across all supported Python versions
146
+ tox
147
+
148
+
149
+ Contributing
150
+ ===============================================================================
151
+
152
+ Contributions are welcome! Please:
153
+
154
+ 1. Fork the repository
155
+ 2. Create a feature branch
156
+ 3. Write tests for new functionality
157
+ 4. Ensure all tests pass: ``python manager.py run-tests``
158
+ 5. Run linting: ``pylint core_algorithms``
159
+ 6. Run security checks: ``bandit -r core_algorithms``
160
+ 7. Submit a pull request
161
+
162
+
163
+ License
164
+ ===============================================================================
165
+
166
+ This project is licensed under the MIT License. See the LICENSE file for details.
167
+
168
+
169
+ Links
170
+ ===============================================================================
171
+
172
+ * **Documentation:** https://core-algorithms.readthedocs.io/en/latest/
173
+ * **Repository:** https://gitlab.com/bytecode-solutions/core/core-algorithms
174
+ * **Issues:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues
175
+ * **Changelog:** https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md
176
+ * **PyPI:** https://pypi.org/project/core-algorithms/
177
+
178
+
179
+ Support
180
+ ===============================================================================
181
+
182
+ For questions or support, please open an issue on GitLab or contact the maintainers.
183
+
184
+
185
+ Authors
186
+ ===============================================================================
187
+
188
+ * **Alejandro Cora González** - *Initial work* - alek.cora.glez@gmail.com
@@ -1,8 +1,9 @@
1
1
  LICENSE
2
- README.md
2
+ README.rst
3
3
  pyproject.toml
4
4
  setup.py
5
5
  core_algorithms/__init__.py
6
+ core_algorithms/py.typed
6
7
  core_algorithms.egg-info/PKG-INFO
7
8
  core_algorithms.egg-info/SOURCES.txt
8
9
  core_algorithms.egg-info/dependency_links.txt
@@ -0,0 +1,5 @@
1
+ core-tests>=2.1.0
2
+
3
+ [dev]
4
+ core-dev-tools>=2.0.0
5
+ core-tests>=2.1.0
@@ -3,13 +3,13 @@
3
3
  # https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
4
4
 
5
5
  [build-system]
6
- requires = ["setuptools>=61", "wheel"]
6
+ requires = ["setuptools>=61.0.0", "wheel"]
7
7
  build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "core-algorithms"
11
11
  description = "This project/library contains common algorithms..."
12
- version = "1.0.2"
12
+ version = "1.2.0"
13
13
 
14
14
  authors = [
15
15
  {name = "Alejandro Cora González", email = "alek.cora.glez@gmail.com"}
@@ -20,26 +20,43 @@ maintainers = [
20
20
  ]
21
21
 
22
22
  requires-python = ">=3.9"
23
- license = {text = "MIT"}
24
- readme = "README.md"
23
+ license = "MIT"
24
+ readme = "README.rst"
25
25
 
26
26
  classifiers = [
27
27
  # Classifiers -> https://pypi.org/classifiers/
28
- "License :: OSI Approved :: MIT License",
28
+ "Intended Audience :: Developers",
29
+ "Development Status :: 5 - Production/Stable",
29
30
  "Topic :: Software Development :: Libraries :: Python Modules",
31
+ "Topic :: Utilities",
32
+ "Programming Language :: Python",
30
33
  "Programming Language :: Python :: 3",
34
+ "Programming Language :: Python :: 3 :: Only",
31
35
  "Programming Language :: Python :: 3.9",
36
+ "Programming Language :: Python :: 3.10",
32
37
  "Programming Language :: Python :: 3.11",
33
- "Intended Audience :: Developers",
34
- "Topic :: Utilities"
38
+ "Programming Language :: Python :: 3.12",
39
+ "Programming Language :: Python :: 3.13",
40
+ "Programming Language :: Python :: 3.14",
41
+ "Programming Language :: Python :: Implementation :: PyPy",
35
42
  ]
36
43
 
37
44
  dependencies = [
38
- "core-tests==1.0.3"
45
+ "core-tests>=2.1.0"
46
+ ]
47
+
48
+ [project.optional-dependencies]
49
+ dev = [
50
+ "core-dev-tools>=2.0.0",
51
+ "core-tests>=2.1.0",
39
52
  ]
40
53
 
41
54
  [project.urls]
42
55
  Homepage = "https://gitlab.com/bytecode-solutions/core/core-algorithms"
56
+ Repository = "https://gitlab.com/bytecode-solutions/core/core-algorithms"
57
+ Documentation = "https://core-algorithms.readthedocs.io/en/latest/"
58
+ Issues = "https://gitlab.com/bytecode-solutions/core/core-algorithms/-/issues"
59
+ Changelog = "https://gitlab.com/bytecode-solutions/core/core-algorithms/-/blob/master/CHANGELOG.md"
43
60
 
44
- [project.optional-dependencies]
45
- test = []
61
+ [tool.setuptools.package-data]
62
+ "core_algorithms" = ["py.typed"]
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: core-algorithms
3
- Version: 1.0.2
4
- Summary: This project/library contains common algorithms...
5
- Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
- Maintainer: Alejandro Cora González
7
- License: MIT
8
- Project-URL: Homepage, https://gitlab.com/bytecode-solutions/core/core-algorithms
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Utilities
16
- Requires-Python: >=3.9
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: core-tests==1.0.3
20
- Provides-Extra: test
21
-
22
- # core-algorithms
23
- _______________________________________________________________________________
24
-
25
- This project/library contains common algorithms...
26
-
27
- ## Execution Environment
28
-
29
- ### Install libraries
30
- ```commandline
31
- pip install --upgrade pip
32
- pip install virtualenv
33
- ```
34
-
35
- ### Create the Python Virtual Environment.
36
- ```commandline
37
- virtualenv --python=python3.11 .venv
38
- ```
39
-
40
- ### Activate the Virtual Environment.
41
- ```commandline
42
- source .venv/bin/activate
43
- ```
44
-
45
- ### Install required libraries.
46
- ```commandline
47
- pip install .
48
- ```
49
-
50
- ### Check tests and coverage...
51
- ```commandline
52
- python manager.py run-test
53
- python manager.py run-coverage
54
- ```
@@ -1,33 +0,0 @@
1
- # core-algorithms
2
- _______________________________________________________________________________
3
-
4
- This project/library contains common algorithms...
5
-
6
- ## Execution Environment
7
-
8
- ### Install libraries
9
- ```commandline
10
- pip install --upgrade pip
11
- pip install virtualenv
12
- ```
13
-
14
- ### Create the Python Virtual Environment.
15
- ```commandline
16
- virtualenv --python=python3.11 .venv
17
- ```
18
-
19
- ### Activate the Virtual Environment.
20
- ```commandline
21
- source .venv/bin/activate
22
- ```
23
-
24
- ### Install required libraries.
25
- ```commandline
26
- pip install .
27
- ```
28
-
29
- ### Check tests and coverage...
30
- ```commandline
31
- python manager.py run-test
32
- python manager.py run-coverage
33
- ```
File without changes
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: core-algorithms
3
- Version: 1.0.2
4
- Summary: This project/library contains common algorithms...
5
- Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
- Maintainer: Alejandro Cora González
7
- License: MIT
8
- Project-URL: Homepage, https://gitlab.com/bytecode-solutions/core/core-algorithms
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Utilities
16
- Requires-Python: >=3.9
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: core-tests==1.0.3
20
- Provides-Extra: test
21
-
22
- # core-algorithms
23
- _______________________________________________________________________________
24
-
25
- This project/library contains common algorithms...
26
-
27
- ## Execution Environment
28
-
29
- ### Install libraries
30
- ```commandline
31
- pip install --upgrade pip
32
- pip install virtualenv
33
- ```
34
-
35
- ### Create the Python Virtual Environment.
36
- ```commandline
37
- virtualenv --python=python3.11 .venv
38
- ```
39
-
40
- ### Activate the Virtual Environment.
41
- ```commandline
42
- source .venv/bin/activate
43
- ```
44
-
45
- ### Install required libraries.
46
- ```commandline
47
- pip install .
48
- ```
49
-
50
- ### Check tests and coverage...
51
- ```commandline
52
- python manager.py run-test
53
- python manager.py run-coverage
54
- ```
@@ -1,3 +0,0 @@
1
- core-tests==1.0.3
2
-
3
- [test]
File without changes