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

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.1.tar.gz (7.4 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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: suthing-0.5.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for suthing-0.5.1.tar.gz
Algorithm Hash digest
SHA256 60ce491f94959ddcbb305abc3f82e05e2c9faef7397f7d4aa0836760ab1bd693
MD5 cda21e863f0e843dc2673aeb6a2a32b3
BLAKE2b-256 932358936045eda0cbca5d501734ac1e8f76c6113903147f57856a080152105f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: suthing-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for suthing-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d07a719b9ad4cfbd3ae931ce697d1a05b0447219d50493a036af618b329a629c
MD5 71d377a369493528dd82e3d9404968e6
BLAKE2b-256 bbe1d97ad9adb2d773e33de2c756d7ea689ae2629515c08526b6ab9037424a79

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