Skip to main content

Collection of utilities for logging, file management, and environment variable handling.

Project description

Python Toolkit 🛠️🐍

PyPI Version PyPI - Downloads

Welcome to Python Toolkit, a lightweight and personal collection of utilities crafted to make everyday development tasks easier, faster, and more elegant. ✨

This project was born from the need to reuse reliable patterns across different Python applications — instead of rewriting the same helpers every time, now everything is centralized, simple to maintain, and ready to install as a package. 🚀

Whether you are managing environment variables, automating file operations, or printing colorful terminal logs, this toolkit makes it clean, fast, and fun. 💬📦

Installation 📥

Install directly from PyPI:

pip install bertho-toolkit

Classes Included

TerminalLogger 🎨🖥️

A simple logger to print colored messages on the terminal for better readability and debugging.

Features:

  • Success, error, warning, informational, and internal messages.
  • Customizable internal logging.

Usage:

from bertho_toolkit.terminal_logger import TerminalLogger

logger = TerminalLogger(enable_internal_log=True)
logger.log_success("Operation successful!")
logger.log_error("An error occurred.")
logger.log_warning("Warning issued.", reason="Validation")
logger.log_info("Information message.")
logger.log_internal("Internal debugging info.")

FileManager 📂📝

Manages file-related operations, including file search, read, and write, with environment-based configurations.

Features:

  • Automatic management of project paths.
  • Recursive file search ignoring specified files.
  • Robust file read/write operations with automatic directory creation.

Usage:

from bertho_toolkit.file_manager import FileManager

fm = FileManager(env_key="CLASS", enable_log=True)
files = fm.get_files_in_search_path("data")
content = fm.read_file_content(files[0])
fm.write_file_content("output/result.txt", content)

EnvManager 🌿🔧

Automatically handles loading and managing environment variables from a .env file.

Features:

  • Automatic .env file discovery.
  • CRUD operations on environment variables.
  • Utility methods for handling prefixed environment variables.

Usage:

from bertho_toolkit.env_manager import EnvManager

env = EnvManager(enable_log=True)
api_key = env.get("API_KEY")
env.set("NEW_VAR", "value")
env.remove("OLD_VAR")
folder_path = env.get_folder("data")

Contributing 🤝

Feel free to open issues or submit pull requests to improve this toolkit. Contributions are always welcome!

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

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

bertho_toolkit-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

bertho_toolkit-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file bertho_toolkit-1.0.0.tar.gz.

File metadata

  • Download URL: bertho_toolkit-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bertho_toolkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c9d02049874ccd3431ebdda38bf08ab0d9147715fb1f1771913dc6f033490f70
MD5 b2bf9e9b3d7a74467372ab695a7a3936
BLAKE2b-256 55a7a8095603c4f9a74085960ec65dd5d3579125c36a14214e61e0eff9c93edc

See more details on using hashes here.

File details

Details for the file bertho_toolkit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bertho_toolkit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bertho_toolkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae3a6368c9599be24862c6c500eea487228c88d89b38f77d93436ab0346cd7fd
MD5 050432202dbcdfc123d04fb041cdc4e3
BLAKE2b-256 be4cf395063a47a379055723e733a8f9b2dc6ebbea593cb5586ea22f9a5fd681

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