pythonwrench 0.6.8__tar.gz → 0.6.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/.github/workflows/test.yaml +3 -3
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/.pre-commit-config.yaml +1 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/CHANGELOG.md +19 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/CITATION.cff +2 -2
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/PKG-INFO +8 -5
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/README.md +1 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.serialization.rst +8 -0
- pythonwrench-0.6.9/docs/pythonwrench.serialization.yaml.definitions.rst +7 -0
- pythonwrench-0.6.9/docs/pythonwrench.serialization.yaml.func.rst +7 -0
- pythonwrench-0.6.9/docs/pythonwrench.serialization.yaml.rst +16 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/pyproject.toml +22 -7
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/setup.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/__init__.py +15 -4
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/__main__.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/_core.py +7 -13
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/abc.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/argparse/__init__.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/argparse/dataclass_.py +93 -41
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/argparse/parsers.py +24 -40
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/cast.py +1 -15
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/checksum.py +0 -4
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/collections/__init__.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/collections/collections.py +7 -39
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/collections/prop.py +0 -3
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/collections/reducers.py +0 -24
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/concurrent.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/csv.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/dataclasses.py +70 -4
- pythonwrench-0.6.9/src/pythonwrench/datetime.py +19 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/difflib.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/disk_cache.py +1 -23
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/entrypoints/info.py +2 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/entrypoints/safe_rmdir.py +45 -57
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/entrypoints/tree.py +26 -45
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/enum.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/functools.py +0 -9
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/hashlib.py +40 -10
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/importlib.py +14 -8
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/inspect.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/json.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/jsonl.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/logging.py +2 -3
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/math.py +0 -2
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/os.py +8 -7
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/pickle.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/random.py +0 -3
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/re.py +5 -2
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/semver.py +29 -13
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/serialization/__init__.py +17 -2
- pythonwrench-0.6.9/src/pythonwrench/serialization/_core.py +412 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/serialization/csv.py +188 -207
- pythonwrench-0.6.9/src/pythonwrench/serialization/json.py +249 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/serialization/jsonl.py +109 -97
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/serialization/pickle.py +96 -96
- pythonwrench-0.6.9/src/pythonwrench/serialization/yaml/__init__.py +48 -0
- pythonwrench-0.6.9/src/pythonwrench/serialization/yaml/_yaml_fallback.py +63 -0
- pythonwrench-0.6.9/src/pythonwrench/serialization/yaml/definitions.py +81 -0
- pythonwrench-0.6.9/src/pythonwrench/serialization/yaml/func.py +318 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/time.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/typing/__init__.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/typing/checks.py +27 -7
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/typing/classes.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/src/pythonwrench/warnings.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_abc.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_argparse.py +51 -32
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_cast.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_checksum.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_collections.py +7 -8
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_core.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_dataclasses.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_difflib.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_disk_cache.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_entrypoints.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_enum.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_functools.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_hashlib.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_importlib.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_inspect.py +1 -2
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_logging.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_math.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_os.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_random.py +0 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_readme.py +2 -1
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_semver.py +0 -1
- pythonwrench-0.6.9/tests/test_serialization.py +126 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/tests/test_typing.py +17 -3
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/uv.lock +2376 -2422
- pythonwrench-0.6.8/src/pythonwrench/datetime.py +0 -17
- pythonwrench-0.6.8/src/pythonwrench/serialization/_core.py +0 -73
- pythonwrench-0.6.8/src/pythonwrench/serialization/json.py +0 -216
- pythonwrench-0.6.8/tests/test_csv.py +0 -38
- pythonwrench-0.6.8/tests/test_json.py +0 -24
- pythonwrench-0.6.8/tests/test_jsonl.py +0 -18
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/.gitignore +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/.readthedocs.yaml +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/LICENSE +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/Makefile +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/conf.py +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/index.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/make.bat +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/modules.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.abc.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.argparse.dataclass_.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.argparse.parsers.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.argparse.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.cast.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.checksum.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.collections.collections.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.collections.prop.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.collections.reducers.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.collections.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.concurrent.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.csv.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.dataclasses.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.datetime.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.difflib.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.disk_cache.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.enum.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.functools.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.hashlib.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.importlib.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.inspect.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.json.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.jsonl.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.logging.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.math.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.os.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.pickle.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.random.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.re.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.semver.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.serialization.csv.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.serialization.json.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.serialization.jsonl.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.serialization.pickle.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.time.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.typing.checks.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.typing.classes.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.typing.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/pythonwrench.warnings.rst +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/docs/update.bash +0 -0
- {pythonwrench-0.6.8 → pythonwrench-0.6.9}/pythonwrench.code-workspace +0 -0
|
@@ -25,16 +25,16 @@ jobs:
|
|
|
25
25
|
strategy:
|
|
26
26
|
matrix:
|
|
27
27
|
os: [ubuntu-24.04]
|
|
28
|
-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
28
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
|
|
29
29
|
include:
|
|
30
30
|
- os: windows-2022
|
|
31
31
|
python-version: "3.8"
|
|
32
32
|
- os: windows-latest
|
|
33
|
-
python-version: "3.
|
|
33
|
+
python-version: "3.15"
|
|
34
34
|
- os: macos-15
|
|
35
35
|
python-version: "3.8"
|
|
36
36
|
- os: macos-latest
|
|
37
|
-
python-version: "3.
|
|
37
|
+
python-version: "3.15"
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
40
|
# --- INSTALLATIONS ---
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.9] 2026-11-21
|
|
6
|
+
### Added
|
|
7
|
+
- Support Python 3.15.
|
|
8
|
+
- `hash_str`, `hash_bytes` and `hash_bytes_buffer` functions.
|
|
9
|
+
- Function `parse_args_using_dataclass` now supports metadata doc options.
|
|
10
|
+
- `key` arg in `filter_iter_with_patterns`.
|
|
11
|
+
- Serialisation function for YAML files.
|
|
12
|
+
- `on_exists` option for serialization fns.
|
|
13
|
+
- `module_fallback` option to `import_if_available` fn.
|
|
14
|
+
- support for TypeAliasType in `isinstance_generic`.
|
|
15
|
+
|
|
16
|
+
### Modified
|
|
17
|
+
- Update code format with ruff 0.16.10.
|
|
18
|
+
- Add check for `field.kw_only` with positional argument.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- Option value `posonly_for_required=True` in `parse_args_using_dataclass`.
|
|
22
|
+
|
|
23
|
+
|
|
5
24
|
## [0.6.8] 2026-10-26
|
|
6
25
|
### Added
|
|
7
26
|
- `remove_children` function to remove all content of a directory.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pythonwrench
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.9
|
|
4
4
|
Summary: Python library with tools for typing, manipulating collections, and more!
|
|
5
5
|
Project-URL: Homepage, https://pypi.org/project/pythonwrench/
|
|
6
6
|
Project-URL: Documentation, https://pythonwrench.readthedocs.io/
|
|
@@ -46,8 +46,9 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
46
46
|
Classifier: Programming Language :: Python :: 3.12
|
|
47
47
|
Classifier: Programming Language :: Python :: 3.13
|
|
48
48
|
Classifier: Programming Language :: Python :: 3.14
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
49
50
|
Classifier: Topic :: Scientific/Engineering
|
|
50
|
-
Requires-Python: <3.
|
|
51
|
+
Requires-Python: <3.16,>=3.8
|
|
51
52
|
Requires-Dist: typing-extensions>=4.10.0
|
|
52
53
|
Provides-Extra: dev
|
|
53
54
|
Requires-Dist: coverage[toml]>=7.6.1; extra == 'dev'
|
|
@@ -56,7 +57,7 @@ Requires-Dist: ipython>=8.12.3; extra == 'dev'
|
|
|
56
57
|
Requires-Dist: pandas>=2.0.3; extra == 'dev'
|
|
57
58
|
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
|
|
58
59
|
Requires-Dist: pytest>=8.3.5; extra == 'dev'
|
|
59
|
-
Requires-Dist: ruff
|
|
60
|
+
Requires-Dist: ruff==0.16.10; extra == 'dev'
|
|
60
61
|
Requires-Dist: sphinx-immaterial>=0.11.14; extra == 'dev'
|
|
61
62
|
Requires-Dist: sphinx<9.0.0,>=7.1.2; extra == 'dev'
|
|
62
63
|
Requires-Dist: twine>=6.1.0; extra == 'dev'
|
|
@@ -68,7 +69,9 @@ Requires-Dist: lazy-loader<1,>=0.4; extra == 'lazy'
|
|
|
68
69
|
Provides-Extra: tests
|
|
69
70
|
Requires-Dist: coverage[toml]>=7.6.1; extra == 'tests'
|
|
70
71
|
Requires-Dist: pytest>=8.3.5; extra == 'tests'
|
|
71
|
-
Requires-Dist: ruff
|
|
72
|
+
Requires-Dist: ruff==0.16.10; extra == 'tests'
|
|
73
|
+
Provides-Extra: yaml
|
|
74
|
+
Requires-Dist: pyyaml>=6.0.3; extra == 'yaml'
|
|
72
75
|
Description-Content-Type: text/markdown
|
|
73
76
|
|
|
74
77
|
# pythonwrench
|
|
@@ -102,7 +105,7 @@ With pip:
|
|
|
102
105
|
pip install pythonwrench
|
|
103
106
|
```
|
|
104
107
|
|
|
105
|
-
This library has been tested on all Python versions **3.8 - 3.
|
|
108
|
+
This library has been tested on all Python versions **3.8 - 3.15**, requires only `typing_extensions>=4.10.0`, and runs on **Linux, Mac and Windows** systems.
|
|
106
109
|
|
|
107
110
|
## Examples
|
|
108
111
|
|
|
@@ -29,7 +29,7 @@ With pip:
|
|
|
29
29
|
pip install pythonwrench
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
This library has been tested on all Python versions **3.8 - 3.
|
|
32
|
+
This library has been tested on all Python versions **3.8 - 3.15**, requires only `typing_extensions>=4.10.0`, and runs on **Linux, Mac and Windows** systems.
|
|
33
33
|
|
|
34
34
|
## Examples
|
|
35
35
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pythonwrench.serialization.yaml package
|
|
2
|
+
=======================================
|
|
3
|
+
|
|
4
|
+
.. automodule:: pythonwrench.serialization.yaml
|
|
5
|
+
:members:
|
|
6
|
+
:undoc-members:
|
|
7
|
+
:show-inheritance:
|
|
8
|
+
|
|
9
|
+
Submodules
|
|
10
|
+
----------
|
|
11
|
+
|
|
12
|
+
.. toctree::
|
|
13
|
+
:maxdepth: 4
|
|
14
|
+
|
|
15
|
+
pythonwrench.serialization.yaml.definitions
|
|
16
|
+
pythonwrench.serialization.yaml.func
|
|
@@ -5,7 +5,7 @@ authors = [
|
|
|
5
5
|
]
|
|
6
6
|
description = "Python library with tools for typing, manipulating collections, and more!"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
requires-python = ">=3.8,<3.
|
|
8
|
+
requires-python = ">=3.8,<3.16"
|
|
9
9
|
keywords = ["python", "tools", "utilities"]
|
|
10
10
|
license = {file = "LICENSE"}
|
|
11
11
|
# license-files = ["LICENSE"] # unsupported by python 3.8, but will be required in 2026
|
|
@@ -20,6 +20,7 @@ classifiers = [
|
|
|
20
20
|
"Programming Language :: Python :: 3.12",
|
|
21
21
|
"Programming Language :: Python :: 3.13",
|
|
22
22
|
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Programming Language :: Python :: 3.15",
|
|
23
24
|
"Topic :: Scientific/Engineering",
|
|
24
25
|
"Operating System :: OS Independent",
|
|
25
26
|
"Operating System :: MacOS :: MacOS X",
|
|
@@ -67,13 +68,16 @@ docs = [
|
|
|
67
68
|
"sphinx-immaterial>=0.11.14",
|
|
68
69
|
]
|
|
69
70
|
tests = [
|
|
70
|
-
"ruff
|
|
71
|
+
"ruff==0.16.10",
|
|
71
72
|
"coverage[toml]>=7.6.1",
|
|
72
73
|
"pytest>=8.3.5",
|
|
73
74
|
]
|
|
74
75
|
lazy = [
|
|
75
76
|
"lazy-loader>=0.4,<1",
|
|
76
77
|
]
|
|
78
|
+
yaml = [
|
|
79
|
+
"pyyaml>=6.0.3",
|
|
80
|
+
]
|
|
77
81
|
|
|
78
82
|
[tool.pyright]
|
|
79
83
|
include = ["src"]
|
|
@@ -86,11 +90,6 @@ testpaths = ["tests"]
|
|
|
86
90
|
[tool.coverage.run]
|
|
87
91
|
source = ["src"]
|
|
88
92
|
|
|
89
|
-
[tool.ruff.lint.extend-per-file-ignores]
|
|
90
|
-
# F401: module imported but unused
|
|
91
|
-
# F403: ‘from module import *’ used; unable to detect undefined names
|
|
92
|
-
"__init__.py" = ["F401", "F403"]
|
|
93
|
-
|
|
94
93
|
[tool.uv.sources]
|
|
95
94
|
pythonwrench = { workspace = true }
|
|
96
95
|
|
|
@@ -109,3 +108,19 @@ packages = ["src/pythonwrench"]
|
|
|
109
108
|
|
|
110
109
|
[tool.hatch.version]
|
|
111
110
|
path = "src/pythonwrench/__init__.py"
|
|
111
|
+
|
|
112
|
+
[tool.ruff]
|
|
113
|
+
# In addition to the standard set of exclusions, omit all tests, plus a specific file.
|
|
114
|
+
extend-exclude = ["notebooks/**.ipynb"]
|
|
115
|
+
|
|
116
|
+
[tool.ruff.lint.per-file-ignores]
|
|
117
|
+
# F401 : unused imports
|
|
118
|
+
# E402 : module import not at top of file
|
|
119
|
+
# UP009 : remove unnecessary utf-8 coding
|
|
120
|
+
# EXE001 : specify sheshang but file is not executable
|
|
121
|
+
# PYI061 : replace Literal[None, ...] by Literal[...] | None
|
|
122
|
+
# FA100 : Add `from __future__ import annotations` to simplify `typing.Dict`
|
|
123
|
+
# PLC0105: `TypeVar` name "T_BuiltinScalar" does not reflect its covariance; consider renaming it to "T_BuiltinScalar_co"
|
|
124
|
+
"__init__.py" = ["F401"]
|
|
125
|
+
"notebooks/**.ipynb" = ["E402"]
|
|
126
|
+
"*.py" = ["UP009", "EXE001", "PYI061", "FA100", "PLC0105"]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
|
|
4
3
|
"""Python library with tools for typing, manipulating collections, and more!"""
|
|
5
4
|
|
|
@@ -9,7 +8,7 @@ __author_email__ = "labbeti.pub@gmail.com"
|
|
|
9
8
|
__license__ = "MIT"
|
|
10
9
|
__maintainer__ = "Étienne Labbé (Labbeti)"
|
|
11
10
|
__status__ = "Development"
|
|
12
|
-
__version__ = "0.6.
|
|
11
|
+
__version__ = "0.6.9"
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
from typing import TYPE_CHECKING
|
|
@@ -127,7 +126,7 @@ if TYPE_CHECKING or lazy is None:
|
|
|
127
126
|
identity,
|
|
128
127
|
repeat_fn,
|
|
129
128
|
)
|
|
130
|
-
from .hashlib import hash_file
|
|
129
|
+
from .hashlib import hash_bytes, hash_bytes_buffer, hash_file, hash_str
|
|
131
130
|
from .importlib import (
|
|
132
131
|
ModulePlaceholder,
|
|
133
132
|
Placeholder,
|
|
@@ -177,26 +176,32 @@ if TYPE_CHECKING or lazy is None:
|
|
|
177
176
|
dump_json,
|
|
178
177
|
dump_jsonl,
|
|
179
178
|
dump_pickle,
|
|
179
|
+
dump_yaml,
|
|
180
180
|
dumps_csv,
|
|
181
181
|
dumps_json,
|
|
182
182
|
dumps_jsonl,
|
|
183
183
|
dumps_pickle,
|
|
184
|
+
dumps_yaml,
|
|
184
185
|
load_csv,
|
|
185
186
|
load_json,
|
|
186
187
|
load_jsonl,
|
|
187
188
|
load_pickle,
|
|
189
|
+
load_yaml,
|
|
188
190
|
loads_csv,
|
|
189
191
|
loads_json,
|
|
190
192
|
loads_jsonl,
|
|
191
193
|
loads_pickle,
|
|
194
|
+
loads_yaml,
|
|
192
195
|
read_csv,
|
|
193
196
|
read_json,
|
|
194
197
|
read_jsonl,
|
|
195
198
|
read_pickle,
|
|
199
|
+
read_yaml,
|
|
196
200
|
save_csv,
|
|
197
201
|
save_json,
|
|
198
202
|
save_jsonl,
|
|
199
203
|
save_pickle,
|
|
204
|
+
save_yaml,
|
|
200
205
|
)
|
|
201
206
|
from .time import Ticker
|
|
202
207
|
from .typing import (
|
|
@@ -373,6 +378,12 @@ else:
|
|
|
373
378
|
"save_json",
|
|
374
379
|
"save_jsonl",
|
|
375
380
|
"save_pickle",
|
|
381
|
+
"dump_yaml",
|
|
382
|
+
"dumps_yaml",
|
|
383
|
+
"load_yaml",
|
|
384
|
+
"loads_yaml",
|
|
385
|
+
"read_yaml",
|
|
386
|
+
"save_yaml",
|
|
376
387
|
],
|
|
377
388
|
"dataclasses": ["add_dict_methods", "dataclassdict", "get_defaults_values"],
|
|
378
389
|
"datetime": ["get_now", "get_now_iso8601"],
|
|
@@ -387,7 +398,7 @@ else:
|
|
|
387
398
|
"identity",
|
|
388
399
|
"repeat_fn",
|
|
389
400
|
],
|
|
390
|
-
"hashlib": ["hash_file"],
|
|
401
|
+
"hashlib": ["hash_file", "hash_bytes", "hash_bytes_buffer", "hash_str"],
|
|
391
402
|
"importlib": [
|
|
392
403
|
"import_if_available",
|
|
393
404
|
"ModulePlaceholder",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
|
|
4
3
|
import warnings
|
|
5
4
|
from functools import lru_cache, partial, wraps
|
|
@@ -42,7 +41,7 @@ class Predicate(Protocol[T_PredicateArg]):
|
|
|
42
41
|
|
|
43
42
|
def return_none(*args, **kwargs) -> None:
|
|
44
43
|
"""Return None function placeholder."""
|
|
45
|
-
return
|
|
44
|
+
return
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
def function_alias(
|
|
@@ -162,18 +161,17 @@ class _FunctionRegistry(Generic[T_Output]):
|
|
|
162
161
|
unk_mode: UnkMode = "error",
|
|
163
162
|
**kwargs,
|
|
164
163
|
) -> T_Output:
|
|
165
|
-
|
|
164
|
+
def wrapped_isinstance(x: Any, target_cls_or_tuple: Any) -> bool:
|
|
165
|
+
return isinstance_fn(x, target_cls_or_tuple)
|
|
166
|
+
|
|
166
167
|
for fn, (class_or_tuple, custom_predicate, _) in self.fns.items():
|
|
167
168
|
if custom_predicate is not None:
|
|
168
169
|
predicate = custom_predicate
|
|
169
170
|
|
|
170
171
|
elif class_or_tuple is not None:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return isinstance_fn(x, class_or_tuple) # type: ignore
|
|
175
|
-
|
|
176
|
-
predicate = target_isinstance_fn_wrap
|
|
172
|
+
predicate = partial(
|
|
173
|
+
wrapped_isinstance, target_cls_or_tuple=class_or_tuple
|
|
174
|
+
)
|
|
177
175
|
else:
|
|
178
176
|
msg = f"Invalid function registered. (found {class_or_tuple=} and {custom_predicate=})"
|
|
179
177
|
raise TypeError(msg)
|
|
@@ -229,7 +227,6 @@ def warn_once(
|
|
|
229
227
|
source: Any = None,
|
|
230
228
|
) -> None:
|
|
231
229
|
"""Warn message once using warnings module."""
|
|
232
|
-
...
|
|
233
230
|
|
|
234
231
|
|
|
235
232
|
@overload
|
|
@@ -240,7 +237,6 @@ def warn_once(
|
|
|
240
237
|
source: Any = None,
|
|
241
238
|
) -> None:
|
|
242
239
|
"""Warn message once using warnings module."""
|
|
243
|
-
...
|
|
244
240
|
|
|
245
241
|
|
|
246
242
|
@lru_cache(maxsize=None)
|
|
@@ -285,7 +281,6 @@ def deprecated_function(
|
|
|
285
281
|
warn_fn: Callable[[str], Any] = partial(warn_once, category=DeprecationWarning),
|
|
286
282
|
) -> Callable[[T_Function], T_Function]:
|
|
287
283
|
"""Perform the deprecated function operation."""
|
|
288
|
-
...
|
|
289
284
|
|
|
290
285
|
|
|
291
286
|
@overload
|
|
@@ -297,7 +292,6 @@ def deprecated_function(
|
|
|
297
292
|
warn_fn: Callable[[str], Any] = partial(warn_once, category=DeprecationWarning),
|
|
298
293
|
) -> T_Function:
|
|
299
294
|
"""Perform the deprecated function operation."""
|
|
300
|
-
...
|
|
301
295
|
|
|
302
296
|
|
|
303
297
|
def deprecated_function(
|