pyutilkit 0.2.0__tar.gz → 0.3.0__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.
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/PKG-INFO +7 -4
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/docs/README.md +5 -1
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/pyproject.toml +4 -4
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/date_utils.py +0 -1
- pyutilkit-0.3.0/src/pyutilkit/py.typed +0 -0
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/timing.py +30 -0
- pyutilkit-0.2.0/src/pyutilkit/__init__.py +0 -1
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/LICENSE.md +0 -0
- {pyutilkit-0.2.0/src/pyutilkit/data → pyutilkit-0.3.0/src/pyutilkit}/__init__.py +0 -0
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/classes.py +0 -0
- /pyutilkit-0.2.0/src/pyutilkit/py.typed → /pyutilkit-0.3.0/src/pyutilkit/data/__init__.py +0 -0
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/data/timezones.py +0 -0
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/files.py +0 -0
- {pyutilkit-0.2.0 → pyutilkit-0.3.0}/src/pyutilkit/term.py +0 -0
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyutilkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: python's missing batteries
|
|
5
5
|
Home-page: https://pyutilkit.readthedocs.io/en/stable/
|
|
6
6
|
License: LGPL-3.0+
|
|
7
7
|
Keywords: utils
|
|
8
8
|
Author: Stephanos Kuma
|
|
9
9
|
Author-email: stephanos@kuma.ai
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.9,<4.0
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -31,7 +30,11 @@ Description-Content-Type: text/markdown
|
|
|
31
30
|
[![build automation: yam][yam_badge]][yam_url]
|
|
32
31
|
[![Lint: ruff][ruff_badge]][ruff_url]
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
The Python has long maintained the philosophy of "batteries included", giving the user
|
|
34
|
+
a rich standard library, avoiding the need for third party tools for most work. Some packages
|
|
35
|
+
are so common, that the have a similar status to the standard library. Still, some code seems
|
|
36
|
+
to be written time and again, with every project. This small library, with minimal requirements,
|
|
37
|
+
hopes to stop this repetition.
|
|
35
38
|
|
|
36
39
|
## Links
|
|
37
40
|
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
[![build automation: yam][yam_badge]][yam_url]
|
|
9
9
|
[![Lint: ruff][ruff_badge]][ruff_url]
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The Python has long maintained the philosophy of "batteries included", giving the user
|
|
12
|
+
a rich standard library, avoiding the need for third party tools for most work. Some packages
|
|
13
|
+
are so common, that the have a similar status to the standard library. Still, some code seems
|
|
14
|
+
to be written time and again, with every project. This small library, with minimal requirements,
|
|
15
|
+
hopes to stop this repetition.
|
|
12
16
|
|
|
13
17
|
## Links
|
|
14
18
|
|
|
@@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
6
6
|
|
|
7
7
|
[tool.black]
|
|
8
8
|
target-version = [
|
|
9
|
-
"
|
|
9
|
+
"py39",
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
[tool.mypy]
|
|
@@ -32,7 +32,7 @@ warn_unused_configs = true
|
|
|
32
32
|
src = [
|
|
33
33
|
"src",
|
|
34
34
|
]
|
|
35
|
-
target-version = "
|
|
35
|
+
target-version = "py39"
|
|
36
36
|
|
|
37
37
|
[tool.ruff.lint]
|
|
38
38
|
select = [
|
|
@@ -126,7 +126,7 @@ skip_empty = true
|
|
|
126
126
|
|
|
127
127
|
[tool.poetry]
|
|
128
128
|
name = "pyutilkit"
|
|
129
|
-
version = "0.
|
|
129
|
+
version = "0.3.0"
|
|
130
130
|
description = "python's missing batteries"
|
|
131
131
|
authors = [
|
|
132
132
|
"Stephanos Kuma <stephanos@kuma.ai>",
|
|
@@ -149,7 +149,7 @@ classifiers = [
|
|
|
149
149
|
|
|
150
150
|
[tool.poetry.dependencies]
|
|
151
151
|
# python version
|
|
152
|
-
python = "^3.
|
|
152
|
+
python = "^3.9"
|
|
153
153
|
|
|
154
154
|
[tool.poetry.group.dev.dependencies]
|
|
155
155
|
ipdb = { version = "^0.13", python = "^3.10" }
|
|
File without changes
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations # py3.9: remove this line
|
|
2
|
+
|
|
1
3
|
from dataclasses import dataclass
|
|
4
|
+
from time import perf_counter_ns
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from typing_extensions import Self # py3.10: import Self from typing
|
|
2
10
|
|
|
3
11
|
|
|
4
12
|
@dataclass(frozen=True, order=True)
|
|
@@ -36,3 +44,25 @@ class Timing:
|
|
|
36
44
|
return f"{milliseconds:.1f}ms"
|
|
37
45
|
seconds = milliseconds / 1000
|
|
38
46
|
return f"{seconds:,.2f}s"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Stopwatch:
|
|
50
|
+
_start: int
|
|
51
|
+
timing: Timing
|
|
52
|
+
|
|
53
|
+
def __init__(self) -> None:
|
|
54
|
+
self._start = 0
|
|
55
|
+
self.timing = Timing(nanoseconds=0)
|
|
56
|
+
|
|
57
|
+
def __enter__(self) -> Self:
|
|
58
|
+
self._start = perf_counter_ns()
|
|
59
|
+
return self
|
|
60
|
+
|
|
61
|
+
def __exit__(
|
|
62
|
+
self,
|
|
63
|
+
exc_type: type[Exception] | None,
|
|
64
|
+
exc_value: Exception | None,
|
|
65
|
+
traceback: TracebackType | None,
|
|
66
|
+
) -> None:
|
|
67
|
+
_end = perf_counter_ns()
|
|
68
|
+
self.timing = Timing(nanoseconds=_end - self._start)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|