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
    /tests
        /testLogs
        test_module.py                  # Tests for interfaces and project folder logic
        test_output.py                  # Tests for output/logging functions

Interfaces

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

  • LoggerInterface: Logging, coloured output, and border printing
  • ColourInterface: Colour formatting and ANSI code management
  • FileSystemInterface: File and folder operations
  • ConfigLoaderInterface: Configuration loading and path resolution
  • DataFrameInterface: Data frame operations

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

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

# Example: Using Logger and ColourManager

from tUilKit.utils.output import Logger, ColourManager
import json, os

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

colour_manager = ColourManager(colour_config)
logger = Logger(colour_manager)

log_file = "example.log"
logger.colour_log("INFO", "This is a coloured log message.", log_file=log_file)
logger.log_done(log_file=log_file)

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.5.2.tar.gz (27.2 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.5.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tuilkit-0.5.2.tar.gz
Algorithm Hash digest
SHA256 4808675e7a525d4c1006b66b4e19493fbb007d86e02573bbb275944998c38a38
MD5 df8e301f1ea08be3ebe7057a5bc14ece
BLAKE2b-256 8569b021b085a1972cac860c0cb92409bb53b84ce3e7b3473a55cba2d57b3ee2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tuilkit-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba9af3eaa1cd29af50284737bdb78d0a85e921f3d1dd2165f6495e7c6a126c52
MD5 fb28205b8e6a1221e043a989d9b1de2d
BLAKE2b-256 dbb6cc8a43ecdef0680a02a001c1cf72ff5643860b8e58dcc803d809f57e07e2

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