persidict 0.36.4__tar.gz → 0.36.5__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.

Potentially problematic release.


This version of persidict might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: persidict
3
- Version: 0.36.4
3
+ Version: 0.36.5
4
4
  Summary: Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud.
5
5
  Keywords: persistence,dicts,distributed,parallel
6
6
  Author: Vlad (Volodymyr) Pavlov
@@ -119,21 +119,49 @@ print(f"API Key: {cloud_config['api_key']}")
119
119
  # >>> API Key: ABC-123-XYZ
120
120
  ```
121
121
 
122
- ## 4. Glossary
122
+ ## 4. Comparison With Python Built-in Dictionaries
123
123
 
124
- ### 4.1 Core Concepts
124
+ ### 4.1 Similarities
125
+
126
+ `PersiDict` subclasses can be used like regular Python dictionaries, supporting:
127
+
128
+ * Get, set, and delete operations with square brackets (`[]`).
129
+ * Iteration over keys, values, and items.
130
+ * Membership testing with `in`.
131
+ * Length checking with `len()`.
132
+ * Standard methods like `keys()`, `values()`, `items()`, `get()`, `clear()`
133
+ , `setdefault()`, and `update()`.
134
+
135
+ ### 4.2 Differences
136
+
137
+ * **Persistence**: Data is saved between program executions.
138
+ * **Keys**: Keys must be strings or sequences of URL/filename-safe strings.
139
+ * **Values**: Values must be pickleable.
140
+ You can also constrain values to a specific class.
141
+ * **Order**: Insertion order is not preserved.
142
+ * **Additional Methods**: `PersiDict` provides extra methods not in the standard
143
+ dict API, such as `timestamp()`, `random_key()`, `newest_keys()`, `subdicts()`
144
+ , `delete_if_exists()`, `get_params()` and more.
145
+ * **Special Values**: Use `KEEP_CURRENT` to avoid updating a value
146
+ and `DELETE_CURRENT` to delete a value during an assignment.
147
+
148
+ ## 5. Glossary
149
+
150
+ ### 5.1 Core Concepts
125
151
 
126
152
  * **`PersiDict`**: The abstract base class that defines the common interface
127
153
  for all persistent dictionaries in the package. It's the foundation
128
154
  upon which everything else is built.
129
155
  * **`PersiDictKey`**: A type hint that specifies what can be used
130
- as a key in any `PersiDict`. It can be a `SafeStrTuple`,
131
- a single string, or a sequence of strings.
156
+ as a key in any `PersiDict`. It can be a `SafeStrTuple`, a single string,
157
+ * or a sequence of strings. When a `PesiDict` method requires a key as an input,
158
+ it will accept any of these types and convert them to a `SafeStrTuple` internally.
132
159
  * **`SafeStrTuple`**: The core data structure for keys. It's an immutable,
133
160
  flat tuple of non-empty, URL/filename-safe strings, ensuring that
134
- keys are consistent and safe for various storage backends.
161
+ keys are consistent and safe for various storage backends.
162
+ When a `PersiDict` method returns a key, it will always be in this format.
135
163
 
136
- ### 4.2 Main Implementations
164
+ ### 5.2 Main Implementations
137
165
 
138
166
  * **`FileDirDict`**: A primary, concrete implementation of `PersiDict`
139
167
  that stores each key-value pair as a separate file in a local directory.
@@ -141,7 +169,7 @@ that stores each key-value pair as a separate file in a local directory.
141
169
  which stores each key-value pair as an object in an AWS S3 bucket,
142
170
  suitable for distributed environments.
143
171
 
144
- ### 4.3 Key Parameters
172
+ ### 5.3 Key Parameters
145
173
 
146
174
  * **`file_type`**: A key parameter for `FileDirDict` and `S3Dict` that
147
175
  determines the serialization format for values.
@@ -160,7 +188,7 @@ stores its files. For `S3Dict`, this directory is used to cache files locally.
160
188
  an `S3Dict` stores its objects.
161
189
  * **`region`**: An optional string specifying the AWS region for the S3 bucket.
162
190
 
163
- ### 4.4 Advanced Classes
191
+ ### 5.4 Advanced Classes
164
192
 
165
193
  * **`WriteOnceDict`**: A wrapper that enforces write-once behavior
166
194
  on any `PersiDict`, ignoring subsequent writes to the same key.
@@ -170,7 +198,7 @@ writes to the same key always match the original value.
170
198
  multiple `PersiDict` instances sharing the same storage
171
199
  but with different `file_type`s.
172
200
 
173
- ### 4.5 Special "Joker" Values
201
+ ### 5.5 Special "Joker" Values
174
202
 
175
203
  * **`Joker`**: The base class for special command-like values that
176
204
  can be assigned to a key to trigger an action instead of storing a value.
@@ -179,32 +207,6 @@ ensures the existing value is not changed.
179
207
  * **`DELETE_CURRENT`**: A "joker" value that deletes the key-value pair
180
208
  from the dictionary when assigned to a key.
181
209
 
182
- ## 5. Comparison With Python Built-in Dictionaries
183
-
184
- ### 5.1 Similarities
185
-
186
- `PersiDict` subclasses can be used like regular Python dictionaries, supporting:
187
-
188
- * Get, set, and delete operations with square brackets (`[]`).
189
- * Iteration over keys, values, and items.
190
- * Membership testing with `in`.
191
- * Length checking with `len()`.
192
- * Standard methods like `keys()`, `values()`, `items()`, `get()`, `clear()`
193
- , `setdefault()`, and `update()`.
194
-
195
- ### 5.2 Differences
196
-
197
- * **Persistence**: Data is saved between program executions.
198
- * **Keys**: Keys must be strings or sequences of URL/filename-safe strings.
199
- * **Values**: Values must be pickleable.
200
- You can also constrain values to a specific class.
201
- * **Order**: Insertion order is not preserved.
202
- * **Additional Methods**: `PersiDict` provides extra methods not in the standard
203
- dict API, such as `timestamp()`, `random_key()`, `newest_keys()`, `subdicts()`
204
- , `delete_if_exists()`, `get_params()` and more.
205
- * **Special Values**: Use `KEEP_CURRENT` to avoid updating a value
206
- and `DELETE_CURRENT` to delete a value during an assignment.
207
-
208
210
  ## 6. API Highlights
209
211
 
210
212
  `PersiDict` subclasses support the standard Python dictionary API, plus these additional methods for advanced functionality:
@@ -85,21 +85,49 @@ print(f"API Key: {cloud_config['api_key']}")
85
85
  # >>> API Key: ABC-123-XYZ
86
86
  ```
