Skip to main content

Simple Python utility functions to save and load data

Project description

utilitz

utilitz is a versatile Python utility library designed to simplify common tasks such as data persistence, Excel table manipulation, system automation, and advanced pattern matching.

It is built with a modular approach, keeping the core library lightweight while providing powerful specialized modules through optional dependencies.

Current release: 0.9.0

🚀 Installation

Core (Lightweight)

Installs only the essential utilities for text, JSON, and object serialization.

pip install utilitz

With Specialized Modules

Install specific modules as needed to keep your environment lean:

# For Excel and Dataframe support
pip install utilitz[office]

# For GUI automation and Activity monitoring
pip install utilitz[gui]

# For Encryption and Decryption
pip install utilitz[crypto]

# Install everything
pip install utilitz[all]

✨ Key Features

📁 Core IO Utilities

Simple functions for saving and loading data without boilerplates.

  • save_text / load_text: Handle lists of strings.
  • save_json / load_json: Work with dictionary and list structures.
  • save_object / load_object: Convenient pickle serialization.

📊 Excel & Data (Optional: [office])

  • read_excel_table: Intelligently reads tables from Excel files, with support for row filtering based on regex patterns and dynamic range detection.
  • encode_column / decode_column: Convert between Excel column names (e.g., "A", "AB") and numeric indices.

🛡️ Crypto (Optional: [crypto])

  • Encryptor / Decryptor: Class-based encryption and decryption workflows using cryptography (Fernet) with password-based key derivation (PBKDF2).
  • CryptoInput / CryptoOutput: Normalize input data and preserve encrypted artifacts with the minimum metadata needed to restore the original payload.
  • Supports strings, files, directories, and picklable Python values.

🖥️ System & GUI (Optional: [gui])

  • monitor_keep_alive: Prevent system sleep by simulating activity when no user input is detected.
  • MonitorActivity: A simple class to track keyboard and mouse events.

🔍 Advanced Regex (utilitz.regex)

  • A specialized framework for building complex, readable, and reusable regex patterns with built-in decoding for common types like integers, decimal numbers, currencies, and dates.

🗺️ Path Management (utilitz.path)

  • locate_project: Easily find and set the project root directory.
  • set_source: Dynamically manage sys.path entries.

🛠 Usage Examples

Reading an Excel Table

from utilitz.excel import read_excel_table

# Read a table from an Excel file starting from column A
# and filtering rows that match a specific pattern.
df = read_excel_table("data.xlsx", checkcol="A", patterncol=r"^\d+")

Encrypting Data

from utilitz.crypto import Encryptor

secret = "My secret message"
password = "strong-password"

encrypted = Encryptor.from_string(secret).encrypt(password)
token = encrypted.to_string()
original = encrypted.to_decryptor().decrypt(password).to_string()

Encrypting Python Values

from utilitz.crypto import Encryptor

payload = {"name": "ana", "roles": ["admin", "editor"]}
password = "strong-password"

encrypted = Encryptor.from_value(payload).encrypt(password)
restored = encrypted.to_decryptor().decrypt(password).to_value()

Keeping the System Awake

from utilitz.sys import monitor_keep_alive

# Press 'ctrl' every 60 seconds if no activity is detected
monitor_keep_alive(seconds=60, key='ctrl')

📄 License

This project is licensed under the GNU General Public License v3 (GPLv3).

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

utilitz-0.9.0.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

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

utilitz-0.9.0-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file utilitz-0.9.0.tar.gz.

File metadata

  • Download URL: utilitz-0.9.0.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for utilitz-0.9.0.tar.gz
Algorithm Hash digest
SHA256 187c06cb058ce779520d519cbc3d5904b7dfa801ebabb0206bbc3244255b45c9
MD5 bb44b79b8a25d176608f508c688fa5a7
BLAKE2b-256 c54e8245282b87cc799c3322d961b1569595290114e5795e0807e92702fe7197

See more details on using hashes here.

File details

Details for the file utilitz-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: utilitz-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for utilitz-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7dc5143ba79dedd11535f4a4d62a02284883327359b6d7a3100fbca79e0bb65
MD5 6704a998dfbb32983af757fbd327483a
BLAKE2b-256 adb175a7f225291adf5f4f860ea268c44dee8a1edb0959b5b306770ae6122e22

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