py-cachify 2.0.0__tar.gz → 2.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-cachify
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Distributed locks, caching, and locking decorators at hand
5
5
  Home-page: https://github.com/EzyGang/py-cachify
6
6
  License: MIT
@@ -29,17 +29,21 @@ Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
29
29
  Project-URL: Repository, https://github.com/EzyGang/py-cachify
30
30
  Description-Content-Type: text/markdown
31
31
 
32
- # Py-Cachify
33
-
34
32
  <p align="center">
33
+ <a href="https://py-cachify.readthedocs.io/latest/" target="_blank">
34
+ <img src="https://i.imgur.com/kObXEhW.png" alt="header">
35
+ </a>
35
36
  <a href="https://opensource.org/licenses/MIT" target="_blank">
36
37
  <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
37
38
  </a>
38
39
  <a href="https://badge.fury.io/py/py-cachify" target="_blank">
39
40
  <img src="https://badge.fury.io/py/py-cachify.svg" alt="PyPI version">
40
41
  </a>
41
- <a href="https://py-cachify.readthedocs.io/en/latest/?badge=latest" target="_blank">
42
- <img src="https://readthedocs.org/projects/py-cachify/badge/?version=latest" alt="Documentation Status">
42
+ <a href="https://pypi.org/project/py-cachify/" target="_blank">
43
+ <img src="https://img.shields.io/pypi/pyversions/py-cachify.svg?color=%2334D058" alt="supported versions">
44
+ </a>
45
+ <a href="https://coveralls.io/github/EzyGang/py-cachify?branch=main" target="_blank">
46
+ <img src="https://coveralls.io/repos/github/EzyGang/py-cachify/badge.png?branch=main" alt="Coverage Status">
43
47
  </a>
44
48
  </p>
45
49
  <p align="center">
@@ -49,8 +53,8 @@ Description-Content-Type: text/markdown
49
53
  <a href="https://github.com/EzyGang/py-cachify/actions/workflows/integration-tests.yml/badge.svg" target="_blank">
50
54
  <img src="https://github.com/EzyGang/py-cachify/actions/workflows/integration-tests.yml/badge.svg" alt="Tests Status">
51
55
  </a>
52
- <a href="https://coveralls.io/github/EzyGang/py-cachify?branch=main" target="_blank">
53
- <img src="https://coveralls.io/repos/github/EzyGang/py-cachify/badge.png?branch=main" alt="Coverage Status">
56
+ <a href="https://py-cachify.readthedocs.io/en/latest/?badge=latest" target="_blank">
57
+ <img src="https://readthedocs.org/projects/py-cachify/badge/?version=latest" alt="Documentation Status">
54
58
  </a>
55
59
  <a href="https://sonarcloud.io/summary/new_code?id=EzyGang_py-cachify" target="_blank">
56
60
  <img src="https://sonarcloud.io/api/project_badges/measure?project=EzyGang_py-cachify&metric=reliability_rating" alt="Reliability Rating">
@@ -65,23 +69,27 @@ Description-Content-Type: text/markdown
65
69
 
66
70
  ---
67
71
 
68
- py-cachify is a small library that provides useful cache-based utilities (caching, distributed locks) that are
69
- enhanced versions of those provided by similar packages.
72
+ **Py-Cachify** is a robust library tailored for developers looking to enhance their Python applications with elegant caching and locking mechanisms.
73
+ Whether you're building synchronous or asynchronous applications, Py-Cachify has you covered!
74
+
75
+ ## Key Features:
76
+ - **Flexible Caching**: Effortlessly cache your function results, dramatically reducing execution time for expensive computations and I/O-bound tasks.
77
+ Utilize customizable keys and time-to-live (TTL) parameters.
78
+
79
+ - **Distributed Locks**: Ensure safe concurrent operation of functions with distributed locks.
80
+ Prevent race conditions and manage shared resources effectively across both sync and async contexts.
70
81
 
