Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b479090
version bump & add/use new `LazyRegex(…)` class
xulbux Dec 15, 2025
6852fd0
rename constants in `cli.help` for better clarity
xulbux Dec 15, 2025
17809d1
remove unnecessary runtime type-checks
xulbux Dec 15, 2025
2159db8
remove unused imports and rename `FormatCodes.__config_console()` to …
xulbux Dec 15, 2025
0b493fb
add Python version `3.14` to the GitHub testing workflow
xulbux Dec 15, 2025
d2deb96
make `Console.get_args()` intake `**find_args` kwargs instead of a `f…
xulbux Dec 15, 2025
33b010b
fix: f-string expression part cannot include a backslash
xulbux Dec 15, 2025
f05947c
adjust library description and README
xulbux Dec 16, 2025
31b3eb3
change `Regex.brackets()` param default value
xulbux Dec 16, 2025
e93d971
update project metadata
xulbux Dec 16, 2025
5dee53f
add missing tests and organize existing tests better
xulbux Dec 16, 2025
cf4abcf
adjust docstrings and CHANGELOG
xulbux Dec 16, 2025
7eefd84
add incompatibility notice
xulbux Dec 16, 2025
84c87db
adjust incompatibility notice
xulbux Dec 16, 2025
09d95d2
clarify CHANGELOG
xulbux Dec 16, 2025
fd0d6da
fix release date & add version consistency test
xulbux Dec 16, 2025
60bd662
adjust version consistency test for when running as GitHub workflow
xulbux Dec 16, 2025
b2d9489
linting
xulbux Dec 16, 2025
b02de77
intentionally change to bad hardcoded version to check if version-con…
xulbux Dec 16, 2025
dd0a434
seems to work, bump version to be correct again
xulbux Dec 16, 2025
401ab4e
bugfix & linting
xulbux Dec 16, 2025
7a8f6c7
finish bugfix & clarify CHANGELOG
xulbux Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install project and dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
pip install flake8 flake8-pyproject pytest

- name: Lint with flake8
run: |
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
python -m flake8 . --exit-zero --max-complexity=12 --statistics

- name: Test with pytest
run: |
python -m pytest --verbose
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install project and dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
pip install flake8 flake8-pyproject pytest

- name: Lint with flake8
run: |
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
python -m flake8 . --exit-zero --max-complexity=12 --statistics

- name: Test with pytest
run: |
python -m pytest --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cython_debug/
__pypackages__/

# TESTING
.venv/
.pytest_cache/

# MISCELLANEOUS
Expand Down
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div style="
font-size: 2em;
font-weight: bold;
background: #88889845;
background: #86878A45;
border-radius: 0.2em;
text-align: center;
justify-content: center;
Expand All @@ -15,6 +15,28 @@
# <br><b>Changelog</b><br>


<span id="v1-9-2" />

## 16.12.2025 `v1.9.2`
* Added a new class `LazyRegex` to the `regex` module, which is used to define regex patterns that are only compiled when they are used for the first time.
* Removed unnecessary character escaping in the precompiled regex patterns in the `console` module.
* Removed all the runtime type-checks that can also be checked using static type-checking tools, since you're supposed to use type checkers in modern python anyway, and to improve performance.
* Renamed the internal class method `FormatCodes.__config_console()` to `FormatCodes._config_console()` to make it callable, but still indicate that it's internal.
* Fixed a small bug where `Console.log_box_…()` would crash, when calling it without providing any `*values` (*content for inside the box*).

**BREAKING CHANGES:**
* The arguments when calling `Console.get_args()` are no longer specified in a single dictionary, but now each argument is passed as a separate keyword argument.<br>
You can still use a dictionary just fine by simply unpacking it with `**`, like this:
```python
Console.get_args(**{"arg": {"-a", "--arg"}})
```
* Replaced the internal `_COMPILED` regex pattern dictionaries with `LazyRegex` objects so it won't compile all regex patterns on library import, but only when they are used for the first time, which improves the library's import time.
* Renamed the internal `_COMPILED` regex pattern dictionaries to `_PATTERNS` for better clarity.
* Removed the import of the `ProgressBar` class from the `__init__.py` file, since it's not an important main class that should be imported directly.
* Renamed the constant `CLR` to `CLI_COLORS` and the constant `HELP` to `CLI_HELP` in the `cli.help` module.
* Changed the default value of the `strip_spaces` param in `Regex.brackets()` from `True` to `False`, since this is more intuitive behavior.


<span id="v1-9-1" />

## 26.11.2025 `v1.9.1`
Expand Down Expand Up @@ -810,7 +832,7 @@ from XulbuX import rgb, hsl, hexa
<div style="
font-size: 2em;
font-weight: bold;
background: #88889845;
background: #86878A45;
border-radius: 0.2em;
text-align: center;
justify-content: center;
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
> [!IMPORTANT]
> This library is compatible with Python 3.14, but **certain dependencies might not yet support this version**.

# **xulbux**

[![](https://img.shields.io/pypi/v/xulbux?style=flat&labelColor=404560&color=7075FF)](https://pypi.org/project/xulbux) [![](https://img.shields.io/pepy/dt/xulbux?style=flat&labelColor=404560&color=7075FF)](https://clickpy.clickhouse.com/dashboard/xulbux) [![](https://img.shields.io/github/license/XulbuX/PythonLibraryXulbuX?style=flat&labelColor=405555&color=70FFEE)](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE) [![](https://img.shields.io/github/last-commit/XulbuX/PythonLibraryXulbuX?style=flat&labelColor=554045&color=FF6065)](https://github.com/XulbuX/PythonLibraryXulbuX/commits) [![](https://img.shields.io/github/issues/XulbuX/PythonLibraryXulbuX?style=flat&labelColor=554045&color=FF6065)](https://github.com/XulbuX/PythonLibraryXulbuX/issues) [![](https://img.shields.io/github/stars/XulbuX/PythonLibraryXulbuX?label=★&style=flat&labelColor=604A40&color=FF9673)](https://github.com/XulbuX/PythonLibraryXulbuX/stargazers)
Expand Down Expand Up @@ -51,9 +54,9 @@ So you don't have to import the full library under an alias, you can also import
```python
# LIBRARY SUB MODULES
from xulbux.base.consts import COLOR, CHARS, ANSI
# Main Classes
# MODULE MAIN CLASSES
from xulbux import Code, Color, Console, ...
# module specific imports
# MODULE SPECIFIC IMPORTS
from xulbux.color import rgba, hsla, hexa
```

Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "xulbux"
version = "1.9.1"
version = "1.9.2"
authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
maintainers = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
description = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
description = "A Python library to simplify common programming tasks."
readme = "README.md"
license = "MIT"
license-files = ["LICEN[CS]E.*"]
Expand All @@ -26,6 +26,7 @@ optional-dependencies = { dev = [
] }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -109,7 +110,7 @@ xulbux-help = "xulbux.cli.help:show_help"

[tool.black]
line-length = 127
target-version = ['py310', 'py311', 'py312', 'py313']
target-version = ['py310', 'py311', 'py312', 'py313', 'py314']
include = '\.pyi?$'
extend-exclude = '''
/(
Expand Down Expand Up @@ -165,4 +166,5 @@ testpaths = [
"tests/test_regex.py",
"tests/test_string.py",
"tests/test_system.py",
"tests/test_version_consistency.py",
]
6 changes: 2 additions & 4 deletions src/xulbux/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
__version__ = "1.9.1"
__version__ = "1.9.2"

__author__ = "XulbuX"
__email__ = "xulbux.real@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2024 XulbuX"
__url__ = "https://github.com/XulbuX/PythonLibraryXulbuX"
__description__ = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
__description__ = "A Python library to simplify common programming tasks."

__all__ = [
"Code",
Expand All @@ -17,7 +17,6 @@
"FormatCodes",
"Json",
"Path",
"ProgressBar",
"Regex",
"String",
"System",
Expand All @@ -26,7 +25,6 @@
from .code import Code
from .color import Color
from .console import Console
from .console import ProgressBar
from .data import Data
from .env_path import EnvPath
from .file import File
Expand Down
42 changes: 22 additions & 20 deletions src/xulbux/cli/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ def is_latest_version() -> Optional[bool]:
try:
if (latest := get_latest_version()) in {"", None}:
return None
latest_v_parts = tuple(int(part) for part in (latest or "").lower().lstrip("v").split('.'))
installed_v_parts = tuple(int(part) for part in __version__.lower().lstrip("v").split('.'))
latest_v_parts = tuple(int(part) for part in (latest or "").lower().lstrip("v").split("."))
installed_v_parts = tuple(int(part) for part in __version__.lower().lstrip("v").split("."))
return latest_v_parts <= installed_v_parts
except Exception:
return None


URL = "https://pypi.org/pypi/xulbux/json"
IS_LATEST_VERSION = is_latest_version()
CLR = {

CLI_COLORS = {
"border": "dim|br:black",
"class": "br:cyan",
"const": "br:blue",
Expand All @@ -43,33 +44,34 @@ def is_latest_version() -> Optional[bool]:
"punctuator": "br:black",
"text": "white",
}
HELP = FormatCodes.to_ansi(
CLI_HELP = FormatCodes.to_ansi(
rf""" [_|b|#7075FF] __ __
[b|#7075FF] _ __ __ __/ / / /_ __ ___ __
[b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
[b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|#000|BG:#8085FF] v[b]{__version__} [*|dim|{CLR['notice']}]({'' if IS_LATEST_VERSION else ' (newer available)'})[*]
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|#000|BG:#8085FF] v[b]{__version__} [*|dim|{CLI_COLORS["notice"]}]({"" if IS_LATEST_VERSION else " (newer available)"})[*]

[i|#9095FF]A TON OF COOL FUNCTIONS, YOU NEED![*]

[b|{CLR['heading']}](Usage:)[*]
[{CLR['border']}](╭────────────────────────────────────────────────────╮)[*]
[{CLR['border']}](│) [i|{CLR['punctuator']}](# LIBRARY CONSTANTS)[*] [{CLR['border']}](│)[*]
[{CLR['border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuator']}].[{CLR['lib']}]base[{CLR['punctuator']}].[{CLR['lib']}]consts [{CLR['import']}]import [{CLR['const']}]COLOR[{CLR['punctuator']}], [{CLR['const']}]CHARS[{CLR['punctuator']}], [{CLR['const']}]ANSI[*] [{CLR['border']}](│)[*]
[{CLR['border']}](│) [i|{CLR['punctuator']}](# Main Classes)[*] [{CLR['border']}](│)[*]
[{CLR['border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux [{CLR['import']}]import [{CLR['class']}]Code[{CLR['punctuator']}], [{CLR['class']}]Color[{CLR['punctuator']}], [{CLR['class']}]Console[{CLR['punctuator']}], ...[*] [{CLR['border']}](│)[*]
[{CLR['border']}](│) [i|{CLR['punctuator']}](# module specific imports)[*] [{CLR['border']}](│)[*]
[{CLR['border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuator']}].[{CLR['lib']}]color [{CLR['import']}]import [{CLR['func']}]rgba[{CLR['punctuator']}], [{CLR['func']}]hsla[{CLR['punctuator']}], [{CLR['func']}]hexa[*] [{CLR['border']}](│)
[{CLR['border']}](╰────────────────────────────────────────────────────╯)[*]
[b|{CLR['heading']}](Documentation:)[*]
[{CLR['border']}](╭────────────────────────────────────────────────────╮)[*]
[{CLR['border']}](│) [{CLR['text']}]For more information see the GitHub page. [{CLR['border']}](│)[*]
[{CLR['border']}](│) [{CLR['link']}](https://github.com/XulbuX/PythonLibraryXulbuX/wiki) [{CLR['border']}](│)[*]
[{CLR['border']}](╰────────────────────────────────────────────────────╯)[*]
[b|{CLI_COLORS["heading"]}](Usage:)[*]
[{CLI_COLORS["border"]}](╭────────────────────────────────────────────────────╮)[*]
[{CLI_COLORS["border"]}](│) [i|{CLI_COLORS["punctuator"]}](# LIBRARY CONSTANTS)[*] [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [{CLI_COLORS["import"]}]from [{CLI_COLORS["lib"]}]xulbux[{CLI_COLORS["punctuator"]}].[{CLI_COLORS["lib"]}]base[{CLI_COLORS["punctuator"]}].[{CLI_COLORS["lib"]}]consts [{CLI_COLORS["import"]}]import [{CLI_COLORS["const"]}]COLOR[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["const"]}]CHARS[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["const"]}]ANSI[*] [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [i|{CLI_COLORS["punctuator"]}](# Main Classes)[*] [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [{CLI_COLORS["import"]}]from [{CLI_COLORS["lib"]}]xulbux [{CLI_COLORS["import"]}]import [{CLI_COLORS["class"]}]Code[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["class"]}]Color[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["class"]}]Console[{CLI_COLORS["punctuator"]}], ...[*] [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [i|{CLI_COLORS["punctuator"]}](# module specific imports)[*] [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [{CLI_COLORS["import"]}]from [{CLI_COLORS["lib"]}]xulbux[{CLI_COLORS["punctuator"]}].[{CLI_COLORS["lib"]}]color [{CLI_COLORS["import"]}]import [{CLI_COLORS["func"]}]rgba[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["func"]}]hsla[{CLI_COLORS["punctuator"]}], [{CLI_COLORS["func"]}]hexa[*] [{CLI_COLORS["border"]}](│)
[{CLI_COLORS["border"]}](╰────────────────────────────────────────────────────╯)[*]
[b|{CLI_COLORS["heading"]}](Documentation:)[*]
[{CLI_COLORS["border"]}](╭────────────────────────────────────────────────────╮)[*]
[{CLI_COLORS["border"]}](│) [{CLI_COLORS["text"]}]For more information see the GitHub page. [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](│) [{CLI_COLORS["link"]}](https://github.com/XulbuX/PythonLibraryXulbuX/wiki) [{CLI_COLORS["border"]}](│)[*]
[{CLI_COLORS["border"]}](╰────────────────────────────────────────────────────╯)[*]
[_]"""
)


def show_help() -> None:
print(HELP)
FormatCodes._config_console()
print(CLI_HELP)
Console.pause_exit(pause=True, prompt=" [dim](Press any key to exit...)\n\n")
Loading