Skip to content

Stable release · 0.1.0

Sorting that adapts to your data

BielSort is a stable sorting library for CPython. It accelerates favorable large integer lists with native Counting Sort or Radix Sort, then falls back to Python's Timsort whenever that is the safer or more compatible choice.

3.9–3.14CPython versions
4canonical functions
36prebuilt wheels
MITopen source license

Why BielSort?

Adaptive by design

The library inspects the workload and selects Counting Sort, Radix Sort, or Timsort instead of forcing one algorithm onto every input.

Python-compatible

Sorting remains stable. key=, reverse=, non-integers, huge integers, and small or nearly ordered inputs deliberately use Python's mature Timsort.

Native fast paths

The C extension targets exact Python integers in the signed 64-bit range and provides both new-list and in-place operations.

Start in seconds

python -m pip install bielsort
import bielsort

numbers = [8, -4, 10, 3, -4]
ordered = bielsort.sort(numbers)

print(ordered)  # [-4, -4, 3, 8, 10]
print(numbers)  # unchanged
import bielsort

numbers = [8, -4, 10, 3, -4]
bielsort.sort_in_place(numbers)

print(numbers)  # [-4, -4, 3, 8, 10]

Pick the operation that matches your code

Need Python BielSort
Create a new sorted list sorted(values) bielsort.sort(values)
Mutate an existing list values.sort() bielsort.sort_in_place(values)
See the selected strategy bielsort.sort_with_strategy(values)
Mutate and see the strategy bielsort.sort_in_place_with_strategy(values)

A specialized tool, not a universal replacement

BielSort is most interesting for large list[int] workloads. Python's built-in sorting remains an excellent default for general objects, small inputs, nearly ordered data, key=, and reverse=. See limits and compatibility before choosing it for a production workload.

Continue learning