Skip to content

Commit b047522

Browse files
authored
Merge release v1.9.3 into main
Merge version 1.9.3 of 'xulbux' into the main branch. For more info on this update, see the change log: https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md#v1-9-3
2 parents a4399c5 + 9e53cd4 commit b047522

27 files changed

Lines changed: 2777 additions & 1821 deletions

.github/workflows/build-and-publish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# THIS WORKFLOW WILL BUILD THE LIBRARY FOR DIFFERENT OSes AND PUBLISH THE BUILDS TO PYPI
1+
# THIS WORKFLOW WILL BUILD WHEELS FOR ALL MAJOR PLATFORMS AND UPLOAD THEM TO PYPI
22

3-
name: Build and Publish to PyPI
3+
# git tag v1.0.0
4+
# git push origin v1.0.0
5+
6+
name: Build and Publish
47
permissions:
58
contents: read
69

@@ -50,6 +53,8 @@ jobs:
5053
needs: [build_wheels, build_sdist]
5154
runs-on: ubuntu-latest
5255
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
56+
permissions:
57+
id-token: write
5358
steps:
5459
- uses: actions/download-artifact@v4
5560
with:
@@ -58,5 +63,3 @@ jobs:
5863
path: dist
5964

6065
- uses: pypa/gh-action-pypi-publish@release/v1
61-
with:
62-
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1-
# IDE & EDITOR SETTINGS
2-
.vscode/
3-
.python-version
4-
5-
# CREDENTIALS & CONFIGURATION
6-
.env
7-
.npmrc
8-
.pypirc
9-
101
# COMPILED FILES & CACHES
112
__pycache__/
3+
__pypackages__/
4+
.mypy_cache/
5+
.pytest_cache/
126
*.py[cod]
137
*$py.class
148

159
# BUILD ARTIFACTS
10+
*.egg-info/
1611
build/
1712
dist/
18-
target/
19-
wheels/
20-
*.egg-info/
21-
.Python
22-
.pybuilder/
23-
.pytype/
24-
cython_debug/
25-
__pypackages__/
2613

2714
# TESTING
2815
.venv/
29-
.pytest_cache/
30-
31-
# MISCELLANEOUS
32-
.DS_Store
33-
Thumbs.db

CHANGELOG.md

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,46 @@
1515
# <br><b>Changelog</b><br>
1616

1717

18+
<span id="v1-9-3" />
19+
20+
## 01.01.2026 `v1.9.3` Big Update 🚀
21+
22+
**𝓗𝓪𝓹𝓹𝔂 𝟚𝟘𝟚𝟞 🎉**
23+
24+
* Added a new method `Color.str_to_hsla()` to parse HSLA colors from strings.
25+
* Changed the default syntax highlighting for `Data.to_str()` and therefore also `Data.print()` to use console default colors.
26+
* Added the missing but needed dunder methods to the `Args` and `ArgResult` classes and the `rgba`, `hsla` and `hexa` color objects for better usability and type checking.
27+
* Added three new methods to `Args`:
28+
- `get()` returns the argument result for a given alias, or a default value if not found
29+
- `existing()` yields only the existing arguments as tuples of `(alias, ArgResult)`
30+
- `missing()` yields only the missing arguments as tuples of `(alias, ArgResult)`
31+
* Added a new attribute `is_positional` to `ArgResult`, which indicates whether the argument is a positional argument or not.
32+
* The `ArgResult` class now also has a `dict()` method, which returns the argument result as a dictionary.
33+
* Added new properties `is_tty` and `supports_color` to the `Console` class, `home` to the `Path` class and `is_win` to the `System` class.
34+
* Added the option to add format specifiers to the `{current}`, `{total}` and `{percentage}` placeholders in the `bar_format` and `limited_bar_format` of `ProgressBar`.
35+
* Finally fixed the `C901 'Console.get_args' is too complex (39)` linting error by refactoring the method into its own helper class.
36+
* Changed the string- and repr-representations of the `rgba` and `hsla` color objects and newly implemented it for the `Args` and `ArgResult` classes.
37+
* Made internal, global constants, which's values never change, into `Final` constants for better type checking.
38+
* The names of all internal classes and methods are all no longer prefixed with a double underscore (`__`), but a single underscore (`_`) instead.
39+
* Changed all methods defined as `@staticmethod` to `@classmethod` where applicable, to improve inheritance capabilities.
40+
* Adjusted the whole library's type hints to be way more strict and accurate, using `mypy` as static type checker.
41+
* Change the class-property definitions to be defined via `metaclass` and using `@property` decorators, to make them compatible with `mypyc`.
42+
* Unnest all the nested methods in the whole library for compatibility with `mypyc`.
43+
* The library is now compiled using `mypyc` when installing, which makes it run significantly faster. Benchmarking results:
44+
- Simple methods like data and color operations had a speed improvement of around 50%.
45+
- Complex methods like console logging had a speed improvement of up to 230%!
46+
47+
**BREAKING CHANGES:**
48+
* Renamed `Data.to_str()` to `Data.render()`, since that describes its functionality better (*especially with the syntax highlighting option*).
49+
* Renamed the constant `ANSI.ESCAPED_CHAR` to `ANSI.CHAR_ESCAPED` for better consistency with the other constant names.
50+
* Removed the general `Pattern` and `Match` type aliases from the `base.types` module (*they are pointless since you should always use a specific type and not "type1 OR typeB"*).
51+
* Removed the `_` prefix from the param `_syntax_highlighting` in `Data.render()`, since it's no longer just for internal use.
52+
53+
1854
<span id="v1-9-2" />
1955