87
87
 
88
- ## 4. Glossary
88
+ ## 4. Comparison With Python Built-in Dictionaries
89
89
 
90
- ### 4.1 Core Concepts
90
+ ### 4.1 Similarities
91
+
92
+ `PersiDict` subclasses can be used like regular Python dictionaries, supporting:
93
+
94
+ * Get, set, and delete operations with square brackets (`[]`).
95
+ * Iteration over keys, values, and items.
96
+ * Membership testing with `in`.
97
+ * Length checking with `len()`.
98
+ * Standard methods like `keys()`, `values()`, `items()`, `get()`, `clear()`
99
+ , `setdefault()`, and `update()`.
100
+
101
+ ### 4.2 Differences
102
+
103
+ * **Persistence**: Data is saved between program executions.
104
+ * **Keys**: Keys must be strings or sequences of URL/filename-safe strings.
105
+ * **Values**: Values must be pickleable.
106
+ You can also constrain values to a specific class.
107
+ * **Order**: Insertion order is not preserved.
108
+ * **Additional Methods**: `PersiDict` provides extra methods not in the standard
109
+ dict API, such as `timestamp()`, `random_key()`, `newest_keys()`, `subdicts()`
110
+ , `delete_if_exists()`, `get_params()` and more.
111
+ * **Special Values**: Use `KEEP_CURRENT` to avoid updating a value
112
+ and `DELETE_CURRENT` to delete a value during an assignment.
113
+
114
+ ## 5. Glossary
115
+
116
+ ### 5.1 Core Concepts
91
117
 
92
118
  * **`PersiDict`**: The abstract base class that defines the common interface
93
119
  for all persistent dictionaries in the package. It's the foundation
94
120
  upon which everything else is built.
95
121
  * **`PersiDictKey`**: A type hint that specifies what can be used
