Skip to main content

Small Useful Things : python package for convenient primitives

Project description

SUThing

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

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

Features

  • File Handling: Flexible interface for reading/writing multiple file formats (YAML, JSON, CSV, pickle, 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

Installation

pip install suthing

Usage Examples

File Handling

from suthing.file_handle import FileHandle, FileType

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

# Write compressed JSON
FileHandle.dump(data, "output.json.gz", how=FileType.JSON)

Timing Code

from suthing.timer import Timer

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

Profiling Functions

from suthing.decorate 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.compare 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.3.0.tar.gz (8.6 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.3.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: suthing-0.3.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.16 Linux/6.8.0-51-generic

File hashes

Hashes for suthing-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b096b05bc800e0989634819b1de17ccb3bfd9065c39091e986e06e198d048137
MD5 11b3857e12dc20e54ca9324e5478dd3c
BLAKE2b-256 38b0b969e375681bb6cafa1db96f73dccbac9b10e606b4626a197972bc7f1d56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: suthing-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.16 Linux/6.8.0-51-generic

File hashes

Hashes for suthing-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e5192495cd9e413993eb590d888cf4f4ff8f7ce960e856e8307a1303777c492
MD5 61aa587c124ef30a4f35cba6e7d16da6
BLAKE2b-256 5a9f722a449cbe8bfb489b6e9a3f687fc7f81ad2bc92a023fdf7075fdfb0e97b

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