timer-for-python 0.7.1__tar.gz → 0.7.3__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.
Files changed (44) hide show
  1. {timer-for-python-0.7.1/src/timer_for_python.egg-info → timer-for-python-0.7.3}/PKG-INFO +14 -8
  2. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/README.md +2 -2
  3. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/pyproject.toml +1 -1
  4. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/setup.cfg +11 -10
  5. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/timer.py +65 -1
  6. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/version.py +1 -1
  7. {timer-for-python-0.7.1 → timer-for-python-0.7.3/src/timer_for_python.egg-info}/PKG-INFO +14 -8
  8. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/SOURCES.txt +0 -10
  9. timer-for-python-0.7.3/src/timer_for_python.egg-info/requires.txt +10 -0
  10. timer-for-python-0.7.1/src/timer/.pytest_cache/.gitignore +0 -2
  11. timer-for-python-0.7.1/src/timer/.pytest_cache/CACHEDIR.TAG +0 -4
  12. timer-for-python-0.7.1/src/timer/.pytest_cache/README.md +0 -8
  13. timer-for-python-0.7.1/src/timer/.pytest_cache/v/cache/nodeids +0 -1
  14. timer-for-python-0.7.1/src/timer/.pytest_cache/v/cache/stepwise +0 -1
  15. timer-for-python-0.7.1/src/timer/model/.pytest_cache/.gitignore +0 -2
  16. timer-for-python-0.7.1/src/timer/model/.pytest_cache/CACHEDIR.TAG +0 -4
  17. timer-for-python-0.7.1/src/timer/model/.pytest_cache/README.md +0 -8
  18. timer-for-python-0.7.1/src/timer/model/.pytest_cache/v/cache/nodeids +0 -1
  19. timer-for-python-0.7.1/src/timer/model/.pytest_cache/v/cache/stepwise +0 -1
  20. timer-for-python-0.7.1/src/timer_for_python.egg-info/requires.txt +0 -10
  21. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/LICENSE.md +0 -0
  22. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/MANIFEST.in +0 -0
  23. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/__init__.py +0 -0
  24. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/__init__.py +0 -0
  25. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/decimals.py +0 -0
  26. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/various.py +0 -0
  27. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/controller/__init__.py +0 -0
  28. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/decorator/benchmark.py +0 -0
  29. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/error/__init__.py +0 -0
  30. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/__init__.py +0 -0
  31. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/decimals.py +0 -0
  32. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/output.py +0 -0
  33. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/thread/__init__.py +0 -0
  34. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/thread/list.py +0 -0
  35. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/time_fractions.py +0 -0
  36. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/__init__.py +0 -0
  37. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/elapsed_time_fractions.py +0 -0
  38. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/thread_item.py +0 -0
  39. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/time_fractions.py +0 -0
  40. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/timer_base.py +0 -0
  41. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/py.typed +0 -0
  42. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/dependency_links.txt +0 -0
  43. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/not-zip-safe +0 -0
  44. {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timer-for-python
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Timer for Python
5
5
  Home-page: https://jakob-bagterp.github.io/timer-for-python/
6
6
  Download-URL: https://pypi.org/project/timer-for-python/
@@ -15,19 +15,27 @@ Project-URL: API Reference, https://jakob-bagterp.github.io/timer-for-python/ref
15
15
  Project-URL: Source Code, https://github.com/jakob-bagterp/timer-for-python
16
16
  Project-URL: Release Notes, https://github.com/jakob-bagterp/timer-for-python/releases
17
17
  Keywords: python,timer
18
- Platform: UNKNOWN
19
18
  Classifier: Programming Language :: Python :: 3
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: License :: OSI Approved :: MIT License
23
23
  Classifier: Operating System :: OS Independent
24
24
  Requires-Python: >=3.10
25
25
  Description-Content-Type: text/markdown
26
- Provides-Extra: testing
27
26
  License-File: LICENSE.md
28
-
29
- [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.1&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
30
- ![Python 3.10 | 3.11 or higher](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%2B&color=blueviolet)
27
+ Requires-Dist: colorist==1.7.1
28
+ Provides-Extra: testing
29
+ Requires-Dist: coverage==7.4.4; extra == "testing"
30
+ Requires-Dist: flake8==7.0.0; extra == "testing"
31
+ Requires-Dist: mypy==1.9.0; extra == "testing"
32
+ Requires-Dist: numpy==1.26.4; extra == "testing"
33
+ Requires-Dist: pytest==8.1.1; extra == "testing"
34
+ Requires-Dist: pytest-cov==5.0.0; extra == "testing"
35
+ Requires-Dist: tox==4.14.2; extra == "testing"
36
+
37
+ [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.3&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
38
+ [![Python 3.10 | 3.11 | 3.12+](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%20|%203.12%2B&color=blueviolet)](https://www.python.org)
31
39
  [![MIT license](https://img.shields.io/static/v1?label=license&message=MIT&color=blue)](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
32
40
  [![Codecov](https://codecov.io/gh/jakob-bagterp/timer-for-python/branch/master/graph/badge.svg?token=P4IT8WQO0R)](https://codecov.io/gh/jakob-bagterp/timer-for-python)
33
41
  [![CodeQL](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml/badge.svg)](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
@@ -148,5 +156,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
148
156
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
149
157
 
150
158
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
151
-
152
-
@@ -1,5 +1,5 @@
1
- [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.1&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
2
- ![Python 3.10 | 3.11 or higher](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%2B&color=blueviolet)
1
+ [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.3&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
2
+ [![Python 3.10 | 3.11 | 3.12+](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%20|%203.12%2B&color=blueviolet)](https://www.python.org)
3
3
  [![MIT license](https://img.shields.io/static/v1?label=license&message=MIT&color=blue)](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
4
4
  [![Codecov](https://codecov.io/gh/jakob-bagterp/timer-for-python/branch/master/graph/badge.svg?token=P4IT8WQO0R)](https://codecov.io/gh/jakob-bagterp/timer-for-python)
5
5
  [![CodeQL](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml/badge.svg)](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
@@ -1,6 +1,6 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools==60.10.0",
3
+ "setuptools==69.0.2",
4
4
  "wheel"
5
5
  ]
6
6
  build-backend = "setuptools.build_meta"
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = timer-for-python
3
- version = attr: timer.__version__
3
+ version = 0.7.3
4
4
  author = Jakob Bagterp
5
5
  author_email = jakob_bagterp@hotmail.com
6
6
  maintainer = Jakob Bagterp
@@ -23,6 +23,7 @@ classifiers =
23
23
  Programming Language :: Python :: 3
24
24
  Programming Language :: Python :: 3.10
25
25
  Programming Language :: Python :: 3.11
26
+ Programming Language :: Python :: 3.12
26
27
  License :: OSI Approved :: MIT License
27
28
  Operating System :: OS Independent
28
29
  license = MIT License
@@ -34,21 +35,21 @@ package_dir =
34
35
  packages = find:
35
36
  python_requires = >=3.10
36
37
  setup_requires =
37
- colorist==1.6.0
38
+ colorist==1.7.1
38
39
  install_requires =
39
- colorist==1.6.0
40
+ colorist==1.7.1
40
41
  zip_safe = no
41
42
  include_package_data = True
42
43
 
43
44
  [options.extras_require]
44
45
  testing =
45
- coverage==7.2.7
46
- flake8==6.1.0
47
- mypy==1.4.1
48
- numpy==1.25.1
49
- pytest==7.4.0
50
- pytest-cov==4.1.0
51
- tox==4.6.4
46
+ coverage==7.4.4
47
+ flake8==7.0.0
48
+ mypy==1.9.0
49
+ numpy==1.26.4
50
+ pytest==8.1.1
51
+ pytest-cov==5.0.0
52
+ tox==4.14.2
52
53
 
53
54
  [options.packages.find]
54
55
  where = src
@@ -21,7 +21,71 @@ class Timer(TimerBase):
21
21
  cls._instance = super().__new__(cls)
22
22
  return cls._instance
23
23
 
24
- def __init__(self, thread: str | None = None, decimals: int = constant.decimals.DEFAULT) -> None:
24
+ def __init__(self, thread: str | None = None, decimals: int = 2) -> None:
25
+ """Main class to create a Timer instance. If not using the class with a `with` statement as [context manager](../user-guide/context-manager.md), remember that a `timer.start()` should always be followed by `timer.stop()` later in the code.
26
+
27
+ Args:
28
+ thread (str | None, optional): Option to start new thread.
29
+ decimals (int | None, optional): Option to define decimals for output. Minimum `0` (for no decimals) and maximum `9`. If `None`, default is `2` decimals. May be overruled in certain cases due to [humanised output](../user-guide/humanised-output.md).
30
+
31
+ Example:
32
+ Basic usage:
33
+
34
+ ```python linenums="1" hl_lines="3"
35
+ from timer import Timer
36
+
37
+ timer = Timer()
38
+ timer.start()
39
+
40
+ # Insert your code here
41
+
42
+ timer.stop()
43
+ ```
44
+
45
+ Or with a `with` statement as [context manager](../user-guide/context-manager.md):
46
+
47
+ ```python linenums="1" hl_lines="3"
48
+ from timer import Timer
49
+
50
+ with Timer():
51
+ # Insert your code here
52
+ ```
53
+
54
+ In both cases, the terminal output example is the same:
55
+
56
+ ```text title=""
57
+ Elapsed time: 12.34 seconds
58
+ ```
59
+
60
+ With custom thread name and decimals:
61
+
62
+ ```python linenums="1" hl_lines="3"
63
+ from timer import Timer
64
+
65
+ timer = Timer(thread="my_thread", decimals=5)
66
+ timer.start()
67
+
68
+ # Insert your code here
69
+
70
+ timer.stop(thread="my_thread")
71
+ ```
72
+
73
+ Or with a `with` statement as [context manager](../user-guide/context-manager.md):
74
+
75
+ ```python linenums="1" hl_lines="3"
76
+ from timer import Timer
77
+
78
+ with Timer(thread="my_thread", decimals=5):
79
+ # Insert your code here
80
+ ```
81
+
82
+ As before, the terminal will output the same result in both cases:
83
+
84
+ ```text title=""
85
+ Elapsed time: 0.12345 seconds for thread MY_THREAD
86
+ ```
87
+ """
88
+
25
89
  if not self._lock_init: # Ensure that initialisation of the lists only runs the first time.
26
90
  self.threads: list[ThreadItem] = []
27
91
  self.context_manager_threads: list[str] = []
@@ -1,2 +1,2 @@
1
- __version_info__ = (0, 7, 1)
1
+ __version_info__ = (0, 7, 3)
2
2
  __version__ = ".".join(map(str, __version_info__))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: timer-for-python
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Timer for Python
5
5
  Home-page: https://jakob-bagterp.github.io/timer-for-python/
6
6
  Download-URL: https://pypi.org/project/timer-for-python/
@@ -15,19 +15,27 @@ Project-URL: API Reference, https://jakob-bagterp.github.io/timer-for-python/ref
15
15
  Project-URL: Source Code, https://github.com/jakob-bagterp/timer-for-python
16
16
  Project-URL: Release Notes, https://github.com/jakob-bagterp/timer-for-python/releases
17
17
  Keywords: python,timer
18
- Platform: UNKNOWN
19
18
  Classifier: Programming Language :: Python :: 3
20
19
  Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: License :: OSI Approved :: MIT License
23
23
  Classifier: Operating System :: OS Independent
24
24
  Requires-Python: >=3.10
25
25
  Description-Content-Type: text/markdown
26
- Provides-Extra: testing
27
26
  License-File: LICENSE.md
28
-
29
- [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.1&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
30
- ![Python 3.10 | 3.11 or higher](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%2B&color=blueviolet)
27
+ Requires-Dist: colorist==1.7.1
28
+ Provides-Extra: testing
29
+ Requires-Dist: coverage==7.4.4; extra == "testing"
30
+ Requires-Dist: flake8==7.0.0; extra == "testing"
31
+ Requires-Dist: mypy==1.9.0; extra == "testing"
32
+ Requires-Dist: numpy==1.26.4; extra == "testing"
33
+ Requires-Dist: pytest==8.1.1; extra == "testing"
34
+ Requires-Dist: pytest-cov==5.0.0; extra == "testing"
35
+ Requires-Dist: tox==4.14.2; extra == "testing"
36
+
37
+ [![Latest version](https://img.shields.io/static/v1?label=version&message=0.7.3&color=yellowgreen)](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
38
+ [![Python 3.10 | 3.11 | 3.12+](https://img.shields.io/static/v1?label=python&message=3.10%20|%203.11%20|%203.12%2B&color=blueviolet)](https://www.python.org)
31
39
  [![MIT license](https://img.shields.io/static/v1?label=license&message=MIT&color=blue)](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
32
40
  [![Codecov](https://codecov.io/gh/jakob-bagterp/timer-for-python/branch/master/graph/badge.svg?token=P4IT8WQO0R)](https://codecov.io/gh/jakob-bagterp/timer-for-python)
33
41
  [![CodeQL](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml/badge.svg)](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
@@ -148,5 +156,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
148
156
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
149
157
 
150
158
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
151
-
152
-
@@ -6,11 +6,6 @@ setup.cfg
6
6
  src/timer/__init__.py
7
7
  src/timer/py.typed
8
8
  src/timer/version.py
9
- src/timer/.pytest_cache/.gitignore
10
- src/timer/.pytest_cache/CACHEDIR.TAG
11
- src/timer/.pytest_cache/README.md
12
- src/timer/.pytest_cache/v/cache/nodeids
13
- src/timer/.pytest_cache/v/cache/stepwise
14
9
  src/timer/constant/__init__.py
15
10
  src/timer/constant/decimals.py
16
11
  src/timer/constant/various.py
@@ -29,11 +24,6 @@ src/timer/model/thread_item.py
29
24
  src/timer/model/time_fractions.py
30
25
  src/timer/model/timer.py
31
26
  src/timer/model/timer_base.py
32
- src/timer/model/.pytest_cache/.gitignore
33
- src/timer/model/.pytest_cache/CACHEDIR.TAG
34
- src/timer/model/.pytest_cache/README.md
35
- src/timer/model/.pytest_cache/v/cache/nodeids
36
- src/timer/model/.pytest_cache/v/cache/stepwise
37
27
  src/timer_for_python.egg-info/PKG-INFO
38
28
  src/timer_for_python.egg-info/SOURCES.txt
39
29
  src/timer_for_python.egg-info/dependency_links.txt
@@ -0,0 +1,10 @@
1
+ colorist==1.7.1
2
+
3
+ [testing]
4
+ coverage==7.4.4
5
+ flake8==7.0.0
6
+ mypy==1.9.0
7
+ numpy==1.26.4
8
+ pytest==8.1.1
9
+ pytest-cov==5.0.0
10
+ tox==4.14.2
@@ -1,2 +0,0 @@
1
- # Created by pytest automatically.
2
- *
@@ -1,4 +0,0 @@
1
- Signature: 8a477f597d28d172789f06886806bc55
2
- # This file is a cache directory tag created by pytest.
3
- # For information about cache directory tags, see:
4
- # https://bford.info/cachedir/spec.html
@@ -1,8 +0,0 @@
1
- # pytest cache directory #
2
-
3
- This directory contains data from the pytest's cache plugin,
4
- which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5
-
6
- **Do not** commit this to version control.
7
-
8
- See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
@@ -1,2 +0,0 @@
1
- # Created by pytest automatically.
2
- *
@@ -1,4 +0,0 @@
1
- Signature: 8a477f597d28d172789f06886806bc55
2
- # This file is a cache directory tag created by pytest.
3
- # For information about cache directory tags, see:
4
- # https://bford.info/cachedir/spec.html
@@ -1,8 +0,0 @@
1
- # pytest cache directory #
2
-
3
- This directory contains data from the pytest's cache plugin,
4
- which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5
-
6
- **Do not** commit this to version control.
7
-
8
- See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
@@ -1,10 +0,0 @@
1
- colorist==1.6.0
2
-
3
- [testing]
4
- coverage==7.2.7
5
- flake8==6.1.0
6
- mypy==1.4.1
7
- numpy==1.25.1
8
- pytest==7.4.0
9
- pytest-cov==4.1.0
10
- tox==4.6.4