Skip to main content

A modular Python toolkit providing utility functions, dictionaries, and configuration for development projects, structured around interfaces.

Project description

Project Name

tUilKit Current version: 0.5.1

tUilKit (formerly utilsbase) is a modular Python toolkit providing utility functions, dictionaries, and configuration for development projects.
The package is structured around clear interfaces for logging, colour management, file system operations, and configuration loading, making it easy to extend or swap implementations.
tUilKit is organized into three main components:

  • /config: JSON files for customization and configuration
  • /dict: Python dictionaries and constants (e.g., ANSI codes, RGB values)
  • /utils: Toolkit modules implementing the interfaces

Folder Structure

/src
        /config
            BORDER_PATTERNS.json        # Border Patterns
            COLUMN_MAPPING.json         # DataFrame column mapping
            COLOURS.json                # Foreground text COLOUR_KEY and RGB Reference
            GLOBAL_CONFIG.json          # Folder paths and logging/display options
            config.py                   # ConfigLoader implementation
        /dict
            DICT_CODES.py               # ANSI escape code parts for sequencing
            DICT_COLOURS.py             # RGB ANSI escape codes for sequencing
        /interfaces
            colour_interface.py         # ColourInterface (abstract base class)
            config_loader_interface.py  # ConfigLoaderInterface (abstract base class)
            df_interface.py             # DataFrameInterface (abstract base class)
            file_system_interface.py    # FileSystemInterface (abstract base class)
            logger_interface.py         # LoggerInterface (abstract base class)
        /utils
            fs.py                       # Core - File system operations (FileSystem)
            output.py                   # Core - Printing/Debugging/Logging (Logger, ColourManager)
            sheets.py                   # Primary - CSV/XLSX utilities
            formatter.py                # Primary Extension - formatting utilities (early development)
            pdf.py                      # Add-on - PDF file utilities (early development)
            sql.py                      # Add-on - SQL query utilities (planned)
            calc.py                     # Add-on - Specialized calculations
            wallet.py                   # Add-on - Specialized crypto wallet utilities
            data.py                     # Add-on - Specialized data utilities
    /docs
        tUilKit_Comprehensive_Usage_Guide.md  # Complete usage documentation
    /tests
        /testOutputLogs
        test_module.py                  # Tests for interfaces and project folder logic
        test_output.py                  # Tests for output/logging functions
        test_fs_ops.py                  # Tests for file system operations
        test_multi_category.py          # Tests for multi-category logging

Interfaces

tUilKit uses Python abstract base classes to define clear interfaces for:

4 Primary Interfaces:

  • LoggerInterface: Logging, coloured output, and border printing with selective file routing
  • ColourInterface: Colour formatting and ANSI code management
  • FileSystemInterface: File and folder operations with integrated logging
  • ConfigLoaderInterface: Configuration loading and path resolution

Additional Interface:

  • DataFrameInterface: Data frame operations and intelligent column handling

All implementations in /utils and /config inherit from these interfaces, ensuring modularity and testability.

Installation

Follow these instructions to install and set up the project:

# Navigate to the project directory
cd tUilKit

# (Optional) Create and activate a virtual environment
# python -m venv venv
# source venv/bin/activate  # On Windows use `venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

Usage

For comprehensive usage instructions, see docs/tUilKit_Comprehensive_Usage_Guide.md.

Quick Start

import os
import json
from tUilKit.utils.output import Logger, ColourManager
from tUilKit.utils.fs import FileSystem
from tUilKit.config.config import ConfigLoader

# Load colour configuration
COLOUR_CONFIG_PATH = os.path.join("src", "tUilKit", "config", "COLOURS.json")
with open(COLOUR_CONFIG_PATH, "r") as f:
    colour_config = json.load(f)

# Initialize core components
colour_manager = ColourManager(colour_config)
logger = Logger(colour_manager)
config_loader = ConfigLoader()
file_system = FileSystem(logger)

# Basic logging with colours
logger.colour_log("!info", "tUilKit initialized", "!done", "ready")

# Multi-category logging (new feature)
logger.colour_log("!info", "Complex operation", category=["fs", "error"])

Key Features

  • 4 Primary Interfaces: Logger, ColourManager, FileSystem, ConfigLoader
  • Multi-Category Logging: Log to multiple files simultaneously
  • Colour-Coded Output: Consistent terminal formatting with COLOUR_KEY
  • DataFrame Utilities: Smart merging and column mapping
  • Configuration-Driven: JSON-based customization

Sample usage and tests can be found in the /tests folder.

Contributing

If you would like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

We’re actively seeking contributors to help enhance tUilKit! Whether you’re passionate about terminal functionality, advanced data operations, or document creation, there’s plenty of room to leave your mark.

Areas for Contribution

  • Enhanced ANSI Sequences:
    • Fetching user keystrokes, moving cursor, background colours, advanced terminal features.
  • DataFrame / Spreadsheet Functionality:
    • Smart diff, smart merging, custom autoformatting and updates to the DataFrameInterface and sheets utilities.
  • LaTeX and PDF Functionality:
    • Reading/writing LaTeX, PDF file manipulation (generation, formatting, searching, editing).

License

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

Acknowledgements

  • Thanks to everyone who contributed to this project.

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

tuilkit-0.6.1.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

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

tuilkit-0.6.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file tuilkit-0.6.1.tar.gz.

File metadata

  • Download URL: tuilkit-0.6.1.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for tuilkit-0.6.1.tar.gz
Algorithm Hash digest
SHA256 e4f4cc17320f0d5bc3e39006fe0e54f38798b2bef9f1d7e5a3c0bc9a57954a5b
MD5 4d20db122577e3647f88b68120d33f3b
BLAKE2b-256 555362026053137afea421f99a933a8b9d9d462ee3adf0503c498cb0fcfa333a

See more details on using hashes here.

File details

Details for the file tuilkit-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: tuilkit-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for tuilkit-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 edb8c50cfb3f208de17d59ab2fb2d4815d936d120503eed7c7ef86ec03af8c89
MD5 977e586baa344fe29f0cacbd8215414b
BLAKE2b-256 8097f58946fcf547edd87f842d2d9b5c3e5703be4d61a4094bab5f6402b1a3b2

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