A modular Python toolkit providing utility functions, dictionaries, and configuration for development projects, structured around interfaces.
Project description
Project Name
tUilKit Current version: 0.8.0
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
ColourKey_Usage_Guide.md # Colour key addendum
FileSystem_Usage_Guide.md # File system addendum
/tests
/testOutputLogs
test_config.py # ConfigLoader + config paths
test_output.py # Output/logging functions
test_fs_ops.py # File system operations
test_multi_category.py # Multi-category logging
test_interfaces.py # Interface compliance
test_sheets.py # DataFrame utilities
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. For colour codes and filesystem patterns, see docs/ColourKey_Usage_Guide.md and docs/FileSystem_Usage_Guide.md.
Quick Start
Using Factory Functions (Recommended)
from tUilKit import get_logger, get_file_system, get_config_loader
# Initialize all components with a single call per component
logger = get_logger()
fs = get_file_system()
config = get_config_loader()
# Basic logging with colours
logger.colour_log("!info", "tUilKit initialized", "!done", "ready")
# Multi-category logging
logger.colour_log("!info", "Complex operation", category=["fs", "error"])
Direct Initialization (Advanced)
from tUilKit.utils.output import Logger, ColourManager
from tUilKit.utils.fs import FileSystem
from tUilKit.config.config import ConfigLoader
# Initialize core components manually
config_loader = ConfigLoader()
colour_config = config_loader.load_colour_config()
colour_manager = ColourManager(colour_config)
logger = Logger(colour_manager, log_files=config_loader.global_config.get("LOG_FILES", {}))
file_system = FileSystem(logger, log_files=config_loader.global_config.get("LOG_FILES", {}))
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tuilkit-0.8.1.tar.gz.
File metadata
- Download URL: tuilkit-0.8.1.tar.gz
- Upload date:
- Size: 49.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e42271da73852b92005ca1b2452d6ef5a0d06805d2333fded195101eef4d1fc
|
|
| MD5 |
463b0cc5a48106771a2c56b6a1df418f
|
|
| BLAKE2b-256 |
478f13b28c18991dea5e8afb69cce126b3c7d48bde9002ea2b8e6aff298632e4
|
File details
Details for the file tuilkit-0.8.1-py3-none-any.whl.
File metadata
- Download URL: tuilkit-0.8.1-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6804a94c928ea537a569d5f66ba265272a0f2311005bc3fa102d9702e4e1966
|
|
| MD5 |
cf57fc01fd2e093d08b168c44433c614
|
|
| BLAKE2b-256 |
ba3e0e4f7b2aec318a0905c59db0a7bc1e2c7d35e73a8ff5c9213fc1dbc7a95e
|