grind-t-toolkit 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.3
2
+ Name: grind-t-toolkit
3
+ Version: 0.1.0
4
+ Summary: Natural problem solver's toolkit
5
+ Author: grind-t
6
+ Author-email: grind-t <grindt.gd@gmail.com>
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+
10
+ # grind-t-toolkit
11
+
12
+ Natural problem solver's toolkit.
13
+ Python port of [`@grind-t/toolkit`](https://github.com/grind-t/toolkit).
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ uv add grind-t-toolkit
19
+ ```
20
+
21
+ ## Structure
22
+
23
+ Utilities are grouped into category subpackages, mirroring the subpath exports
24
+ of the TypeScript package:
25
+
26
+ ```python
27
+ from toolkit.array import ...
28
+ from toolkit.string import ...
29
+ ```
30
+
31
+ Tests live in `tests/<category>/test_<name>.py`. Tests that hit external
32
+ services are marked with `@pytest.mark.e2e`.
33
+
34
+ ## Development
35
+
36
+ | Task | Command |
37
+ | --- | --- |
38
+ | Format | `uv run ruff format` |
39
+ | Lint | `uv run ruff check --fix` |
40
+ | Type check | `uv run ty check` |
41
+ | Unit tests | `uv run pytest -m "not e2e"` |
42
+ | E2E tests | `uv run pytest -m e2e` |
43
+ | All tests | `uv run pytest` |
44
+ | Build | `uv build` |
@@ -0,0 +1,7 @@
1
+ toolkit/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtGZhfo,24
2
+ toolkit/boolean/__init__.py,sha256=swfBG2Ka2U9DswRtGxl3rXxUQLL-PZ7ad4YRkKW4gw8,49
3
+ toolkit/boolean/ensure.py,sha256=m_6_GZPRvf702uVQHnY1t70xqf7COaKG5tPBWrcdUtY,448
4
+ toolkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ grind_t_toolkit-0.1.0.dist-info/WHEEL,sha256=y6e-a5KI2W-qDAJKfh9Xr81bin8NgUdfWgz3VSXXpe4,80
6
+ grind_t_toolkit-0.1.0.dist-info/METADATA,sha256=nsY_cbEbOFHRQ_la9jliRW11lcz7uktmsCQqLC_eiCU,1015
7
+ grind_t_toolkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.12.9
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
toolkit/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __all__: list[str] = []
@@ -0,0 +1,3 @@
1
+ from .ensure import ensure
2
+
3
+ __all__ = ["ensure"]
@@ -0,0 +1,15 @@
1
+ from typing import TypeVar
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ def ensure(value: T | None, message: str = "Expected value to be truthy") -> T:
7
+ """Return ``value`` if it is truthy, otherwise raise ``ValueError``.
8
+
9
+ Unlike ``assert``, the check is not stripped when Python runs with ``-O``.
10
+ The return type drops ``None``, so the result can be used without extra
11
+ narrowing.
12
+ """
13
+ if not value:
14
+ raise ValueError(message)
15
+ return value
toolkit/py.typed ADDED
File without changes