redis-dict 3.2.0__tar.gz → 3.2.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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: redis-dict
3
- Version: 3.2.0
3
+ Version: 3.2.2
4
4
  Summary: Dictionary with Redis as storage backend
5
5
  Author-email: Melvin Bijman <bijman.m.m@gmail.com>
6
6
  License: MIT
@@ -42,7 +42,7 @@ Requires-Dist: types-redis>=4.6.0; extra == "dev"
42
42
  Requires-Dist: typing_extensions>=4.5.0; extra == "dev"
43
43
  Requires-Dist: attrs==22.2.0; extra == "dev"
44
44
  Requires-Dist: cffi==1.15.1; extra == "dev"
45
- Requires-Dist: cryptography==43.0.1; extra == "dev"
45
+ Requires-Dist: cryptography==44.0.1; extra == "dev"
46
46
  Requires-Dist: exceptiongroup==1.1.1; extra == "dev"
47
47
  Requires-Dist: future==0.18.3; extra == "dev"
48
48
  Requires-Dist: pycparser==2.21; extra == "dev"
@@ -71,12 +71,14 @@ Requires-Dist: build; extra == "build"
71
71
  Requires-Dist: twine; extra == "build"
72
72
 
73
73
  # Redis-dict
74
+
74
75
  [![PyPI](https://img.shields.io/pypi/v/redis-dict.svg)](https://pypi.org/project/redis-dict/)
75
76
  [![CI](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml/badge.svg)](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml)
76
77
  [![codecov](https://codecov.io/gh/Attumm/redis-dict/graph/badge.svg?token=Lqs7McQGEs)](https://codecov.io/gh/Attumm/redis-dict)
78
+ [![Documentation](https://img.shields.io/badge/docs-sphinx-blue.svg)](https://attumm.github.io/redis-dict/)
77
79
  [![Downloads](https://static.pepy.tech/badge/redis-dict/month)](https://pepy.tech/project/redis-dict)
78
80
 
79
- RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. This simple yet powerful library utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
81
+ RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. Redis-Dict utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
80
82
 
81
83
  The library includes utility functions for more complex use cases such as caching, batching, and more. By leveraging Redis for efficient key-value storage, RedisDict enables high-performance data management, maintaining efficiency even with large datasets and Redis instances.
82
84
 
@@ -93,7 +95,6 @@ The library includes utility functions for more complex use cases such as cachin
93
95
  * Encryption: allows for storing data encrypted, while retaining the simple dictionary interface.
94
96
 
95
97
  ## Example
96
- Redis is an exceptionally fast database when used appropriately. RedisDict leverages Redis for efficient key-value storage, enabling high-performance data management.
97
98
 
98
99
  ```bash
99
100
  pip install redis-dict
@@ -110,6 +111,8 @@ True
110
111
  >>> dic["baz"] = "hello world"
111
112
  >>> dic
112
113
  {'foo': 42, 'baz': 'hello world'}
114
+ >>> from datetime import datetime
115
+ >>> dic["datetime"] = datetime.now()
113
116
  ```
114
117
  In Redis our example looks like this.
115
118
  ```
@@ -120,11 +123,13 @@ In Redis our example looks like this.
120
123
  "int:42"
121
124
  127.0.0.1:6379> GET "main:baz"
122
125
  "str:hello world"
126
+ 127.0.0.1:6379> GET "main:datetime"
127
+ "datetime:2025-02-20T19:37:54.214274"
123
128
  ```
124
129
 
125
130
  ## Types
126
131
 
127
- ### standard types
132
+ ### Standard types
128
133
  RedisDict supports a range of Python data types, from basic types to nested structures.
129
134
  Basic types are handled natively, while complex data types like lists and dictionaries, RedisDict uses JSON serialization, specifically avoiding [pickle](https://docs.python.org/3/library/pickle.html) due to its security vulnerabilities within distributed computing contexts.
130
135
  Although the library supports nested structures, the recommended best practice is to use RedisDict as a shallow dictionary.
@@ -132,6 +137,8 @@ This approach optimizes Redis database performance and efficiency by ensuring th
132
137
  Following types are supported:
133
138
  `str, int, float, bool, NoneType, list, dict, tuple, set, datetime, date, time, timedelta, Decimal, complex, bytes, UUID, OrderedDict, defaultdict, frozenset`
134
139
  ```python
140
+ from redis_dict import RedisDict
141
+
135
142
  from uuid import UUID
136
143
  from decimal import Decimal
137
144
  from collections import OrderedDict, defaultdict
@@ -239,7 +246,7 @@ dic = RedisDict(namespace="example")
239
246
  print(dic["foo"]) # outputs "bar"
240
247
  ```
241
248
 
242
- ## More Examples
249
+ ## Additional Examples
243
250
 
244
251
  ### Caching made simple
245
252
  ```python
@@ -326,6 +333,19 @@ print(key, value) # Output: 'c' 3 (example)
326
333
  # Using setdefault() method
327
334
  dic.setdefault("d", 4)
328
335
  print(dic["d"]) # Output: 4
336
+
337
+ from datetime import datetime, timedelta
338
+
339
+ # Redis dict support datetime
340
+ dic["now"] = datetime.now()
341
+ print(dic["now"]) # 2025-02-20 19:25:38.835816
342
+
343
+ # SRedis dict support timedelta and more types
344
+ dic["time"] = timedelta(days=1)
345
+ print(dic["time"]) # 1 day, 0:00:00
346
+
347
+ print(dic)
348
+ {'now': datetime.datetime(2025, 2, 20, 19, 25, 38, 835816), 'time': datetime.timedelta(days=1), 'b': 2, 'd': 4}
329
349
  ```
330
350
 
331
351
  ### Additional Examples
@@ -333,7 +353,6 @@ For more advanced examples of RedisDict, please refer to the unit-test files in
333
353
  The unit-tests can be as used as a starting point.
334
354
 
335
355
  ### Nested types
336
- Nested Types
337
356
  RedisDict supports nested structures with mixed types through JSON serialization. The feature works by utilizing JSON encoding and decoding under the hood. While this represents an upgrade in functionality, the feature is not fully implemented and should be used with caution. For optimal performance, using shallow dictionaries is recommended.
338
357
  ```python
339
358
  from datetime import datetime, timedelta
@@ -355,12 +374,10 @@ encoded = json.dumps(data, cls=RedisDictJSONEncoder)
355
374
  result = json.loads(encoded, cls=RedisDictJSONDecoder)
356
375
  ```
357
376
 
358
-
359
377
  ### Extending RedisDict with Custom Types
360
378
 
361
379
  RedisDict supports custom type serialization. Here's how to add a new type:
362
380
 
363
-
364
381
  ```python
365
382
  import json
366
383
 
@@ -1,10 +1,12 @@
1
1
  # Redis-dict
2
+
2
3
  [![PyPI](https://img.shields.io/pypi/v/redis-dict.svg)](https://pypi.org/project/redis-dict/)
3
4
  [![CI](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml/badge.svg)](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml)
4
5
  [![codecov](https://codecov.io/gh/Attumm/redis-dict/graph/badge.svg?token=Lqs7McQGEs)](https://codecov.io/gh/Attumm/redis-dict)
6
+ [![Documentation](https://img.shields.io/badge/docs-sphinx-blue.svg)](https://attumm.github.io/redis-dict/)
5
7
  [![Downloads](https://static.pepy.tech/badge/redis-dict/month)](https://pepy.tech/project/redis-dict)
6
8
 
7
- RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. This simple yet powerful library utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
9
+ RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. Redis-Dict utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
8
10
 
9
11
  The library includes utility functions for more complex use cases such as caching, batching, and more. By leveraging Redis for efficient key-value storage, RedisDict enables high-performance data management, maintaining efficiency even with large datasets and Redis instances.
10
12
 
@@ -21,7 +23,6 @@ The library includes utility functions for more complex use cases such as cachin
21
23
  * Encryption: allows for storing data encrypted, while retaining the simple dictionary interface.
22
24
 
23
25
  ## Example
24
- Redis is an exceptionally fast database when used appropriately. RedisDict leverages Redis for efficient key-value storage, enabling high-performance data management.
25
26
 
26
27
  ```bash
27
28
  pip install redis-dict
@@ -38,6 +39,8 @@ True
38
39
  >>> dic["baz"] = "hello world"
39
40
  >>> dic
40
41
  {'foo': 42, 'baz': 'hello world'}
42
+ >>> from datetime import datetime
43
+ >>> dic["datetime"] = datetime.now()
41
44
  ```
42
45
  In Redis our example looks like this.
43
46
  ```
@@ -48,11 +51,13 @@ In Redis our example looks like this.
48
51
  "int:42"
49
52
  127.0.0.1:6379> GET "main:baz"
50
53
  "str:hello world"
54
+ 127.0.0.1:6379> GET "main:datetime"
55
+ "datetime:2025-02-20T19:37:54.214274"
51
56
  ```
52
57
 
53
58
  ## Types
54
59
 
55
- ### standard types
60
+ ### Standard types
56
61
  RedisDict supports a range of Python data types, from basic types to nested structures.
57
62
  Basic types are handled natively, while complex data types like lists and dictionaries, RedisDict uses JSON serialization, specifically avoiding [pickle](https://docs.python.org/3/library/pickle.html) due to its security vulnerabilities within distributed computing contexts.
58
63
  Although the library supports nested structures, the recommended best practice is to use RedisDict as a shallow dictionary.
@@ -60,6 +65,8 @@ This approach optimizes Redis database performance and efficiency by ensuring th
60
65
  Following types are supported:
61
66
  `str, int, float, bool, NoneType, list, dict, tuple, set, datetime, date, time, timedelta, Decimal, complex, bytes, UUID, OrderedDict, defaultdict, frozenset`
62
67
  ```python
68
+ from redis_dict import RedisDict
69
+
63
70
  from uuid import UUID
64
71
  from decimal import Decimal
65
72
  from collections import OrderedDict, defaultdict
@@ -167,7 +174,7 @@ dic = RedisDict(namespace="example")
167
174
  print(dic["foo"]) # outputs "bar"
168
175
  ```
169
176
 
170
- ## More Examples
177
+ ## Additional Examples
171
178
 
172
179
  ### Caching made simple
173
180
  ```python
@@ -254,6 +261,19 @@ print(key, value) # Output: 'c' 3 (example)
254
261
  # Using setdefault() method
255
262
  dic.setdefault("d", 4)
256
263
  print(dic["d"]) # Output: 4
264
+
265
+ from datetime import datetime, timedelta
266
+
267
+ # Redis dict support datetime
268
+ dic["now"] = datetime.now()
269
+ print(dic["now"]) # 2025-02-20 19:25:38.835816
270
+
271
+ # SRedis dict support timedelta and more types
272
+ dic["time"] = timedelta(days=1)
273
+ print(dic["time"]) # 1 day, 0:00:00
274
+
275
+ print(dic)
276
+ {'now': datetime.datetime(2025, 2, 20, 19, 25, 38, 835816), 'time': datetime.timedelta(days=1), 'b': 2, 'd': 4}
257
277
  ```
258
278
 
259
279
  ### Additional Examples
@@ -261,7 +281,6 @@ For more advanced examples of RedisDict, please refer to the unit-test files in
261
281
  The unit-tests can be as used as a starting point.
262
282
 
263
283
  ### Nested types
264
- Nested Types
265
284
  RedisDict supports nested structures with mixed types through JSON serialization. The feature works by utilizing JSON encoding and decoding under the hood. While this represents an upgrade in functionality, the feature is not fully implemented and should be used with caution. For optimal performance, using shallow dictionaries is recommended.
266
285
  ```python
267
286
  from datetime import datetime, timedelta
@@ -283,12 +302,10 @@ encoded = json.dumps(data, cls=RedisDictJSONEncoder)
283
302
  result = json.loads(encoded, cls=RedisDictJSONDecoder)
284
303
  ```
285
304
 
286
-
287
305
  ### Extending RedisDict with Custom Types
288
306
 
289
307
  RedisDict supports custom type serialization. Here's how to add a new type:
290
308
 
291
-
292
309
  ```python
293
310
  import json
294
311
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "redis-dict"
7
- version = "3.2.0"
7
+ version = "3.2.2"
8
8
  description = "Dictionary with Redis as storage backend"
9
9
  authors = [
10
10
  {name = "Melvin Bijman", email = "bijman.m.m@gmail.com"},
@@ -62,7 +62,7 @@ dev = [
62
62
 
63
63
  "attrs==22.2.0",
64
64
  "cffi==1.15.1",
65
- "cryptography==43.0.1",
65
+ "cryptography==44.0.1",
66
66
  "exceptiongroup==1.1.1",
67
67
  "future==0.18.3",
68
68
  "pycparser==2.21",
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: redis-dict
3
- Version: 3.2.0
3
+ Version: 3.2.2
4
4
  Summary: Dictionary with Redis as storage backend
5
5
  Author-email: Melvin Bijman <bijman.m.m@gmail.com>
6
6
  License: MIT
@@ -42,7 +42,7 @@ Requires-Dist: types-redis>=4.6.0; extra == "dev"
42
42
  Requires-Dist: typing_extensions>=4.5.0; extra == "dev"
43
43
  Requires-Dist: attrs==22.2.0; extra == "dev"
44
44
  Requires-Dist: cffi==1.15.1; extra == "dev"
45
- Requires-Dist: cryptography==43.0.1; extra == "dev"
45
+ Requires-Dist: cryptography==44.0.1; extra == "dev"
46
46
  Requires-Dist: exceptiongroup==1.1.1; extra == "dev"
47
47
  Requires-Dist: future==0.18.3; extra == "dev"
48
48
  Requires-Dist: pycparser==2.21; extra == "dev"
@@ -71,12 +71,14 @@ Requires-Dist: build; extra == "build"
71
71
  Requires-Dist: twine; extra == "build"
72
72
 
73
73
  # Redis-dict
74
+
74
75
  [![PyPI](https://img.shields.io/pypi/v/redis-dict.svg)](https://pypi.org/project/redis-dict/)
75
76
  [![CI](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml/badge.svg)](https://github.com/Attumm/redis-dict/actions/workflows/ci.yml)
76
77
  [![codecov](https://codecov.io/gh/Attumm/redis-dict/graph/badge.svg?token=Lqs7McQGEs)](https://codecov.io/gh/Attumm/redis-dict)
78
+ [![Documentation](https://img.shields.io/badge/docs-sphinx-blue.svg)](https://attumm.github.io/redis-dict/)
77
79
  [![Downloads](https://static.pepy.tech/badge/redis-dict/month)](https://pepy.tech/project/redis-dict)
78
80
 
79
- RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. This simple yet powerful library utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
81
+ RedisDict is a Python library that offers a convenient and familiar interface for interacting with Redis, treating it as if it were a Python dictionary. Its goal is to help developers write clean, Pythonic code while using Redis as a storage solution for seamless distributed computing. Redis-Dict utilizes Redis as a key-value store and supports various data types, including strings, integers, floats, booleans, lists, and dictionaries. Additionally, developers can extend RedisDict to work with custom objects.
80
82
 
81
83
  The library includes utility functions for more complex use cases such as caching, batching, and more. By leveraging Redis for efficient key-value storage, RedisDict enables high-performance data management, maintaining efficiency even with large datasets and Redis instances.
82
84
 
@@ -93,7 +95,6 @@ The library includes utility functions for more complex use cases such as cachin
93
95
  * Encryption: allows for storing data encrypted, while retaining the simple dictionary interface.
94
96
 
95
97
  ## Example
96
- Redis is an exceptionally fast database when used appropriately. RedisDict leverages Redis for efficient key-value storage, enabling high-performance data management.
97
98
 
98
99
  ```bash
99
100
  pip install redis-dict
@@ -110,6 +111,8 @@ True
110
111
  >>> dic["baz"] = "hello world"
111
112
  >>> dic
112
113
  {'foo': 42, 'baz': 'hello world'}
114
+ >>> from datetime import datetime
115
+ >>> dic["datetime"] = datetime.now()
113
116
  ```
114
117
  In Redis our example looks like this.
115
118
  ```
@@ -120,11 +123,13 @@ In Redis our example looks like this.
120
123
  "int:42"
121
124
  127.0.0.1:6379> GET "main:baz"
122
125
  "str:hello world"
126
+ 127.0.0.1:6379> GET "main:datetime"
127
+ "datetime:2025-02-20T19:37:54.214274"
123
128
  ```
124
129
 
125
130
  ## Types
126
131
 
127
- ### standard types
132
+ ### Standard types
128
133
  RedisDict supports a range of Python data types, from basic types to nested structures.
129
134
  Basic types are handled natively, while complex data types like lists and dictionaries, RedisDict uses JSON serialization, specifically avoiding [pickle](https://docs.python.org/3/library/pickle.html) due to its security vulnerabilities within distributed computing contexts.
130
135
  Although the library supports nested structures, the recommended best practice is to use RedisDict as a shallow dictionary.
@@ -132,6 +137,8 @@ This approach optimizes Redis database performance and efficiency by ensuring th
132
137
  Following types are supported:
133
138
  `str, int, float, bool, NoneType, list, dict, tuple, set, datetime, date, time, timedelta, Decimal, complex, bytes, UUID, OrderedDict, defaultdict, frozenset`
134
139
  ```python
140
+ from redis_dict import RedisDict
141
+
135
142
  from uuid import UUID
136
143
  from decimal import Decimal
137
144
  from collections import OrderedDict, defaultdict
@@ -239,7 +246,7 @@ dic = RedisDict(namespace="example")
239
246
  print(dic["foo"]) # outputs "bar"
240
247
  ```
241
248
 
242
- ## More Examples
249
+ ## Additional Examples
243
250
 
244
251
  ### Caching made simple
245
252
  ```python
@@ -326,6 +333,19 @@ print(key, value) # Output: 'c' 3 (example)
326
333
  # Using setdefault() method
327
334
  dic.setdefault("d", 4)
328
335
  print(dic["d"]) # Output: 4
336
+
337
+ from datetime import datetime, timedelta
338
+
339
+ # Redis dict support datetime
340
+ dic["now"] = datetime.now()
341
+ print(dic["now"]) # 2025-02-20 19:25:38.835816
342
+
343
+ # SRedis dict support timedelta and more types
344
+ dic["time"] = timedelta(days=1)
345
+ print(dic["time"]) # 1 day, 0:00:00
346
+
347
+ print(dic)
348
+ {'now': datetime.datetime(2025, 2, 20, 19, 25, 38, 835816), 'time': datetime.timedelta(days=1), 'b': 2, 'd': 4}
329
349
  ```
330
350
 
331
351
  ### Additional Examples
@@ -333,7 +353,6 @@ For more advanced examples of RedisDict, please refer to the unit-test files in
333
353
  The unit-tests can be as used as a starting point.
334
354
 
335
355
  ### Nested types
336
- Nested Types
337
356
  RedisDict supports nested structures with mixed types through JSON serialization. The feature works by utilizing JSON encoding and decoding under the hood. While this represents an upgrade in functionality, the feature is not fully implemented and should be used with caution. For optimal performance, using shallow dictionaries is recommended.
338
357
  ```python
339
358
  from datetime import datetime, timedelta
@@ -355,12 +374,10 @@ encoded = json.dumps(data, cls=RedisDictJSONEncoder)
355
374
  result = json.loads(encoded, cls=RedisDictJSONDecoder)
356
375
  ```
357
376
 
358
-
359
377
  ### Extending RedisDict with Custom Types
360
378
 
361
379
  RedisDict supports custom type serialization. Here's how to add a new type:
362
380
 
363
-
364
381
  ```python
365
382
  import json
366
383
 
@@ -14,7 +14,7 @@ types-redis>=4.6.0
14
14
  typing_extensions>=4.5.0
15
15
  attrs==22.2.0
16
16
  cffi==1.15.1
17
- cryptography==43.0.1
17
+ cryptography==44.0.1
18
18
  exceptiongroup==1.1.1
19
19
  future==0.18.3
20
20
  pycparser==2.21
File without changes
File without changes