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 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.4.1.tar.gz (80.3 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.4.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for suthing-0.4.1.tar.gz
Algorithm Hash digest
SHA256 144685d9cf9e2c4ab9c022151c52627ab2193c003b4f78b2cbb7262fff68ec54
MD5 96df557d660afb7bd0f503e59f177d52
BLAKE2b-256 e9e4881b2ce2617adc8d0db8629e613bc529bc7efc5bd3c452a317f3ad068c84

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for suthing-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb3538a9ba380a967b5f555c7bfcde5c112dd7305cb90de818dd3e7ad684e6e
MD5 cf34f31fa8fcf90825c60f4ecdd439c5
BLAKE2b-256 6f4268085b61f5f247f30b6b04548217a4a98e628c54e649d41d25fb0d5acef3

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