Skip to main content

A soup of random python utils

Project description

The Soup

A collection of Python utility classes and functions.

License: GPL v2 PyPI version Python 3.9+ Docs

Full API documentation is available at sigabrtio.github.io/thesoup.


Installation

From PyPI

pip install thesoup

From source

git clone https://github.com/sigabrtio/thesoup.git
cd thesoup
pip install .

To run the tests:

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)
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thesoup-1.3.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thesoup-1.3.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file thesoup-1.3.0.tar.gz.

File metadata

  • Download URL: thesoup-1.3.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thesoup-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0dd2e4e26ca0641771f73ca4ec2cb9fa4e5817d2ac6aa58da953054b83962478
MD5 f603f1b103a2fd328b15ce60eaecad00
BLAKE2b-256 e6a573b176d04b72898178b5e6fa068602ef4e0a25ee35a98eb959ce7ced8b33

See more details on using hashes here.

File details

Details for the file thesoup-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: thesoup-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thesoup-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6e31d2b4169262274978aaec7832274ce41194244d885e3f1d7e011302cb349
MD5 a281c129cd7d72f5edbaa43d8e3f8f9f
BLAKE2b-256 a0585d314e26211082d3dcffe4fadd34e9bc892b05f4d8c4919c59f6990543a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page