Skip to main content

A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.

Project description

XulbuX

XulbuX is a 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 documentation.
For the libraries latest changes and updates, see the change log.

The best modules, you have to check out:

format_codes console color


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

CLI Commands

When the library is installed, the following commands are available in the console:

Command Description
xulbux-help shows some information about the library

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:

# LIBRARY CONSTANTS
from xulbux.base.consts import COLOR, CHARS, ANSI
# Main Classes
from xulbux import Code, Color, Console, ...
# module specific imports
from xulbux.color import rgba, hsla, hexa

Modules

Module Short Description
base includes more modules like library constants
code advanced code-string operations (changing the indent, finding function calls, ...)
color everything around colors (converting, blending, searching colors in strings, ...)
console advanced actions related to the console (pretty logging, advanced inputs, ...)
data advanced operations with data structures (compare, generate path IDs, pretty print, ...)
env_path getting and editing the PATH variable (get paths, check for paths, add paths, ...)
file advanced working with files (create files, rename file-extensions, ...)
format_codes easy pretty printing using custom format codes (print, inputs, format codes to ANSI, ...)
json advanced working with json files (read, create, update, ...)
path advanced path operations (get paths, smart-extend relative paths, delete paths, ...)
regex generated regex pattern-templates (match bracket- and quote pairs, match colors, ...)
string helpful actions when working with strings. (normalize, escape, decompose, ...)
system 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 ultra good-looking color converter:

from xulbux.base.consts import COLOR, CHARS
from xulbux.color import hexa
from xulbux import Console


def main() -> None:

    # LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
    input_clr = Console.input(
        "[b](Enter a HEXA color in any format) > ",
        start="\n",
        placeholder="#7075FF",
        max_len=7,
        allowed_chars=CHARS.HEX_DIGITS,
    )

    # 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
    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

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

xulbux-1.8.1.tar.gz (68.1 kB view details)

Uploaded Source

Built Distribution

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

xulbux-1.8.1-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

Details for the file xulbux-1.8.1.tar.gz.

File metadata

  • Download URL: xulbux-1.8.1.tar.gz
  • Upload date:
  • Size: 68.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xulbux-1.8.1.tar.gz
Algorithm Hash digest
SHA256 1c599fd1141671ac53645459df179edb0fca6679b48b583048c63f923d1c3fa1
MD5 0187024b72009f658f50814129af2baa
BLAKE2b-256 2eaf6ba194a2d8bc1e94e7a96345dadb9f457878a639bf58e4ab6c0ffc0215ff

See more details on using hashes here.

File details

Details for the file xulbux-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: xulbux-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 54.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xulbux-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7fe0f6e4867f47fd7fad758f6622dd7f33872b84de7b97513c852d6756307f4
MD5 c524e4aaa88dbeb30e86cbe89f9eaa75
BLAKE2b-256 b4e7b4242698e1d63ad69af3659063133f13fc80c3797b23a9893605b0f84e6b

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