A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.
Project description
$\color{#8085FF}\Huge\textsf{XulbuX}$
$\color{#8085FF}\textsf{XulbuX}$ is library that contains many useful classes, types, and functions, ranging from console logging and working with colors to file management and system operations. The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
For precise information about the library, see the library's wiki page.
For the libraries latest changes and updates, see the change log.
Installation
Run the following commands in a console with administrator privileges, so the actions take effect for all users.
Install the library and all its dependencies with the command:
pip install xulbux
Upgrade the library and all its dependencies to their latest available version with the command:
pip install --upgrade xulbux
Usage
Import the full library under the alias xx, so its constants, classes, methods and types are accessible with xx.CONSTANT.value, xx.Class.method(), xx.type():
import xulbux as xx
So you don't have to import the full library under an alias, you can also import only certain parts of the library's contents:
# CONSTANTS
from xulbux import COLOR, CHARS, ANSI
# Classes
from xulbux import Code, Color, Console, ...
# types
from xulbux import rgba, hsla, hexa
Modules
|
advanced code-string operations (changing the indent, finding function calls, ...) |
|
everything around colors (converting, blending, searching colors in strings, ...) |
|
advanced actions related to the console (pretty logging, advanced inputs, ...) |
|
advanced operations with data structures (compare, generate path ID's, pretty print/format, ...) |
|
getting and editing the PATH variable (get paths, check for paths, add paths, ...) |
|
advanced working with files (create files, rename file-extensions, ...) |
|
easy pretty printing with custom format codes (print, inputs, custom format codes to ANSI, ...) |
|
advanced working with json files (read, create, update, ...) |
|
advanced path operations (get paths, smart-extend relative paths, delete paths, ...) |
|
generated regex pattern-templates (match bracket- and quote pairs, match colors, ...) |
|
helpful actions when working with strings. (normalize, escape, decompose, ...) |
|
advanced system actions (restart with message, check installed Python libs, ...) |
Example Usage
This is what it could look like using this library for a simple but very nice looking color converter:
from xulbux import COLOR # CONSTANTS
from xulbux import FormatCodes, Console # Classes
from xulbux import hexa # types
def main() -> None:
# LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
input_clr = FormatCodes.input(
"\n[b](Enter a HEXA color in any format) [dim](>) "
)
# ANNOUNCE INDEXING THE INPUT COLOR
Console.log(
"INDEX",
"Indexing the input HEXA color...",
start="\n",
title_bg_color=COLOR.blue,
)
try:
# TRY TO CONVERT THE INPUT COLOR INTO A hexa() COLOR
hexa_color = hexa(input_clr)
except ValueError:
# ANNOUNCE THE ERROR AND EXIT THE PROGRAM
Console.fail(
"The input HEXA color is invalid.",
end="\n\n",
exit=True,
)
# ANNOUNCE STARTING THE CONVERSION
Console.log(
"CONVERT",
"Converting the HEXA color into different types...",
title_bg_color=COLOR.tangerine,
)
# CONVERT THE HEXA COLOR INTO THE TWO OTHER COLOR TYPES
rgba_color = hexa_color.to_rgba()
hsla_color = hexa_color.to_hsla()
# ANNOUNCE THE SUCCESSFUL CONVERSION
Console.done(
"Successfully converted color into different types.",
end="\n\n",
)
# PRETTY PRINT THE COLOR IN DIFFERENT TYPES
FormatCodes.print(f"[b](HEXA:) [i|white]({hexa_color})")
FormatCodes.print(f"[b](RGBA:) [i|white]({rgba_color})")
FormatCodes.print(f"[b](HSLA:) [i|white]({hsla_color})\n")
if __name__ == "__main__":
main()
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 xulbux-1.6.7.tar.gz.
File metadata
- Download URL: xulbux-1.6.7.tar.gz
- Upload date:
- Size: 49.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
514838691408c51e40368902c3ae9c1719098fd890417b220d9504188e1dab8c
|
|
| MD5 |
fe28b7d4841c02db5a2f8864154aef0a
|
|
| BLAKE2b-256 |
f3c3ae99b549754c30ff60f2a7da728c4508152ac6cec60f81264abce0c45bf1
|
File details
Details for the file xulbux-1.6.7-py3-none-any.whl.
File metadata
- Download URL: xulbux-1.6.7-py3-none-any.whl
- Upload date:
- Size: 48.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b8471a9a9212e40480b412f999f72bc8dac66502b40581c9034e074ed65193f
|
|
| MD5 |
b1bbc441c37e29a70d0e3b810d9e9840
|
|
| BLAKE2b-256 |
0cd265553a293a98a0c3a51fdf9404e7f905c3b49aadfd5b6b061721fbcdbb2d
|