71
- py-cachify works well in both sync and async environments, has 100% test coverage, is fully type annotated,
72
- is backend agnostic (you can provide your own client as long as it matches the signature), and supports Python from 3.8 and upward.
82
+ - **Backend Agnostic**: Easily integrate with different cache backends.
83
+ Choose between in-memory, Redis, or any custom backend that adheres to the provided client interfaces.
73
84
 
74
- It offers distributed (cache-based) locks and decorators to lock function executions,
75
- and also caching utilities and decorators for storing results in the cache.
85
+ - **Decorators for Ease**: Use intuitive decorators like `@cached()` and `@lock()` to wrap your functions,
86
+ maintain clean code, and benefit from automatic cache management.
76
87
 
77
- The key features are:
88
+ - **Type Safety & Documentation**: Fully type-annotated for enhanced IDE support and readability,
89
+ featuring comprehensive documentation and examples to guide you through various use cases.
78
90
 
79
- * **Intuitive to write**: Great editor support. When applying decorators your IDE will still be able to autocomplete and highlight inline errors for applied functions.
80
- * **Fully type annotated**: You don't have to constantly look into the docs. Everything is type annotated and easy to understand out of the box.
81
- * **Short**: Minimize code duplication. Add just one line of code to implement a cache or lock on your function.
82
- * **Start simple**: The simplest example adds only a couple of lines of code: initialize a library and use the needed utility.
83
- * **Backend agnostic**: Use whatever cache-backend you want to use. Py-Cachify is not forcing you into anything.
84
- * **Test coverage**: Has 100% test coverage and supports Python 3.8+
91
+ - **Production Ready**: With 100% test coverage and usage in multiple commercial projects,
92
+ Py-Cachify is trusted for production environments, ensuring reliability and stability for your applications.
85
93
 
86
94
  ---
87
95
 
@@ -143,6 +151,10 @@ async def sum_two(a: int, b: int) -> int:
143
151
  # Let's put print here to see what was the function called with
144
152
  print(f'Called with {a} {b}')
145
153
  return a + b
154
+
155
+
156
+ # Reset the cache for the call with arguments a=1, b=2
157
+ await sub_two.reset(a=1, b=2)
146
158
  ```
147
159
 
148
160
  Read more about `@cached` [here](https://py-cachify.readthedocs.io/latest/reference/cached/).
@@ -154,11 +166,18 @@ Locking through context manager:
154
166
  ```python
155
167
  from py_cachify import lock
156
168
 
169
+
170
+ async_lock = lock('resource_key')
157
171
  # Use it within an asynchronous context
158
- async with lock('resource_key'):
172
+ async with async_lock:
159
173
  # Your critical section here
160
174
  print('Critical section code')
161
175
 
176
+ # Check if it's locked
177
+ await async_lock.is_alocked()
178
+
179
+ # Forcefully release
180
+ await async_lock.arelease()
162
181
 
163
182
  # Use it within a synchronous context
164
183
  with lock('resource_key'):
@@ -173,8 +192,15 @@ Locking via decorator:
173
192
  from py_cachify import lock
174
193
 
175
194
  @lock(key='critical_function_lock-{arg}', nowait=False, timeout=10)
176
- def critical_function(arg: int) -> None:
195
+ async def critical_function(arg: int) -> None:
177
196
  # critical code