2056
## 16.12.2025 `v1.9.2`
57+
2158
* 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.
2259
* Removed unnecessary character escaping in the precompiled regex patterns in the `console` module.
2360
* 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.
@@ -40,6 +77,7 @@
4077
<span id="v1-9-1" />
4178

4279
## 26.11.2025 `v1.9.1`
80+
4381
* Unified the module and class docstring styles throughout the whole library.
4482
* Moved the Protocol `ProgressUpdater` from the `console` module to the `types` module.
4583
* Added throttling to the `ProgressBar` update methods to impact the actual process' performance as little as possible.
@@ -55,6 +93,7 @@
5593
<span id="v1-9-0" />
5694

5795
## 21.11.2025 `v1.9.0` Big Update 🚀
96+
5897
* Standardized the docstrings for all public methods in the whole library to use the same style and structure.
5998
* Replaced left over single quotes with double quotes for consistency.
6099
* Fixed a bug inside `Data.remove_empty_items()`, where types other than strings where passed to `String.is_empty()`, which caused an exception.
@@ -90,7 +129,9 @@
90129

91130
<span id="v1-8-4" />
92131

93-
## 11.11.2025 `v1.8.4` 𝓢𝓲𝓷𝓰𝓵𝓮𝓼 𝓓𝓪𝔂 🥇😉
132+
## 11.11.2025 `v1.8.4`
133+
134+
**𝓢𝓲𝓷𝓰𝓵𝓮𝓼 𝓓𝓪𝔂 🥇😉**
94135

95136
* Adjusted `Regex.hsla_str()` to not include optional degree (`°`) and percent (`%`) symbols in the captured groups.
96137
* Fixed that `Regex.hexa_str()` couldn't match HEXA colors anywhere inside a string, but only if the whole string was just the HEXA color.
@@ -158,7 +199,7 @@
158199

159200
<span id="v1-8-0" />
160201

161-
## 28.08.2025 `v1.8.0`**️This release is broken!**
202+
## 28.08.2025 `v1.8.0`**️ This release is broken!**
162203

163204
* New options for the param `find_args` from the method `Console.get_args()`:<br>
164205
Previously you could only input a dictionary with items like `"alias_name": ["-f", "--flag"]` that specify an arg's alias and the flags that correspond to it.<br>
@@ -194,7 +235,7 @@
194235
## 17.06.2025 `v1.7.2`
195236

196237
* The `Console.w`, `Console.h` and `Console.wh` class properties now return a default size if there is no console, instead of throwing an error.
197-
* It wasn't actually possible to use default console-colors (*e.g.* `"red"`, `"green"`, ...) for the color params in `Console.log()` so that option was completely removed again.
238+
* It wasn't actually possible to use default console-colors (*e.g.* `"red"`, `"green"`, ) for the color params in `Console.log()` so that option was completely removed again.
198239
* Upgraded the speed of `FormatCodes.to_ansi()` by adding the internal ability to skip the `default_color` validation.
199240
* Fixed type hints for the whole library.
200241
* Fixed a small bug in `Console.pause_exit()`, where the key, pressed to unpause wasn't suppressed, so it was written into the next console input after unpausing.
@@ -208,7 +249,7 @@
208249
* Added a new method `Console.log_box_bordered()`, which does the same as `Console.log_box_filled()`, but with a border instead of a background color.
209250
* The module `xx_format_codes` now treats the `[*]` to-default-color-reset as a normal full-reset, when no `default_color` is set, instead of just counting it as an invalid format code.
210251
* Fixed bug where entering a color as HEX integer in the color params of the methods `Console.log()`, `Console.log_box_filled()` and `Console.log_box_bordered()` would not work, because it was not properly converted to a format code.
211-
* You can now use default console colors (*e.g.* `"red"`, `"green"`, ...) for the color params in `Console.log()`.
252+
* You can now use default console colors (*e.g.* `"red"`, `"green"`, ) for the color params in `Console.log()`.
212253
* The methods `Console.log_box_filled()` and `Console.log_box_bordered()` no longer right-strip spaces, so you can make multiple log boxes the same width, by adding spaces to the end of the text.
213254

