$\Huge\textsf{XulbuX}$
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:
from xulbux import COLOR, CHARS, ANSI
from xulbux import Code, Color, Console, ...
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
from xulbux import FormatCodes, Console
from xulbux import hexa
def main() -> None:
input_clr = FormatCodes.input(
"\n[b](Enter a HEXA color in any format) [dim](>) "
)
Console.log(
"INDEX",
"Indexing the input HEXA color...",
start="\n",
title_bg_color=COLOR.blue,
)
try:
hexa_color = hexa(input_clr)
except ValueError:
Console.fail(
"The input HEXA color is invalid.",
end="\n\n",
exit=True,
)
Console.log(
"CONVERT",
"Converting the HEXA color into different types...",
title_bg_color=COLOR.tangerine,
)
rgba_color = hexa_color.to_rgba()
hsla_color = hexa_color.to_hsla()
Console.done(
"Successfully converted color into different types.",
end="\n\n",
)
Console.log_box_bordered(
f"[b](HEXA:) [i|white]({hexa_color})",
f"[b](RGBA:) [i|white]({rgba_color})",
f"[b](HSLA:) [i|white]({hsla_color})",
)
if __name__ == "__main__":
main()
View this library on PyPI