Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.6.1 instead.
Reason given by maintainers: breaking import removal

SUThing suthing logo

SUThing /ˈsu.θɪŋ/ or /ˈsʌ.θɪŋ/ (Some Useful Things) is a collection of small, dependable utilities.

A Python utility package providing tools for file handling, timing, profiling, data comparison and hashing.

Python PyPI version PyPI Downloads License: MIT pre-commit

Features

  • File Handling: one-line reading and writing with the format inferred from the extension (YAML, JSON, JSON Lines, CSV/TSV, text, dotenv, pickle), transparent .gz/.bz2/.xz/.zst compression, atomic writes and streaming reads
  • Timing and Profiling: a Timer context manager/decorator and opt-in function profiling with per-key statistics
  • Data Comparison: deep diff of nested structures that reports the path of every difference, with numeric tolerance and order-insensitive matching
  • Hashing: stable hashes of JSON-like values, text, files and directory trees
  • Small Helpers: batched, slugify, to_jsonable, env_flag, setup_logging, utc_now_iso

Documentation

Full documentation is available at: growgraph.github.io/suthing

Installation

pip install suthing

Usage Examples

File Handling

from suthing import FileHandle, FileType

# format inferred from the extension
data = FileHandle.load("config.yaml")

# compressed by suffix, written atomically
FileHandle.dump(data, "output.json.gz")

# data shipped inside a package
defaults = FileHandle.load_resource("mypkg.data", "defaults.yaml")

# explicit format for an unrecognised extension
secret = FileHandle.load("token.secret", how=FileType.TXT)

Timing Code

from suthing import Timer

with Timer() as t:
    # Your code here
    pass
print(f"Execution took {t.elapsed_str}")

Profiling Functions

from suthing import Profiler, profiled


@profiled(key_args="input_size")
def my_function(input_size): ...


with Profiler() as prof:
    my_function(100)

stats = prof.summary()  # {"my_function(input_size=100)": ProfileStats(...)}

Deep Comparison

from suthing import diff, equals

equals(expected, actual)  # bool
for d in diff(expected, actual):  # where they differ
    print(d)  # $.users[1].name: values differ (expected='Bob', actual='Rob')

Requirements

  • Python 3.11+
  • pandas (imported only for CSV/TSV)
  • PyYAML
  • python-dotenv
  • optional: zstandard for .zst files (pip install "suthing[zstd]")

Development

uv sync --group dev
uv run pytest test
uv run ty check suthing test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. See Contributing for the full workflow.

Metadata

Release files for suthing 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for suthing 0.6.0
File Size Uploaded
suthing-0.6.0.tar.gz 20.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for suthing 0.6.0
File Interpreter ABI Platform
suthing-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.2 kB

Release files / suthing-0.6.0.tar.gz

Download URL suthing-0.6.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
440c2a9414e2c15220bac2c6abfefba2a1e111606997f9de908020e0273a43f4
BLAKE2b-256 checksum
How to use checksums
fba842e2046e8dc7003f733441037fa93d98372b04f3c32ff7ce9efc34649bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / suthing-0.6.0-py3-none-any.whl

Download URL suthing-0.6.0-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb655beda259a5ae1c8aed5451c6256044615e4c478a90bd05720429edaffa3d
BLAKE2b-256 checksum
How to use checksums
9bdd56ebdbc2c42467ba8ce295615c568818af642859e7825f62d609f2e1e054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page