database-wrapper-redis 0.2.36__tar.gz → 0.3.146__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.
- database_wrapper_redis-0.3.146/LICENSE +21 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/PKG-INFO +10 -9
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis/__init__.py +1 -1
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis/connector.py +24 -18
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis.egg-info/PKG-INFO +10 -9
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis.egg-info/SOURCES.txt +1 -0
- database_wrapper_redis-0.3.146/database_wrapper_redis.egg-info/requires.txt +2 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/pyproject.toml +12 -10
- database_wrapper_redis-0.2.36/database_wrapper_redis.egg-info/requires.txt +0 -2
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/README.md +0 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis/py.typed +0 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis.egg-info/dependency_links.txt +0 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis.egg-info/top_level.txt +0 -0
- {database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/setup.cfg +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Gints Murāns
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: database_wrapper_redis
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.146
|
|
4
4
|
Summary: database_wrapper for Redis database
|
|
5
5
|
Author-email: Gints Murans <gm@gm.lv>
|
|
6
|
-
License:
|
|
7
|
-
Project-URL: Homepage, https://github.com/
|
|
8
|
-
Project-URL: Documentation, https://github.com/
|
|
9
|
-
Project-URL: Changes, https://github.com/
|
|
10
|
-
Project-URL: Code, https://github.com/
|
|
11
|
-
Project-URL: Issue Tracker, https://github.com/
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/4Apps/py_database_wrapper
|
|
8
|
+
Project-URL: Documentation, https://github.com/4Apps/py_database_wrapper
|
|
9
|
+
Project-URL: Changes, https://github.com/4Apps/py_database_wrapper
|
|
10
|
+
Project-URL: Code, https://github.com/4Apps/py_database_wrapper
|
|
11
|
+
Project-URL: Issue Tracker, https://github.com/4Apps/py_database_wrapper/issues
|
|
12
12
|
Project-URL: Download, https://pypi.org/project/database_wrapper/
|
|
13
13
|
Keywords: database,wrapper,python,redis
|
|
14
14
|
Classifier: Development Status :: 4 - Beta
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
17
16
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
17
|
Classifier: Operating System :: Microsoft :: Windows
|
|
19
18
|
Classifier: Operating System :: POSIX
|
|
@@ -32,8 +31,10 @@ Classifier: Topic :: Software Development
|
|
|
32
31
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
32
|
Requires-Python: >=3.8
|
|
34
33
|
Description-Content-Type: text/markdown
|
|
35
|
-
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
Requires-Dist: database_wrapper==0.3.146
|
|
36
36
|
Requires-Dist: redis>=8.0
|
|
37
|
+
Dynamic: license-file
|
|
37
38
|
|
|
38
39
|
# database_wrapper_redis
|
|
39
40
|
|
{database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis/connector.py
RENAMED
|
@@ -147,36 +147,42 @@ class KVDbBase:
|
|
|
147
147
|
def __enter__(self) -> RedisClient:
|
|
148
148
|
self.logger.debug("Creating redis connection")
|
|
149
149
|
|
|
150
|
+
# Connections are kept in a per-context stack so that nested
|
|
151
|
+
# context managers each get and close their own connection
|
|
150
152
|
connection = self.new_connection()
|
|
151
|
-
self.context_connection.
|
|
153
|
+
stack = self.context_connection.get() or ()
|
|
154
|
+
self.context_connection.set(stack + (connection,))
|
|
152
155
|
return connection
|
|
153
156
|
|
|
154
157
|
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
|
155
158
|
self.logger.debug("Releasing redis connection")
|
|
156
159
|
|
|
157
|
-
|
|
158
|
-
if
|
|
159
|
-
redis_conn
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
stack = self.context_connection.get() or ()
|
|
161
|
+
if stack:
|
|
162
|
+
redis_conn = stack[-1]
|
|
163
|
+
self.context_connection.set(stack[:-1])
|
|
164
|
+
if redis_conn:
|
|
165
|
+
redis_conn.close()
|
|
163
166
|
|
|
164
167
|
async def __aenter__(self) -> RedisClientAsync:
|
|
165
168
|
self.logger.debug("Creating redis connection")
|
|
166
169
|
|
|
170
|
+
# Connections are kept in a per-context stack so that nested
|
|
171
|
+
# context managers each get and close their own connection
|
|
167
172
|
connection = await self.new_connection()
|
|
168
|
-
self.context_connection.
|
|
173
|
+
stack = self.context_connection.get() or ()
|
|
174
|
+
self.context_connection.set(stack + (connection,))
|
|
169
175
|
return connection
|
|
170
176
|
|
|
171
177
|
async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
|
|
172
178
|
self.logger.debug("Releasing redis connection")
|
|
173
179
|
|
|
174
|
-
|
|
175
|
-
if
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
stack = self.context_connection.get() or ()
|
|
181
|
+
if stack:
|
|
182
|
+
redis_conn = stack[-1]
|
|
183
|
+
self.context_connection.set(stack[:-1])
|
|
184
|
+
if redis_conn:
|
|
185
|
+
await redis_conn.aclose()
|
|
180
186
|
|
|
181
187
|
###############
|
|
182
188
|
### Helpers ###
|
|
@@ -217,7 +223,7 @@ class KVDbBase:
|
|
|
217
223
|
|
|
218
224
|
|
|
219
225
|
class RedisDb(KVDbBase):
|
|
220
|
-
context_connection: ContextVar[RedisClient | None]
|
|
226
|
+
context_connection: ContextVar[tuple[RedisClient, ...] | None]
|
|
221
227
|
|
|
222
228
|
_connection: RedisClient
|
|
223
229
|
|
|
@@ -288,7 +294,7 @@ class RedisDb(KVDbBase):
|
|
|
288
294
|
|
|
289
295
|
|
|
290
296
|
class RedisDbAsync(KVDbBase):
|
|
291
|
-
context_connection: ContextVar[RedisClientAsync | None]
|
|
297
|
+
context_connection: ContextVar[tuple[RedisClientAsync, ...] | None]
|
|
292
298
|
|
|
293
299
|
_connection: RedisClientAsync | None
|
|
294
300
|
|
|
@@ -375,7 +381,7 @@ class RedisDbAsync(KVDbBase):
|
|
|
375
381
|
|
|
376
382
|
class RedisDbWithPool(KVDbBase):
|
|
377
383
|
pool: RedisConnectionPool
|
|
378
|
-
context_connection: ContextVar[RedisClient | None]
|
|
384
|
+
context_connection: ContextVar[tuple[RedisClient, ...] | None]
|
|
379
385
|
|
|
380
386
|
_connection: RedisClient | None
|
|
381
387
|
|
|
@@ -446,7 +452,7 @@ class RedisDbWithPool(KVDbBase):
|
|
|
446
452
|
|
|
447
453
|
class RedisDbWithPoolAsync(KVDbBase):
|
|
448
454
|
pool: RedisConnectionPoolAsync
|
|
449
|
-
context_connection: ContextVar[RedisClientAsync | None]
|
|
455
|
+
context_connection: ContextVar[tuple[RedisClientAsync, ...] | None]
|
|
450
456
|
|
|
451
457
|
_connection: RedisClientAsync | None
|
|
452
458
|
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: database_wrapper_redis
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.146
|
|
4
4
|
Summary: database_wrapper for Redis database
|
|
5
5
|
Author-email: Gints Murans <gm@gm.lv>
|
|
6
|
-
License:
|
|
7
|
-
Project-URL: Homepage, https://github.com/
|
|
8
|
-
Project-URL: Documentation, https://github.com/
|
|
9
|
-
Project-URL: Changes, https://github.com/
|
|
10
|
-
Project-URL: Code, https://github.com/
|
|
11
|
-
Project-URL: Issue Tracker, https://github.com/
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/4Apps/py_database_wrapper
|
|
8
|
+
Project-URL: Documentation, https://github.com/4Apps/py_database_wrapper
|
|
9
|
+
Project-URL: Changes, https://github.com/4Apps/py_database_wrapper
|
|
10
|
+
Project-URL: Code, https://github.com/4Apps/py_database_wrapper
|
|
11
|
+
Project-URL: Issue Tracker, https://github.com/4Apps/py_database_wrapper/issues
|
|
12
12
|
Project-URL: Download, https://pypi.org/project/database_wrapper/
|
|
13
13
|
Keywords: database,wrapper,python,redis
|
|
14
14
|
Classifier: Development Status :: 4 - Beta
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
17
16
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
17
|
Classifier: Operating System :: Microsoft :: Windows
|
|
19
18
|
Classifier: Operating System :: POSIX
|
|
@@ -32,8 +31,10 @@ Classifier: Topic :: Software Development
|
|
|
32
31
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
32
|
Requires-Python: >=3.8
|
|
34
33
|
Description-Content-Type: text/markdown
|
|
35
|
-
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
Requires-Dist: database_wrapper==0.3.146
|
|
36
36
|
Requires-Dist: redis>=8.0
|
|
37
|
+
Dynamic: license-file
|
|
37
38
|
|
|
38
39
|
# database_wrapper_redis
|
|
39
40
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools >=
|
|
2
|
+
requires = ["setuptools >= 77.0.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "database_wrapper_redis"
|
|
7
|
-
|
|
7
|
+
# Major.minor only; the patch is the git commit count, stamped at build time by
|
|
8
|
+
# scripts/set_version.bash. See scripts/version.bash for what the next release is.
|
|
9
|
+
version = "0.3.146"
|
|
8
10
|
description = "database_wrapper for Redis database"
|
|
9
11
|
readme = "README.md"
|
|
10
12
|
requires-python = ">=3.8"
|
|
11
|
-
license =
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
12
15
|
authors = [{ name = "Gints Murans", email = "gm@gm.lv" }]
|
|
13
16
|
classifiers = [
|
|
14
17
|
"Development Status :: 4 - Beta",
|
|
15
18
|
"Intended Audience :: Developers",
|
|
16
|
-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
17
19
|
"Operating System :: MacOS :: MacOS X",
|
|
18
20
|
"Operating System :: Microsoft :: Windows",
|
|
19
21
|
"Operating System :: POSIX",
|
|
@@ -32,14 +34,14 @@ classifiers = [
|
|
|
32
34
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
33
35
|
]
|
|
34
36
|
keywords = ["database", "wrapper", "python", "redis"]
|
|
35
|
-
dependencies = ["database_wrapper == 0.
|
|
37
|
+
dependencies = ["database_wrapper == 0.3.146", "redis >= 8.0"]
|
|
36
38
|
|
|
37
39
|
[project.urls]
|
|
38
|
-
Homepage = "https://github.com/
|
|
39
|
-
Documentation = "https://github.com/
|
|
40
|
-
Changes = "https://github.com/
|
|
41
|
-
Code = "https://github.com/
|
|
42
|
-
"Issue Tracker" = "https://github.com/
|
|
40
|
+
Homepage = "https://github.com/4Apps/py_database_wrapper"
|
|
41
|
+
Documentation = "https://github.com/4Apps/py_database_wrapper"
|
|
42
|
+
Changes = "https://github.com/4Apps/py_database_wrapper"
|
|
43
|
+
Code = "https://github.com/4Apps/py_database_wrapper"
|
|
44
|
+
"Issue Tracker" = "https://github.com/4Apps/py_database_wrapper/issues"
|
|
43
45
|
Download = "https://pypi.org/project/database_wrapper/"
|
|
44
46
|
|
|
45
47
|
[tool.setuptools.package-data]
|
|
File without changes
|
{database_wrapper_redis-0.2.36 → database_wrapper_redis-0.3.146}/database_wrapper_redis/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|