Skip to main content

a collection of small python utilities to use across various projects.

Project description

TrueGIXERJ_Utils

A collection of small but useful utility functions for use across multiple types of projects. Originally made for personal use, but made publicly available for anyone who might find them useful. This package will be continuously expanded with functions that I need — or may need — across different projects, so I don’t have to rewrite them every time (i'm lazy).

And yes, British spelling throughout, because I’m British.

Features

Currently, TrueGIXERJ_Utils includes:

colours.py

Functions to return coloured terminal text using ANSI escape codes, useful for logging or styling console output.

red(text: str) -> str: Returns the input text in red.

yellow(text: str) -> str: Returns the input text in yellow.

green(text: str) -> str: Returns the input text in green.

cyan(text: str) -> str: Returns the input text in cyan.

Example usage:

from TrueGIXERJ_Utils.colours import red
print(red("Error: Something went wrong!"))

files.py

File utility functions, currently including:

sanitise(filename: str) -> str: Cleans up a filename by:

  • Removing non-ASCII characters

  • Stripping special characters not allowed in filenames

  • Removing trailing spaces and dots

  • Avoiding reserved names in Windows (e.g., CON, PRN, NUL, etc.)

Example usage:

from TrueGIXERJ_Utils.files import sanitise
clean_name = sanitise("my*illegal:file?.txt")
print(clean_name)  # Output: myillegalfile.txt

logger.py

Pre-made logging functionality, uses colours.py to colour the output of various logging levels. The following logging levels exist and are appropriately coloured:

  • DEBUG - Cyan
  • INFO - Cyan
  • SUCCESS - Green
  • WARNING - Yellow
  • ERROR - Red
  • CRITICAL - Red

Example usage:

from TrueGIXERJ_Utils.logger import logger
logger.debug("This is a debug message")
logger.info("This is an info message")
logger.success("This is a success message")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical error message")

Installation

This package is available on PyPI, and can be installed by running:

pip install TrueGIXERJ-Utils

Alternatively, it can be manually installed by cloning the git repository:

git clone https://github.com/YourUsername/TrueGIXERJ_Utils.git

Usage

Simply import the necessary modules and use the functions as described above.

from TrueGIXERJ_Utils.colours import red, green
from TrueGIXERJ_Utils.files import sanitise
from TrueGIXERJ_Utils.logger import logger

print(red("This is an error message"))
print(sanitise("illegal:file/name.txt"))
logger.success("Yippee!")

Project Structure

TrueGIXERJ_Utils/
├── __init__.py
├── colours.py
├── files.py
└── logger.py

License

This project is licensed under the GNU General Public License v3.0. See the LICENCE file for details.

Contributing

Due to the nature of the project, I will be updating it on an "as and when" basis. However; if you have any suggestions or improvements, feel free to submit a pull request or open an issue on GitHub. Or just come and shout at me loudly on my personal Discord.

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

truegixerj_utils-2025.2.27.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

truegixerj_utils-2025.2.27-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file truegixerj_utils-2025.2.27.tar.gz.

File metadata

  • Download URL: truegixerj_utils-2025.2.27.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for truegixerj_utils-2025.2.27.tar.gz
Algorithm Hash digest
SHA256 5bc498ef7ca7d4f95826a8f087cd077e4d9200157819b132a3bdde8958bdbb03
MD5 6a386eac8c15b743397516b410f11549
BLAKE2b-256 574d449b72d15f4522ec84c8998fdc37107968cd19bd4546113c5e1cf773122c

See more details on using hashes here.

File details

Details for the file truegixerj_utils-2025.2.27-py3-none-any.whl.

File metadata

File hashes

Hashes for truegixerj_utils-2025.2.27-py3-none-any.whl
Algorithm Hash digest
SHA256 2d612d32f514b4cb492f28a1b419ff8999e9829c71904acb636a02ecffb8c263
MD5 55795bcfdffce4289a2c5c12f75ffbda
BLAKE2b-256 dd6df6f16ed325f358ec24c70cf9cfcbe35101f4c9d2b17278eb279f5f0d26b4

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