Skip to main content

A modular Python library with utilities for flattening, file parsing, error handling, and more.

Project description

PythonByzaticCommons

PythonByzaticCommons is a modular utility library for Python that provides a collection of reusable components for file reading, exception handling, logging, in-memory storage, singleton management, and more. Designed for extensibility and clean architecture, it helps accelerate development by offering ready-to-use patterns and interfaces.


📦 Modules Overview

exceptions

A set of structured exception classes to formalize error handling in complex systems.

  • BaseErrorException: Root base class for domain-specific exceptions.
  • OperationIncompleteException: Indicates partial success or failure in operations.
  • ExitHandlerException: Used to trigger early exit logic in controlled flows.
  • CriticalErrorException: Raised for non-recoverable fatal errors.
  • NotImplementedException: Placeholder for yet-to-be-implemented logic.

filereaders

Unified interfaces and concrete implementations for parsing configuration files.

  • Interfaces:

    • BaseReaderInterface: Defines contract for readers returning a dict from a file.
  • Readers:

    • JsonFileReader: Loads .json files into Python dictionaries.
    • YamlFileReader: Loads .yaml/.yml files using PyYAML.
    • ConfigParserFileReader: Loads .ini-style config files using configparser.

All readers validate input paths and support standard Python error handling.


in_memory_storages

In-memory key-value storage layer with interchangeable implementations and management.

  • Interfaces:

    • KeyValueDictStorageInterface, KeyValueListStorageInterface, etc.
  • Storages:

    • KeyValueDictStorage: Uses dict internally.
    • KeyValueListStorage: Uses list for indexed access.
    • KeyValueObjectStorage: Stores arbitrary Python objects.
    • KeyValueStringStorage, KeyValueModuleTypeStorage, etc.
  • Manager:

    • StoragesManager: Central registry and access point for storage instances.

Test coverage is included in the test/ directory.


logging_manager

Encapsulates logging configuration and output.

  • LoggingManagerInterface: Describes basic logging interface (info, warn, error, etc.)
  • LoggingManager: Concrete implementation wrapping Python’s built-in logging module with a consistent configuration.

Supports colored output, custom formatters, and stream redirection.


singleton

Provides a class-based singleton pattern.

  • Singleton: A metaclass-based implementation that ensures a class has only one instance across the application.

Useful for shared services like loggers, configuration managers, etc.


✅ Installation

pip install python-byzatic-commons

📖 Example Usage

from python_byzatic_commons.filereaders import JsonFileReader
reader = JsonFileReader()
config = reader.read("config.json")

from python_byzatic_commons.logging_manager import LoggingManager
logger = LoggingManager()
logger.info("App started.")

📄 License

This project is licensed under the terms of the Apache 2.0 license.

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

python_byzatic_commons-0.1.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

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

python_byzatic_commons-0.1.0-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file python_byzatic_commons-0.1.0.tar.gz.

File metadata

  • Download URL: python_byzatic_commons-0.1.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for python_byzatic_commons-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7e15112c9700eaab815e90ff312cdadd0888ec3f34f547f6df6bc95818e15e4d
MD5 bad6edbf27442aff81829e0d7d1983c4
BLAKE2b-256 472a460c35b8153e016ba52a887a3802e17ac9ebc1a8ad65707508796463a5cf

See more details on using hashes here.

File details

Details for the file python_byzatic_commons-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_byzatic_commons-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc5306e93688d9163448f2c0704d3eb247313f691a09d2dd754f8bcd9053b494
MD5 5412356302efaf94bd45f466dba5d835
BLAKE2b-256 3b8188f29b88e5457d36df91baaad4470b93e28a339c65e5892c4b2a67212875

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