Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.86 KB

File metadata and controls

40 lines (26 loc) · 1.86 KB

classmods

classmods is a lightweight Python package designed to enhance class behavior with minimal effort. It provides modular decorators and descriptors to automate and simplify class-related tasks like environment variable management, creating example env files, monitoring, logging, and more.

Documentation

All features are well documented and use a high level of type_hints for easy understanding and usage.

Features

(Click names for more information)

  • ConstantAttrib: A descriptor that acts like a constant. Once set, the value cannot be changed. Raises AttributeError on change detection.
  • RemoteAttrib: A descriptor that acts as a remote attribute. You can modify the mapped value on-the-fly.
  • ENVMod: The main API class for managing .env variables. Supports manual and decorator-based registration of environment items, type-safe value loading, and .env_example generation.
  • MethodMonitor: A class to monitor method calls of a target class, triggering a handler function after the method is called.
  • logwrap: A dynamic decorator to log function calls. Uses the logging module with your current project configurations.
  • suppress_errors: A decorator that suppresses exceptions raised by the wrapped function and returns a fallback value instead.
  • SuperWith: A powerful context manager utility that allows you to combine multiple context managers into a single with or async with statement.

Installation

  1. Easy install with pip
pip install classmods
  1. Install with git+pip
pip install git+https://github.com/hmohammad2520-org/classmods

License

MIT License


Made with ❤️ by hmohammad2520