pyessential 0.1.2__tar.gz → 0.1.4__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.
- {pyessential-0.1.2/pyessential.egg-info → pyessential-0.1.4}/PKG-INFO +16 -11
- {pyessential-0.1.2 → pyessential-0.1.4}/README.md +12 -8
- pyessential-0.1.4/pyessential/_version.py +1 -0
- pyessential-0.1.4/pyessential/decorators/__init__.py +7 -0
- pyessential-0.1.4/pyessential/decorators/deprecated.py +42 -0
- {pyessential-0.1.2 → pyessential-0.1.4/pyessential.egg-info}/PKG-INFO +16 -11
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential.egg-info/SOURCES.txt +4 -2
- {pyessential-0.1.2 → pyessential-0.1.4}/setup.cfg +3 -2
- pyessential-0.1.4/tests/decorators/test_deprecated.py +41 -0
- pyessential-0.1.2/pyessential/_version.py +0 -1
- pyessential-0.1.2/pyessential/decorators/__init__.py +0 -3
- {pyessential-0.1.2 → pyessential-0.1.4}/LICENSE +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/MANIFEST.in +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/__init__.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/__main__.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/cli.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/decorators/timer.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/generators.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential/logger.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential.egg-info/dependency_links.txt +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential.egg-info/entry_points.txt +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyessential.egg-info/top_level.txt +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/pyproject.toml +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/setup.py +0 -0
- /pyessential-0.1.2/tests/test_decorators.py → /pyessential-0.1.4/tests/decorators/test_timer.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/tests/test_cli.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/tests/test_generators.py +0 -0
- {pyessential-0.1.2 → pyessential-0.1.4}/tests/test_logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyessential
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A growing collection of Python utilities and decorators.
|
|
5
5
|
Home-page: https://github.com/Abhi39054/PyEssential.git
|
|
6
6
|
Author: Abhishek Kumar
|
|
@@ -8,12 +8,13 @@ Author-email: abhishekkumar39054@gmail.com
|
|
|
8
8
|
Maintainer: Abhishek Kumar
|
|
9
9
|
License: MIT
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.9
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
19
20
|
Dynamic: license-file
|
|
@@ -84,15 +85,19 @@ pytest
|
|
|
84
85
|
|
|
85
86
|
### Releasing
|
|
86
87
|
|
|
87
|
-
1. Bump the version in `pyessential/_version.py
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
git commit -am "chore: bump to 0.1.3 - pypi release"
|
|
88
|
+
1. Bump the version in `pyessential/_version.py`, commit, and push to `main`:
|
|
89
|
+
```bash
|
|
90
|
+
git commit -am "chore: bump version to 0.1.4"
|
|
91
91
|
git push origin main
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
```
|
|
93
|
+
2. Tag the release and push the tag:
|
|
94
|
+
```bash
|
|
95
|
+
git tag -a v0.1.4 -m "Release 0.1.4"
|
|
96
|
+
git push origin v0.1.4
|
|
97
|
+
```
|
|
98
|
+
3. CI runs the tests, builds the package, publishes to TestPyPI, waits for approval, publishes to PyPI, and creates the GitHub Release.
|
|
99
|
+
|
|
100
|
+
The tag must match the version in `_version.py` (`v0.1.4` ↔ `0.1.4`), or the build fails.
|
|
96
101
|
|
|
97
102
|
## 🤝 Contributing
|
|
98
103
|
|
|
@@ -64,15 +64,19 @@ pytest
|
|
|
64
64
|
|
|
65
65
|
### Releasing
|
|
66
66
|
|
|
67
|
-
1. Bump the version in `pyessential/_version.py
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
git commit -am "chore: bump to 0.1.3 - pypi release"
|
|
67
|
+
1. Bump the version in `pyessential/_version.py`, commit, and push to `main`:
|
|
68
|
+
```bash
|
|
69
|
+
git commit -am "chore: bump version to 0.1.4"
|
|
71
70
|
git push origin main
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
```
|
|
72
|
+
2. Tag the release and push the tag:
|
|
73
|
+
```bash
|
|
74
|
+
git tag -a v0.1.4 -m "Release 0.1.4"
|
|
75
|
+
git push origin v0.1.4
|
|
76
|
+
```
|
|
77
|
+
3. CI runs the tests, builds the package, publishes to TestPyPI, waits for approval, publishes to PyPI, and creates the GitHub Release.
|
|
78
|
+
|
|
79
|
+
The tag must match the version in `_version.py` (`v0.1.4` ↔ `0.1.4`), or the build fails.
|
|
76
80
|
|
|
77
81
|
## 🤝 Contributing
|
|
78
82
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.4"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
import inspect
|
|
3
|
+
import warnings
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def deprecated(reason="", *, version=None, category=DeprecationWarning):
|
|
7
|
+
"""Mark a function or class as deprecated.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
reason: Message shown to the caller, e.g. "use new_func instead".
|
|
11
|
+
version: Optional version in which it was deprecated.
|
|
12
|
+
category: Warning class to emit (default: DeprecationWarning).
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def decorator(obj):
|
|
16
|
+
kind = "class" if inspect.isclass(obj) else "function"
|
|
17
|
+
message = f"{kind} '{obj.__qualname__}' is deprecated"
|
|
18
|
+
if version:
|
|
19
|
+
message += f" since version {version}"
|
|
20
|
+
message += "."
|
|
21
|
+
if reason:
|
|
22
|
+
message += f" {reason}"
|
|
23
|
+
|
|
24
|
+
if inspect.isclass(obj):
|
|
25
|
+
original_init = obj.__init__
|
|
26
|
+
|
|
27
|
+
@functools.wraps(original_init)
|
|
28
|
+
def new_init(self, *args, **kwargs):
|
|
29
|
+
warnings.warn(message, category, stacklevel=2)
|
|
30
|
+
original_init(self, *args, **kwargs)
|
|
31
|
+
|
|
32
|
+
obj.__init__ = new_init
|
|
33
|
+
return obj
|
|
34
|
+
|
|
35
|
+
@functools.wraps(obj)
|
|
36
|
+
def wrapper(*args, **kwargs):
|
|
37
|
+
warnings.warn(message, category, stacklevel=2)
|
|
38
|
+
return obj(*args, **kwargs)
|
|
39
|
+
|
|
40
|
+
return wrapper
|
|
41
|
+
|
|
42
|
+
return decorator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyessential
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A growing collection of Python utilities and decorators.
|
|
5
5
|
Home-page: https://github.com/Abhi39054/PyEssential.git
|
|
6
6
|
Author: Abhishek Kumar
|
|
@@ -8,12 +8,13 @@ Author-email: abhishekkumar39054@gmail.com
|
|
|
8
8
|
Maintainer: Abhishek Kumar
|
|
9
9
|
License: MIT
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.9
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
19
20
|
Dynamic: license-file
|
|
@@ -84,15 +85,19 @@ pytest
|
|
|
84
85
|
|
|
85
86
|
### Releasing
|
|
86
87
|
|
|
87
|
-
1. Bump the version in `pyessential/_version.py
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
git commit -am "chore: bump to 0.1.3 - pypi release"
|
|
88
|
+
1. Bump the version in `pyessential/_version.py`, commit, and push to `main`:
|
|
89
|
+
```bash
|
|
90
|
+
git commit -am "chore: bump version to 0.1.4"
|
|
91
91
|
git push origin main
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
```
|
|
93
|
+
2. Tag the release and push the tag:
|
|
94
|
+
```bash
|
|
95
|
+
git tag -a v0.1.4 -m "Release 0.1.4"
|
|
96
|
+
git push origin v0.1.4
|
|
97
|
+
```
|
|
98
|
+
3. CI runs the tests, builds the package, publishes to TestPyPI, waits for approval, publishes to PyPI, and creates the GitHub Release.
|
|
99
|
+
|
|
100
|
+
The tag must match the version in `_version.py` (`v0.1.4` ↔ `0.1.4`), or the build fails.
|
|
96
101
|
|
|
97
102
|
## 🤝 Contributing
|
|
98
103
|
|
|
@@ -16,8 +16,10 @@ pyessential.egg-info/dependency_links.txt
|
|
|
16
16
|
pyessential.egg-info/entry_points.txt
|
|
17
17
|
pyessential.egg-info/top_level.txt
|
|
18
18
|
pyessential/decorators/__init__.py
|
|
19
|
+
pyessential/decorators/deprecated.py
|
|
19
20
|
pyessential/decorators/timer.py
|
|
20
21
|
tests/test_cli.py
|
|
21
|
-
tests/test_decorators.py
|
|
22
22
|
tests/test_generators.py
|
|
23
|
-
tests/test_logger.py
|
|
23
|
+
tests/test_logger.py
|
|
24
|
+
tests/decorators/test_deprecated.py
|
|
25
|
+
tests/decorators/test_timer.py
|
|
@@ -11,16 +11,17 @@ url = https://github.com/Abhi39054/PyEssential.git
|
|
|
11
11
|
license = MIT
|
|
12
12
|
classifiers =
|
|
13
13
|
Programming Language :: Python :: 3
|
|
14
|
-
Programming Language :: Python :: 3.8
|
|
15
14
|
Programming Language :: Python :: 3.9
|
|
16
15
|
Programming Language :: Python :: 3.10
|
|
16
|
+
Programming Language :: Python :: 3.11
|
|
17
|
+
Programming Language :: Python :: 3.12
|
|
17
18
|
License :: OSI Approved :: MIT License
|
|
18
19
|
Operating System :: OS Independent
|
|
19
20
|
|
|
20
21
|
[options]
|
|
21
22
|
packages = find:
|
|
22
23
|
install_requires =
|
|
23
|
-
python_requires = >=3.
|
|
24
|
+
python_requires = >=3.9
|
|
24
25
|
|
|
25
26
|
[options.packages.find]
|
|
26
27
|
exclude =
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from pyessential.decorators import deprecated
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_function_warns_and_still_works():
|
|
7
|
+
@deprecated("use new_func instead", version="0.2.0")
|
|
8
|
+
def old(x):
|
|
9
|
+
return x * 2
|
|
10
|
+
|
|
11
|
+
with pytest.warns(DeprecationWarning, match="use new_func instead"):
|
|
12
|
+
assert old(3) == 6
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_preserves_metadata():
|
|
16
|
+
@deprecated("nope")
|
|
17
|
+
def old():
|
|
18
|
+
"""Docstring."""
|
|
19
|
+
|
|
20
|
+
assert old.__name__ == "old"
|
|
21
|
+
assert old.__doc__ == "Docstring."
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_class_warns_on_instantiation():
|
|
25
|
+
@deprecated("use NewClient instead")
|
|
26
|
+
class Old:
|
|
27
|
+
def __init__(self, value):
|
|
28
|
+
self.value = value
|
|
29
|
+
|
|
30
|
+
with pytest.warns(DeprecationWarning, match="NewClient"):
|
|
31
|
+
obj = Old(5)
|
|
32
|
+
assert obj.value == 5
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_custom_category():
|
|
36
|
+
@deprecated("gone soon", category=FutureWarning)
|
|
37
|
+
def old():
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
with pytest.warns(FutureWarning):
|
|
41
|
+
old()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/pyessential-0.1.2/tests/test_decorators.py → /pyessential-0.1.4/tests/decorators/test_timer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|