Metadata-Version: 2.4
Name: pytoolkitlib
Version: 0.0.1
Summary: pytoolkitlib
Requires-Python: >=3.7
Description-Content-Type: text/markdown

\# pytoolkitlib 🛠



`pytoolkitlib` is a lightweight, zero-dependency Python utility toolkit designed to streamline common development tasks such as logging setup, JSON operations, file hashing, and performance benchmarking.



\---



\## Features



\* \*\*LoggerToolkit\*\*: Quick and simple setup for console and file logging.

\* \*\*FileToolkit\*\*: Safe reading and writing of JSON files, along with file hash generation (`SHA-256`, etc.) for integrity checks.

\* \*\*BenchmarkToolkit\*\*: Handy decorators to measure execution time of your functions.

\* \*\*Zero Dependencies\*\*: Built entirely using Python standard libraries.



\---



\## Quick Start



\### Installation



Install pytoolkitlib via pip:



```bash

pip install pytoolkitlib

```

Usage Examples

1\. Setup Logging

```Python

from pytoolkitlib import LoggerToolkit



\# Initialize logger with both console and file output

logger = LoggerToolkit.setup\_logger(name="AppLogger", log\_file="app.log")

logger.info("Application started successfully!")

```

2\. Work with JSON \& File Hashes

```Python

from pytoolkitlib import FileToolkit



data = {"user": "Alice", "role": "admin"}



\# Write JSON safely

FileToolkit.write\_json("config.json", data)



\# Read JSON safely

config = FileToolkit.read\_json("config.json")



\# Generate file SHA-256 hash

file\_hash = FileToolkit.get\_file\_hash("config.json")

print(f"File SHA-256: {file\_hash}")

```

3\. Measure Function Performance

```Python

import time

from pytoolkitlib import BenchmarkToolkit



@BenchmarkToolkit.timer

def process\_data():

&#x20;   time.sleep(1)



\# Calling the function will automatically log its execution time

process\_data()

\# Output: \[Timer] Function 'process\_data' executed in 1.0005 seconds.

```

License

This project is open-source and available under the MIT License.