197
+
198
+
199
+ # Check if it's locked for arg=5
200
+ await critical_function.is_locked(arg=5)
201
+
202
+ # Forcefully release for arg=5
203
+ await critical_function.release(arg=5)
178
204
  ```
179
205
 
180
206
  Read more about `lock` [here](https://py-cachify.readthedocs.io/latest/reference/lock/).
@@ -1,14 +1,18 @@
1
- # Py-Cachify
2
-
3
1
  <p align="center">
2
+ <a href="https://py-cachify.readthedocs.io/latest/" target="_blank">
3
+ <img src="https://i.imgur.com/kObXEhW.png" alt="header">
4
+ </a>
4
5
  <a href="https://opensource.org/licenses/MIT" target="_blank">
5
6
  <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
6
7
  </a>
7
8
  <a href="https://badge.fury.io/py/py-cachify" target="_blank">
8
9
  <img src="https://badge.fury.io/py/py-cachify.svg" alt="PyPI version">
9
10
  </a>
10
- <a href="https://py-cachify.readthedocs.io/en/latest/?badge=latest" target="_blank">
11
- <img src="https://readthedocs.org/projects/py-cachify/badge/?version=latest" alt="Documentation Status">
11
+ <a href="https://pypi.org/project/py-cachify/" target="_blank">
12
+ <img src="https://img.shields.io/pypi/pyversions/py-cachify.svg?color=%2334D058" alt="supported versions">
13
+ </a>
14
+ <a href="https://coveralls.io/github/EzyGang/py-cachify?branch=main" target="_blank">
15
+ <img src="https://coveralls.io/repos/github/EzyGang/py-cachify/badge.png?branch=main" alt="Coverage Status">
12
16
  </a>
13
17
  </p>
14
18
  <p align="center">
@@ -18,8 +22,8 @@
18
22
  <a href="https://github.com/EzyGang/py-cachify/actions/workflows/integration-tests.yml/badge.svg" target="_blank">
19
23
  <img src="https://github.com/EzyGang/py-cachify/actions/workflows/integration-tests.yml/badge.svg" alt="Tests Status">
20
24
  </a>
21
- <a href="https://coveralls.io/github/EzyGang/py-cachify?branch=main" target="_blank">
22
- <img src="https://coveralls.io/repos/github/EzyGang/py-cachify/badge.png?branch=main" alt="Coverage Status">
25
+ <a href="https://py-cachify.readthedocs.io/en/latest/?badge=latest" target="_blank">
26
+ <img src="https://readthedocs.org/projects/py-cachify/badge/?version=latest" alt="Documentation Status">
23
27
  </a>
24
28
  <a href="https://sonarcloud.io/summary/new_code?id=EzyGang_py-cachify" target="_blank">
25
29
  <img src="https://sonarcloud.io/api/project_badges/measure?project=EzyGang_py-cachify&metric=reliability_rating" alt="Reliability Rating">
@@ -34,23 +38,27 @@
34
38
 
35
39
  ---
36
40
 
37
- py-cachify is a small library that provides useful cache-based utilities (caching, distributed locks) that are
38
- enhanced versions of those provided by similar packages.
41
+ **Py-Cachify** is a robust library tailored for developers looking to enhance their Python applications with elegant caching and locking mechanisms.
42
+ Whether you're building synchronous or asynchronous applications, Py-Cachify has you covered!
43
+
44
+ ## Key Features:
45
+ - **Flexible Caching**: Effortlessly cache your function results, dramatically reducing execution time for expensive computations and I/O-bound tasks.
46
+ Utilize customizable keys and time-to-live (TTL) parameters.
47
+
48
+ - **Distributed Locks**: Ensure safe concurrent operation of functions with distributed locks.
49
+ Prevent race conditions and manage shared resources effectively across both sync and async contexts.
39
50
 
40
- py-cachify works well in both sync and async environments, has 100% test coverage, is fully type annotated,
41
- is backend agnostic (you can provide your own client as long as it matches the signature), and supports Python from 3.8 and upward.
51
+ - **Backend Agnostic**: Easily integrate with different cache backends.
52
+ Choose between in-memory, Redis, or any custom backend that adheres to the provided client interfaces.
42
53
 
43
- It offers distributed (cache-based) locks and decorators to lock function executions,
44
- and also caching utilities and decorators for storing results in the cache.
54
+ - **Decorators for Ease**: Use intuitive decorators like `@cached()` and `@lock()` to wrap your functions,
55
+ maintain clean code, and benefit from automatic cache management.
45
56
 
46
- The key features are:
57
+ - **Type Safety & Documentation**: Fully type-annotated for enhanced IDE support and readability,
58
+ featuring comprehensive documentation and examples to guide you through various use cases.
47
59
 
48
- * **Intuitive to write**: Great editor support. When applying decorators your IDE will still be able to autocomplete and highlight inline errors for applied functions.
49
- * **Fully type annotated**: You don't have to constantly look into the docs. Everything is type annotated and easy to understand out of the box.
50
- * **Short**: Minimize code duplication. Add just one line of code to implement a cache or lock on your function.
51
- * **Start simple**: The simplest example adds only a couple of lines of code: initialize a library and use the needed utility.
52
- * **Backend agnostic**: Use whatever cache-backend you want to use. Py-Cachify is not forcing you into anything.
53
- * **Test coverage**: Has 100% test coverage and supports Python 3.8+
60
+ - **Production Ready**: With 100% test coverage and usage in multiple commercial projects,
61
+ Py-Cachify is trusted for production environments, ensuring reliability and stability for your applications.
54
62
 
55
63
  ---
56
64
 
@@ -112,6 +120,10 @@ async def sum_two(a: int, b: int) -> int:
112
120
  # Let's put print here to see what was the function called with
113
121
  print(f'Called with {a} {b}')
114
122
  return a + b
123
+
124
+
125
+ # Reset the cache for the call with arguments a=1, b=2
126
+ await sub_two.reset(a=1, b=2)
115
127
  ```