214255
**BREAKING CHANGES:**
@@ -332,7 +373,7 @@
332373

333374
<span id="v1-6-3" />
334375

335-
## 22.01.2025 `v1.6.3`**️This release is broken!**
376+
## 22.01.2025 `v1.6.3`**️ This release is broken!**
336377

337378
* Fixed a small bug in `xx_format_codes`:<br>
338379
Inside print-strings, if there was a `'` or `"` inside an auto-reset-formatting (*e.g.* `[u](there's a quote)`), that caused it to not be recognized as valid, and therefore not be automatically reset.<br>
@@ -440,6 +481,8 @@
440481

441482
## 11.11.2024 `v1.5.6`
442483

484+
**Again 𝓢𝓲𝓷𝓰𝓵𝓮𝓼 𝓓𝓪𝔂 🥇😉**
485+
443486
* Moved the whole library to its own repository: **[PythonLibraryXulbuX](https://github.com/XulbuX/PythonLibraryXulbuX)**
444487
* Updated all connections and links correspondingly.
445488

@@ -448,6 +491,8 @@
448491

449492
## 11.11.2024 `v1.5.5`
450493

494+
**𝓢𝓲𝓷𝓰𝓵𝓮𝓼 𝓓𝓪𝔂 🥇😉**
495+
451496
* Added methods to get the width and height of the console (*in characters and lines*):<br>
452497
- <code>Cmd.w() -> *int*</code> how many text characters the console is wide<br>
453498
- <code>Cmd.h() -> *int*</code> how many lines the console is high<br>
@@ -774,7 +819,7 @@ from XulbuX import rgb, hsl, hexa
774819
<thead>
775820
<tr>
776821
<th>Features</th>
777-
<th>class, type, function, ...</th>
822+
<th>class, type, function, </th>
778823
</tr>
779824
</thead>
780825
<tbody>

pyproject.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = [
3+
"setuptools>=80.0.0",
4+
"wheel>=0.45.0",
5+
"mypy>=1.19.0",
6+
"mypy-extensions>=1.1.0",
7+
# TYPES FOR MyPy
8+
"types-regex",
9+
"types-keyboard",
10+
"prompt_toolkit>=3.0.41",
11+
]
312
build-backend = "setuptools.build_meta"
413

514
[project]
615
name = "xulbux"
7-
version = "1.9.2"
16+
version = "1.9.3"
817
authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
918
maintainers = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
1019
description = "A Python library to simplify common programming tasks."
1120
readme = "README.md"
1221
license = "MIT"
13-
license-files = ["LICEN[CS]E.*"]
22+
license-files = ["LICENSE"]
1423
requires-python = ">=3.10.0"
1524
dependencies = [
1625
"keyboard>=0.13.5",
26+
"mypy-extensions>=1.1.0",
1727
"prompt_toolkit>=3.0.41",
1828
"regex>=2023.10.3",
1929
]
@@ -139,7 +149,7 @@ ensure_newline_before_comments = true
139149
max-complexity = 12
140150
max-line-length = 127
141151
select = ["E", "F", "W", "C90"]
142-
extend-ignore = ["E203", "E266", "W503"]
152+
extend-ignore = ["E203", "E266", "E502", "W503"]
143153
per-file-ignores = ["__init__.py:F403,F405"]
144154

145155
[tool.setuptools]

setup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from mypyc.build import mypycify
2+
from setuptools import setup
3+
import os
4+
5+
6+
def find_python_files(directory: str) -> list[str]:
7+
python_files: list[str] = []
8+
for root, _, files in os.walk(directory):
9+
for file in files:
10+
if file.endswith(".py"):
11+
python_files.append(os.path.join(root, file))
12+
return python_files
13+
14+
15+
source_files = find_python_files("src/xulbux")
16+
17+
setup(
18+
name="xulbux",
19+
ext_modules=mypycify(source_files),
20+
)

src/xulbux/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.9.2"
1+
__version__ = "1.9.3"
22

33
__author__ = "XulbuX"
44
__email__ = "xulbux.real@gmail.com"

0 commit comments

Comments
 (0)