Skip to main content

Small Useful Things : python package for convenient primitives

Project description

SUThing suthing logo

SUThing /ˈsu.θɪŋ/ or /ˈsʌ.θɪŋ/ (Some Useful Things) is a collection of useful classes and decorators.

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

Python PyPI version PyPI Downloads License: MIT pre-commit pytest

Features

  • File Handling: one-line file reading/wriing with file format infererence from provided extension (YAML, JSON, CSV, pickle, gz etc.)
  • Performance Measurement: Simple timer utilities and profiling decorators
  • Data Comparison: Deep comparison of nested data structures
  • Error Handling: Decorators for secure function execution and error tracking

Documentation

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

Installation

pip install suthing

Usage Examples

File Handling

from suthing import FileHandle, FileType

# Read YAML file
data = FileHandle.load(fpath="config.yaml")

# Write compressed JSON
# file type inferred from extension
FileHandle.dump(data, "output.json.gz")

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 profile, SProfiler

profiler = SProfiler()

@profile(_argnames="input_size")
def my_function(input_size):
    # Function code
    pass

# Run with profiler
my_function(input_size=100, _profiler=profiler)

# View results
stats = profiler.view_stats()

Deep Comparison

from suthing import equals

# Compare nested structures
result = equals(complex_dict1, complex_dict2)

Requirements

  • Python 3.10+
  • pandas
  • PyYAML
  • python-dotenv

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

suthing-0.5.0.tar.gz (88.7 kB view details)

Uploaded Source

Built Distribution

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

suthing-0.5.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file suthing-0.5.0.tar.gz.

File metadata

  • Download URL: suthing-0.5.0.tar.gz
  • Upload date:
  • Size: 88.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for suthing-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d10ef14141438fdd2b4ad1f10a5d22f47df533cabe744fd11f9ae6c17d70b168
MD5 eb561e0cfaebe9abc6df5cc19550e829
BLAKE2b-256 32ba13b1fdafa2b2f34ce888e637749cb85069c663ab57683c421f2c6462ecb7

See more details on using hashes here.

File details

Details for the file suthing-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: suthing-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for suthing-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc73727f3e859c726d2225d62e064d9717b4bc9e59296ee5012997227e6a9b4
MD5 c955d3754547daae443177d331950fe6
BLAKE2b-256 ada46797de8ca92643efc01c3eee5ed97c121412355430f3da744e5630d191b5

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