116
128
 
117
129
  Read more about `@cached` [here](https://py-cachify.readthedocs.io/latest/reference/cached/).
@@ -123,11 +135,18 @@ Locking through context manager:
123
135
  ```python
124
136
  from py_cachify import lock
125
137
 
138
+
139
+ async_lock = lock('resource_key')
126
140
  # Use it within an asynchronous context
127
- async with lock('resource_key'):
141
+ async with async_lock:
128
142
  # Your critical section here
129
143
  print('Critical section code')
130
144
 
145
+ # Check if it's locked
146
+ await async_lock.is_alocked()
147
+
148
+ # Forcefully release
149
+ await async_lock.arelease()
131
150
 
132
151
  # Use it within a synchronous context
133
152
  with lock('resource_key'):
@@ -142,8 +161,15 @@ Locking via decorator:
142
161
  from py_cachify import lock
143
162
 
144
163
  @lock(key='critical_function_lock-{arg}', nowait=False, timeout=10)
145
- def critical_function(arg: int) -> None:
164
+ async def critical_function(arg: int) -> None:
146
165
  # critical code
166
+
167
+
168
+ # Check if it's locked for arg=5
169
+ await critical_function.is_locked(arg=5)
170
+
171
+ # Forcefully release for arg=5
172
+ await critical_function.release(arg=5)
147
173
  ```
148
174
 
149
175
  Read more about `lock` [here](https://py-cachify.readthedocs.io/latest/reference/lock/).
@@ -0,0 +1,25 @@
1
+ from ._backend._cached import async_cached as async_cached
2
+ from ._backend._cached import cached as cached
3
+ from ._backend._cached import sync_cached as sync_cached
4
+ from ._backend._exceptions import CachifyInitError as CachifyInitError
5
+ from ._backend._exceptions import CachifyLockError as CachifyLockError
6
+ from ._backend._lib import init_cachify as init_cachify
7
+ from ._backend._lock import async_once as async_once
8
+ from ._backend._lock import lock as lock
9
+ from ._backend._lock import once as once
10
+ from ._backend._lock import sync_once as sync_once
11
+ from ._backend._types._common import AsyncClient as AsyncClient
12
+ from ._backend._types._common import Decoder as Decoder
13
+ from ._backend._types._common import Encoder as Encoder
14
+ from ._backend._types._common import SyncClient as SyncClient
15
+ from ._backend._types._lock_wrap import AsyncLockWrappedF as AsyncLockWrappedF
16
+ from ._backend._types._lock_wrap import SyncLockWrappedF as SyncLockWrappedF
17
+ from ._backend._types._lock_wrap import WrappedFunctionLock as WrappedFunctionLock
18
+
19
+
20
+ try:
21
+ from importlib.metadata import version
22
+
23
+ __version__ = version('py-cachify')
24
+ except ModuleNotFoundError:
25
+ __version__ = f'No version available for {__name__}'
@@ -46,7 +46,7 @@ def cached(
46
46
  ) -> SyncResetWrappedF[_P, _R]: ...
47
47
 
48
48
  def _cached_inner(
49
- _func: Union[Callable[_P, _R], Callable[_P, Awaitable[_R]]],
49
+ _func: Union[Callable[_P, Awaitable[_R]], Callable[_P, _R]],
50
50
  ) -> Union[AsyncResetWrappedF[_P, _R], SyncResetWrappedF[_P, _R]]:
51
51
  signature = inspect.signature(_func)
52
52
 
@@ -72,17 +72,18 @@ def cached(
72
72
 
73
73
  return cast(AsyncResetWrappedF[_P, _R], cast(object, _async_wrapper))
74
74
  else:
75
+ _sync_func = cast(Callable[_P, _R], _func)
75
76
 
76
- @wraps(_func) # type: ignore[unreachable]
77
+ @wraps(_sync_func)
77
78
  def _sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
78
79
  cachify = get_cachify()
79
80
  _key = get_full_key_from_signature(bound_args=signature.bind(*args, **kwargs), key=key)
80
81
  if val := cachify.get(key=_key):
81
82
  return encode_decode_value(encoder_decoder=dec, val=val)
82
83
 
83
- res = _func(*args, **kwargs)
84
+ res = _sync_func(*args, **kwargs)
84
85
  cachify.set(key=_key, val=encode_decode_value(encoder_decoder=enc, val=res), ttl=ttl)
85
- return cast(_R, res)
86
+ return res
86
87
 
87
88
  setattr(_sync_wrapper, 'reset', partial(reset, signature=signature, key=key))
88
89
 
@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  import inspect
3
- from typing import Any, Awaitable, Callable, TypeVar, Union
3
+ from typing import Any, Awaitable, Callable, Dict, Tuple, TypeVar, Union
4
4
 
5
5
  from typing_extensions import ParamSpec, TypeIs
6
6
 
@@ -15,8 +15,8 @@ _S = TypeVar('_S')
15
15
 
16
16
  def get_full_key_from_signature(bound_args: inspect.BoundArguments, key: str) -> str:
17
17
  args_dict = bound_args.arguments
18
- args = args_dict.pop('args', ())
19
- kwargs = args_dict.pop('kwargs', {})
18
+ args: Tuple[str, Any] = args_dict.pop('args', ())
19
+ kwargs: Dict[str, Any] = args_dict.pop('kwargs', {})
20
20
  kwargs.update(args_dict)
21
21
 
22
22
  try:
@@ -132,10 +132,10 @@ class lock(AsyncLockMethods, SyncLockMethods):
132
132
  self._exp = exp
133
133
 
134
134
  @overload
135
- def __call__(self, _func: Callable[_P, Awaitable[_R]], /) -> AsyncLockWrappedF[_P, _R]: ... # type: ignore[overload-overlap]
135
+ def __call__(self, _func: Callable[_P, Awaitable[_R]]) -> AsyncLockWrappedF[_P, _R]: ... # type: ignore[overload-overlap]
136
136
 
137
137
  @overload
138
- def __call__(self, _func: Callable[_P, _R], /) -> SyncLockWrappedF[_P, _R]: ...
138
+ def __call__(self, _func: Callable[_P, _R]) -> SyncLockWrappedF[_P, _R]: ...
139
139
 
140
140
  def __call__(
141
141
  self,
@@ -153,7 +153,7 @@ class lock(AsyncLockMethods, SyncLockMethods):
153
153
  _awaitable_func = _func
154
154
 
155
155
  @wraps(_awaitable_func)
156
- async def _async_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any:
156
+ async def _async_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
157
157
  bound_args = signature.bind(*args, **kwargs)
158
158
  _key = get_full_key_from_signature(bound_args=bound_args, key=self._key)
159
159
 
@@ -170,14 +170,15 @@ class lock(AsyncLockMethods, SyncLockMethods):
170
170
 
171
171
  return cast(AsyncLockWrappedF[_P, _R], cast(object, _async_wrapper))
172
172
  else:
173
+ _sync_func = cast(Callable[_P, _R], _func)
173
174
 
174
- @wraps(_func) # type: ignore[unreachable]
175
- def _sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any:
175
+ @wraps(_sync_func)
176
+ def _sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
176
177
  bound_args = signature.bind(*args, **kwargs)
177
178
  _key = get_full_key_from_signature(bound_args=bound_args, key=self._key)
178
179
 
179
180
  with lock(key=_key, nowait=self._nowait, timeout=self._timeout, exp=self._exp):
180
- return _func(*args, **kwargs)
181
+ return _sync_func(*args, **kwargs)
181
182
 
182
183
  setattr(_sync_wrapper, 'is_locked', partial(is_locked, signature=signature, key=self._key))
183
184
  setattr(_sync_wrapper, 'release', partial(reset, signature=signature, key=self._key))
@@ -244,14 +245,14 @@ def once(key: str, raise_on_locked: bool = False, return_on_locked: Any = None)
244
245
 
245
246
  def _once_inner(
246
247
  _func: Union[Callable[_P, _R], Callable[_P, Awaitable[_R]]],
247
- ) -> Union[SyncLockWrappedF[_P, _R], AsyncLockWrappedF[_P, _R]]:
248
+ ) -> Union[AsyncLockWrappedF[_P, _R], SyncLockWrappedF[_P, _R]]:
248
249
  signature = inspect.signature(_func)
249
250
 
250
251
  if is_coroutine(_func):
251
252
  _awaitable_func = _func
252
253
 
253
254
  @wraps(_awaitable_func)
254
- async def _async_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any:
255
+ async def _async_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
255
256
  bound_args = signature.bind(*args, **kwargs)
256
257
  _key = get_full_key_from_signature(bound_args=bound_args, key=key)
257
258
 
@@ -262,7 +263,7 @@ def once(key: str, raise_on_locked: bool = False, return_on_locked: Any = None)
262
263
  if raise_on_locked:
263
264
  raise
264
265
 
265
- return return_on_locked
266
+ return return_on_locked # type: ignore[no-any-return]
266
267
 
267
268
  setattr(_async_wrapper, 'release', partial(a_reset, signature=signature, key=key))
268
269
  setattr(_async_wrapper, 'is_locked', partial(is_alocked, signature=signature, key=key))
@@ -270,15 +271,16 @@ def once(key: str, raise_on_locked: bool = False, return_on_locked: Any = None)
270
271
  return cast(AsyncLockWrappedF[_P, _R], cast(object, _async_wrapper))
271
272
 
272
273
  else:
274
+ _sync_func = cast(Callable[_P, _R], _func)
273
275
 
274
- @wraps(_func) # type: ignore[unreachable]
275
- def _sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any:
276
+ @wraps(_sync_func)
277
+ def _sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
276
278
  bound_args = signature.bind(*args, **kwargs)
277
279
  _key = get_full_key_from_signature(bound_args=bound_args, key=key)
278
280
 
279
281
  try:
280
282
  with lock(key=_key):
281
- return _func(*args, **kwargs)
283
+ return _sync_func(*args, **kwargs)
282
284
  except CachifyLockError:
283
285
  if raise_on_locked:
284
286
  raise
@@ -29,10 +29,10 @@ class SyncLockWrappedF(Protocol[_P, _R]):
29
29
 
30
30
  class WrappedFunctionLock(Protocol):
31
31
  @overload
32
- def __call__(self, _func: Callable[_P, Awaitable[_R]], /) -> AsyncLockWrappedF[_P, _R]: ... # type: ignore[overload-overlap]
32
+ def __call__(self, _func: Callable[_P, Awaitable[_R]]) -> AsyncLockWrappedF[_P, _R]: ... # type: ignore[overload-overlap]
33
33
 
34
34
  @overload
35
- def __call__(self, _func: Callable[_P, _R], /) -> SyncLockWrappedF[_P, _R]: ...
35
+ def __call__(self, _func: Callable[_P, _R]) -> SyncLockWrappedF[_P, _R]: ...
36
36
 
37
37
  def __call__( # pragma: no cover
38
38
  self,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "py-cachify"
3
- version = "2.0.0"
3
+ version = "2.0.2"
4
4
  homepage = "https://github.com/EzyGang/py-cachify"
5
5
  repository = "https://github.com/EzyGang/py-cachify"
6
6
  license = "MIT"
@@ -28,7 +28,10 @@ classifiers = [
28
28
  "Programming Language :: Python :: 3.12",
29
29
  "License :: OSI Approved :: MIT License",
30
30
  ]
31
- packages = [{ include = 'py_cachify' }]
31
+ packages = [
32
+ { include = 'py_cachify' },
33
+ { include = 'py_cachify/py.typed'},
34
+ ]
32
35
 
33
36
  [project]
34
37
  requires-python = ">=3.8,<4.0"
@@ -44,9 +47,9 @@ pytest-cov = "^5.0.0"
44
47
  taskipy = "^1.13.0"
45
48
  mypy = "^1.11.1"
46
49
  coverage = "^7.6.1"
47
- pytest-asyncio = "^0.23.7"
50
+ pytest-asyncio = "^0.24.0"
48
51
  pytest-socket = "^0.7.0"
49
- ruff = "^0.6.2"
52
+ ruff = "^0.7.1"
50
53
 
51
54
 
52
55
  [tool.poetry.group.docs.dependencies]
@@ -118,30 +121,8 @@ keep-runtime-typing = true
118
121
  [tool.mypy]
119
122
  # Mypy configuration:
120
123
  # https://mypy.readthedocs.io/en/latest/config_file.html
121
- allow_redefinition = false
122
- check_untyped_defs = true
123
- disallow_untyped_decorators = true
124
- disallow_any_generics = false
125
- disallow_untyped_calls = true
126
- disallow_untyped_defs = true
127
- disallow_incomplete_defs = true
128
- ignore_errors = false
129
- ignore_missing_imports = false
130
- implicit_reexport = true
131
- local_partial_types = true
132
- strict_optional = true
133
- strict_equality = true
134
- no_implicit_optional = true
135
- warn_unused_ignores = true
136
- warn_redundant_casts = true
137
- warn_unused_configs = true
138
- warn_unreachable = true
139
- warn_no_return = false
124
+ strict = true
140
125
  pretty = true
141
- follow_imports = "silent"
142
- follow_imports_for_stubs = true
143
- show_error_codes = true
144
- plugins = []
145
126
 
146
127
  exclude = ['test_']
147
128
 
@@ -1,32 +0,0 @@
1
- from ._backend._cached import async_cached, cached, sync_cached
2
- from ._backend._exceptions import CachifyInitError, CachifyLockError
3
- from ._backend._lib import init_cachify
4
- from ._backend._lock import async_once, lock, once, sync_once
5
- from ._backend._types._common import AsyncClient, Decoder, Encoder, SyncClient
6
-
7
-
8
- try:
9
- from importlib.metadata import version
10
-
11
- __version__ = version('py-cachify')
12
- except ModuleNotFoundError:
13
- __version__ = f'No version available for {__name__}'
14
-
15
-
16
- __all__ = [
17
- 'CachifyInitError',
18
- 'CachifyLockError',
19
- 'init_cachify',
20
- 'lock',
21
- 'Encoder',
22
- 'Decoder',
23
- 'cached',
24
- 'once',
25
- 'AsyncClient',
26
- 'SyncClient',
27
- # The following are deprecated (and are just aliases)
28
- 'async_once',
29
- 'sync_once',
30
- 'async_cached',
31
- 'sync_cached',
32
- ]
File without changes