96
- as a key in any `PersiDict`. It can be a `SafeStrTuple`,
97
- a single string, or a sequence of strings.
122
+ as a key in any `PersiDict`. It can be a `SafeStrTuple`, a single string,
123
+ * or a sequence of strings. When a `PesiDict` method requires a key as an input,
124
+ it will accept any of these types and convert them to a `SafeStrTuple` internally.
98
125
  * **`SafeStrTuple`**: The core data structure for keys. It's an immutable,
99
126
  flat tuple of non-empty, URL/filename-safe strings, ensuring that
100
- keys are consistent and safe for various storage backends.
127
+ keys are consistent and safe for various storage backends.
128
+ When a `PersiDict` method returns a key, it will always be in this format.
101
129
 
102
- ### 4.2 Main Implementations
130
+ ### 5.2 Main Implementations
103
131
 
104
132
  * **`FileDirDict`**: A primary, concrete implementation of `PersiDict`
105
133
  that stores each key-value pair as a separate file in a local directory.
@@ -107,7 +135,7 @@ that stores each key-value pair as a separate file in a local directory.
107
135
  which stores each key-value pair as an object in an AWS S3 bucket,
108
136
  suitable for distributed environments.
109
137
 
110
- ### 4.3 Key Parameters
138
+ ### 5.3 Key Parameters
111
139
 
112
140
  * **`file_type`**: A key parameter for `FileDirDict` and `S3Dict` that
113
141
  determines the serialization format for values.
@@ -126,7 +154,7 @@ stores its files. For `S3Dict`, this directory is used to cache files locally.
126
154
  an `S3Dict` stores its objects.
127
155
  * **`region`**: An optional string specifying the AWS region for the S3 bucket.
128
156
 
129
- ### 4.4 Advanced Classes
157
+ ### 5.4 Advanced Classes
130
158
 
131
159
  * **`WriteOnceDict`**: A wrapper that enforces write-once behavior
132
160
  on any `PersiDict`, ignoring subsequent writes to the same key.
@@ -136,7 +164,7 @@ writes to the same key always match the original value.
136
164
  multiple `PersiDict` instances sharing the same storage
137
165
  but with different `file_type`s.
138
166
 
139
- ### 4.5 Special "Joker" Values
167
+ ### 5.5 Special "Joker" Values
140
168
 
141
169
  * **`Joker`**: The base class for special command-like values that
142
170
  can be assigned to a key to trigger an action instead of storing a value.
@@ -145,32 +173,6 @@ ensures the existing value is not changed.
145
173
  * **`DELETE_CURRENT`**: A "joker" value that deletes the key-value pair
146
174
  from the dictionary when assigned to a key.
147
175
 
148
- ## 5. Comparison With Python Built-in Dictionaries
149
-
150
- ### 5.1 Similarities
151
-
152
- `PersiDict` subclasses can be used like regular Python dictionaries, supporting:
153
-
154
- * Get, set, and delete operations with square brackets (`[]`).
155
- * Iteration over keys, values, and items.
156
- * Membership testing with `in`.
157
- * Length checking with `len()`.
158
- * Standard methods like `keys()`, `values()`, `items()`, `get()`, `clear()`
159
- , `setdefault()`, and `update()`.
160
-
161
- ### 5.2 Differences
162
-
163
- * **Persistence**: Data is saved between program executions.
164
- * **Keys**: Keys must be strings or sequences of URL/filename-safe strings.
165
- * **Values**: Values must be pickleable.
166
- You can also constrain values to a specific class.
167
- * **Order**: Insertion order is not preserved.
168
- * **Additional Methods**: `PersiDict` provides extra methods not in the standard
169
- dict API, such as `timestamp()`, `random_key()`, `newest_keys()`, `subdicts()`
170
- , `delete_if_exists()`, `get_params()` and more.
171
- * **Special Values**: Use `KEEP_CURRENT` to avoid updating a value
172
- and `DELETE_CURRENT` to delete a value during an assignment.
173
-
174
176
  ## 6. API Highlights
175
177
 
176
178
  `PersiDict` subclasses support the standard Python dictionary API, plus these additional methods for advanced functionality:
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "persidict"
7
- version = "0.36.4"
7
+ version = "0.36.5"
8
8
  description = "Simple persistent key-value store for Python. Values are stored as files on a disk or as S3 objects on AWS cloud."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"