Democritus Algorithms (a.k.a. d8s-algorithms)
Democritus functions[1] for working with algorithms.
[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.
We use d8s (pronounced "dee-eights") as an abbreviation for democritus (you can read more about this here).
Installation
pip install d8s-algorithms
Usage
You import the library like:
from d8s_algorithms import *
Once imported, you can use any of the functions listed below.
Functions
-
def amb(validation_function: Callable[..., bool], *args: Any) -> Iterable[Any]: """."""
-
def depth_first_traverse( data: Any, get_children_function: Callable[[Any], Optional[Iterable]], *, collect_items_function: Optional[Callable[[Any], Any]] = None ) -> Iterable[Any]: """Traverse the data in a depth-first manner. The get_children_function specifies how children will be identified from each node of the data. The collect_items_function, if provided, allows you to collect items from the data by... returning them from the collect_items_function."""
-
def breadth_first_traverse( data: Any, get_children_function: Callable[[Any], Optional[Iterable]], *, collect_items_function: Optional[Callable[[Any], Any]] = None ) -> Iterable[Any]: """Traverse the data in a breadth-first manner. The get_children_function specifies how children will be identified from each node of the data. The collect_items_function, if provided, allows you to collect items from the data by... returning them from the collect_items_function."""
-
def genetic_algorithm_run( data: Iterable[Any], scoring_function: Callable[[Any], Union[int, float]], selection_function: Callable[[Dict[Any, Union[int, float]]], Iterable[Any]], mutation_function: Callable[[Iterable[Any]], Iterable[Any]], max_epochs: int, ) -> Dict[Any, Union[int, float]]: """."""
-
def genetic_algorithm_best_mutation_function( starting_values: Iterable[Any], generations: int, scoring_function: Callable[[Any], Union[int, float]], mutation_functions: List[Callable[[Any], Any]], ): """Find the best mutation function. The best function is the one which produces values from the starting values... that score the highest (as measured by the scoring_function) after generations."""
Development
👋 If you want to get involved in this project, we have some short, helpful guides below:
If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.
Credits
This package was created with Cookiecutter and Floyd Hightower's Python project template.
Release files for d8s-algorithms 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| d8s_algorithms-0.8.0.tar.gz | 91.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| d8s_algorithms-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 110.9 kB
Release files / d8s_algorithms-0.8.0.tar.gz
| Download URL | d8s_algorithms-0.8.0.tar.gz |
|---|---|
| Size | 91.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc676a8c23294618690dbf346040a06e780538cd1f0b0426ac713b0268c0a196
|
|
BLAKE2b-256 checksum How to use checksums |
bc0b4c234114dc4ae26f1171dd7c8b92b7b974bea80d727becaf8e54ed65ff66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.
Transparency logRelease files / d8s_algorithms-0.8.0-py3-none-any.whl
| Download URL | d8s_algorithms-0.8.0-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b8305ab75381d87374026264846227d04cb3ce61d71d7da572666f246dfecac
|
|
BLAKE2b-256 checksum How to use checksums |
f0b19b49b53d9582e48f5247f861c78c1b5fe4917d28de4ead9b1963089ec733
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.
Transparency log