Skip to content

Commit 0ae4433

Browse files
authored
Merge release v1.9.5 into main
Merge version 1.9.5 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-5
2 parents a34da8c + 0536f7b commit 0ae4433

8 files changed

Lines changed: 629 additions & 660 deletions

File tree

CHANGELOG.md

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

1717

18+
<span id="v1-9-5" />
19+
20+
## 25.01.2026 `v1.9.5`
21+
22+
* Add new class property `Console.encoding`, which returns the encoding used by the console (*e.g.* `utf-8`*,* `cp1252`*, …*).
23+
* Add multiple new class properties to the `System` class:
24+
- `is_linux` Whether the current OS is Linux or not.
25+
- `is_mac` Whether the current OS is macOS or not.
26+
- `is_unix` Whether the current OS is a Unix-like OS (Linux, macOS, BSD, …) or not.
27+
- `hostname` The network hostname of the current machine.
28+
- `username` The current user's username.
29+
- `os_name` The name of the operating system (*e.g.* `Windows`*,* `Linux`*, …*).
30+
- `os_version` The version of the operating system.
31+
- `architecture` The CPU architecture (*e.g.* `x86_64`*,* `ARM`*, …*).
32+
- `cpu_count` The number of CPU cores available.
33+
- `python_version` The Python version string (*e.g.* `3.10.4`).
34+
* Created a two new TypeAliases:
35+
- `ArgParseConfig` Matches the command-line-parsing configuration of a single argument.
36+
- `ArgParseConfigs` Matches the command-line-parsing configurations of multiple arguments, packed in a dictionary.
37+
* Added a new attribute `flag` to the `ArgData` TypedDict and the `ArgResult` class, which contains the specific flag that was found or `None` for positional args.
38+
39+
**BREAKING CHANGES:**
40+
* Rewrote `Console.get_args()` for a different parsing functionality:
41+
- Flagged values are now too saved to lists, so now only the `values` attribute is used for all argument types.
42+
- The results of parsed command-line arguments are also no longer differentiated between regular flagged arguments and positional `"before"`/`"after"` arguments.
43+
- The param `allow_spaces` was removed, and therefore a new param `flag_value_sep` was added, which specifies the character/s used to separate flags from their values.<br>
44+
This means, flags can new **only** receive values when the separator is present (*e.g.* `--flag=value` *or* `--flag = value`).
45+
* Combined the custom TypedDict classes `ArgResultRegular` and `ArgResultPositional` into a single TypedDict class `ArgData`, which is now used for all parsed command-line arguments.
46+
* Renamed the classes `Args` and `ArgResult` to `ParsedArgs` and `ParsedArgData`, to better describe their purpose.
47+
* Renamed the attribute `is_positional` to `is_pos` everywhere, so its name isn't that long.
48+
49+
1850
<span id="v1-9-4" />
1951

2052
## 06.01.2026 `v1.9.4`

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "setuptools.build_meta"
1414

1515
[project]
1616
name = "xulbux"
17-
version = "1.9.4"
17+
version = "1.9.5"
1818
description = "A Python library to simplify common programming tasks."
1919
readme = "README.md"
2020
authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]

src/xulbux/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__package_name__ = "xulbux"
2-
__version__ = "1.9.4"
2+
__version__ = "1.9.5"
33
__description__ = "A Python library to simplify common programming tasks."
44
__status__ = "Production/Stable"
55

src/xulbux/base/types.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This module contains all custom type definitions used throughout the library.
33
"""
44

5-
from typing import TYPE_CHECKING, Annotated, TypeAlias, TypedDict, Optional, Protocol, Union, Any
5+
from typing import TYPE_CHECKING, Annotated, TypeAlias, TypedDict, Optional, Protocol, Literal, Union, Any
66
from pathlib import Path
77

88
# PREVENT CIRCULAR IMPORTS
@@ -70,6 +70,11 @@
7070
AnyHexa: TypeAlias = Any
7171
"""Generic type alias for hexadecimal color values in any supported format (type checking disabled)."""
7272

73+
ArgParseConfig: TypeAlias = Union[set[str], "ArgConfigWithDefault", Literal["before", "after"]]
74+
"""Matches the command-line-parsing configuration of a single argument."""
75+
ArgParseConfigs: TypeAlias = dict[str, ArgParseConfig]
76+
"""Matches the command-line-parsing configurations of multiple arguments, packed in a dictionary."""
77+
7378
#
7479
################################################## Sentinel ##################################################
7580

@@ -83,21 +88,17 @@ class AllTextChars:
8388

8489

8590
class ArgConfigWithDefault(TypedDict):
86-
"""Configuration schema for a flagged CLI argument that has a specified default value."""
91+
"""Configuration schema for a flagged command-line argument that has a specified default value."""
8792
flags: set[str]
8893
default: str
8994

9095

91-
class ArgResultRegular(TypedDict):
92-
"""Result schema for a parsed regular flagged CLI argument."""
93-
exists: bool
94-
value: Optional[str]
95-
96-
97-
class ArgResultPositional(TypedDict):
98-
"""Result schema for parsed positional (`"before"`/`"after"`) CLI arguments."""
96+
class ArgData(TypedDict):
97+
"""Schema for the resulting data of parsing a single command-line argument."""
9998
exists: bool
99+
is_pos: bool
100100
values: list[str]
101+
flag: Optional[str]
101102

102103

103104
class MissingLibsMsgs(TypedDict):

0 commit comments

Comments
 (0)