Metadata-Version: 2.4
Name: thesoup
Version: 1.3.0
Summary: A soup of random python utils
Home-page: https://github.com/sigabrtio/thesoup
Author: Amartya Datta Gupta
Author-email: amartya00@gmail.com
License: GPLv2
Project-URL: Source, https://github.com/sigabrtio/thesoup
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: python-semantic-release; extra == "dev"
Provides-Extra: test
Requires-Dist: nose2; extra == "test"
Provides-Extra: docs
Requires-Dist: pdoc; extra == "docs"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: summary

# The Soup
### A collection of Python utility classes and functions.

[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
[![PyPI version](https://badge.fury.io/py/thesoup.svg)](https://badge.fury.io/py/thesoup)
[![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
[![Docs](https://img.shields.io/badge/docs-github%20pages-blue)](https://sigabrtio.github.io/thesoup/)

Full API documentation is available at [sigabrtio.github.io/thesoup](https://sigabrtio.github.io/thesoup/).

---

## Installation

#### From PyPI
```bash
pip install thesoup
```

#### From source
```bash
git clone https://github.com/sigabrtio/thesoup.git
cd thesoup
pip install .
```

To run the tests:
```bash
pip install -e ".[test]"
python -m nose2 --start-dir tst
```

---

## Components

### Classes

- **Graphs**
  - `DiGraph` — abstract directed graph
  - `MutableDiGraph` — abstract mutable directed graph
  - `AdjListGraph` — adjacency-list implementation of `MutableDiGraph`

- **Heap**
  - `MinHeap`
  - `MaxHeap`

- **Binary Trees**
  - `BinarySearchTree`

- **Trie** (ASCII only)

- **Sets**
  - `CountSet` — set that tracks occurrence counts of repeated elements
  - `DisjointSets` — disjoint-set / union-find structure ([Wikipedia](https://en.wikipedia.org/wiki/Disjoint-set_data_structure))

- **Result**
  - `Result` — a result type similar to Rust's `Result`

### Functions

- **Collections**
  - `flatten` — flatten a nested collection
  - `flatten_to_tuple` — flatten a nested collection, preserving tuples
  - `subsequence` — find all subsequences of a list
  - `foreach` — foreach that works on any collection
  - `group_by` — group a collection into a map by some criteria

- **Graph Traversals**
  - `bfs` — breadth-first search
  - `dfs` — depth-first search
  - `dijkstra` — Dijkstra's shortest path
  - `shortest_path_dag` — specialised shortest path for DAGs

- **Strings**
  - `is_anagram` — test if two strings are anagrams

- **Other**
  - `merge` — k-way merge
