tinykv 0.2.1__tar.gz → 0.3.0__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.4
1
+ Metadata-Version: 2.5
2
2
  Name: tinykv
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: A lightweight Python SQLite key-value store built on sqlite3.
5
5
  Keywords: python,sqlite,sqlite3,key-value store,kv
6
6
  Author-email: Flavio Veloso Soares <flaviovs@magnux.com>
@@ -11,21 +11,10 @@ Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Topic :: Database
12
12
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
13
  License-File: LICENSE
14
- Requires-Dist: codespell ; extra == "dev"
15
- Requires-Dist: flake8-bugbear ; extra == "dev"
16
- Requires-Dist: flake8-builtins ; extra == "dev"
17
- Requires-Dist: flake8-docstrings ; extra == "dev"
18
- Requires-Dist: flake8-tidy-imports ; extra == "dev"
19
- Requires-Dist: flake8-walrus ; extra == "dev"
20
- Requires-Dist: flake8 ; extra == "dev"
21
- Requires-Dist: flit ; extra == "dev"
22
- Requires-Dist: mypy ; extra == "dev"
23
- Requires-Dist: pylint ; extra == "dev"
24
- Requires-Dist: taskipy ; extra == "dev"
25
14
  Project-URL: Homepage, https://github.com/flaviovs/tinykv
26
15
  Project-URL: Issues, https://github.com/flaviovs/tinykv/issues
27
16
  Project-URL: Repository, https://github.com/flaviovs/tinykv
28
- Provides-Extra: dev
17
+ Import-Name: tinykv
29
18
 
30
19
  TinyKV: Python SQLite key-value store
31
20
  =====================================
@@ -93,13 +82,10 @@ Let’s try again:
93
82
 
94
83
  Now it works!
95
84
 
96
- By default, TinyKV currently allows pickle-based value
97
- serialization/deserialization for compatibility.
98
- If `allow_pickle` is omitted, TinyKV currently behaves as if
99
- `allow_pickle=True` and emits a `FutureWarning`.
100
- Applications should not rely on this behavior and should explicitly set
101
- `allow_pickle=False` when handling databases that might be untrusted.
102
- The default is expected to change to `False` in a future release.
85
+ By default, TinyKV does not allow pickle-based value
86
+ serialization/deserialization. Applications must explicitly pass
87
+ `allow_pickle=True` to enable it, and should do so only when handling trusted
88
+ database contents.
103
89
 
104
90
 
105
91
  ## Storing and retrieving data
@@ -153,7 +139,7 @@ Same for container objects:
153
139
  ['one', 'two', 'three']
154
140
 
155
141
  In fact, you can store any pickable object when
156
- `allow_pickle=True` (the current default):
142
+ `allow_pickle=True`:
157
143
 
158
144
  >>> import datetime
159
145
  >>>
@@ -167,7 +153,8 @@ In fact, you can store any pickable object when
167
153
  >>> type(a_long_time_ago)
168
154
  <class 'datetime.datetime'>
169
155
 
170
- For safer behavior with untrusted database contents, disable pickle:
156
+ Pickle is disabled by default for safer behavior with untrusted database
157
+ contents:
171
158
 
172
159
  >>> safe_kv = tinykv.TinyKV(conn, allow_pickle=False)
173
160
 
@@ -284,6 +271,9 @@ Miscellaneous
284
271
  `TypeError`, and empty strings raise `ValueError`. Keys are case-sensitive
285
272
  (since v0.1.4).
286
273
 
274
+ - Keys with the format `__tinykv_XXXXX__` are reserved for TinyKV internal
275
+ use.
276
+
287
277
  - TinyKV does not open or manage transactions. Also, it operates both
288
278
  in autocommit and non-autocommit mode. All operations are atomic.
289
279
 
@@ -310,8 +300,10 @@ Miscellaneous
310
300
  ... allow_pickle=True,
311
301
  ... )
312
302
 
313
- Table names must match the pattern `[a-zA-Z_][a-zA-Z0-9_]*`. Invalid
314
- names raise `ValueError`.
303
+ Table names must match the pattern
304
+ `[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)?`. The optional prefix
305
+ selects an attached SQLite database, for example `archive.kv`. Each
306
+ identifier is quoted separately. Invalid names raise `ValueError`.
315
307
 
316
308
 
317
309
  Questions? Bugs? Suggestions?
@@ -64,13 +64,10 @@ Let’s try again:
64
64
 
65
65
  Now it works!
66
66
 
67
- By default, TinyKV currently allows pickle-based value
68
- serialization/deserialization for compatibility.
69
- If `allow_pickle` is omitted, TinyKV currently behaves as if
70
- `allow_pickle=True` and emits a `FutureWarning`.
71
- Applications should not rely on this behavior and should explicitly set
72
- `allow_pickle=False` when handling databases that might be untrusted.
73
- The default is expected to change to `False` in a future release.
67
+ By default, TinyKV does not allow pickle-based value
68
+ serialization/deserialization. Applications must explicitly pass
69
+ `allow_pickle=True` to enable it, and should do so only when handling trusted
70
+ database contents.
74
71
 
75
72
 
76
73
  ## Storing and retrieving data
@@ -124,7 +121,7 @@ Same for container objects:
124
121
  ['one', 'two', 'three']
125
122
 
126
123
  In fact, you can store any pickable object when
127
- `allow_pickle=True` (the current default):
124
+ `allow_pickle=True`:
128
125
 
129
126
  >>> import datetime
130
127
  >>>
@@ -138,7 +135,8 @@ In fact, you can store any pickable object when
138
135
  >>> type(a_long_time_ago)
139
136
  <class 'datetime.datetime'>
140
137
 
141
- For safer behavior with untrusted database contents, disable pickle:
138
+ Pickle is disabled by default for safer behavior with untrusted database
139
+ contents:
142
140
 
143
141
  >>> safe_kv = tinykv.TinyKV(conn, allow_pickle=False)
144
142
 
@@ -255,6 +253,9 @@ Miscellaneous
255
253
  `TypeError`, and empty strings raise `ValueError`. Keys are case-sensitive
256
254
  (since v0.1.4).
257
255
 
256
+ - Keys with the format `__tinykv_XXXXX__` are reserved for TinyKV internal
257
+ use.
258
+
258
259
  - TinyKV does not open or manage transactions. Also, it operates both
259
260
  in autocommit and non-autocommit mode. All operations are atomic.
260
261
 
@@ -281,8 +282,10 @@ Miscellaneous
281
282
  ... allow_pickle=True,
282
283
  ... )
283
284
 
284
- Table names must match the pattern `[a-zA-Z_][a-zA-Z0-9_]*`. Invalid
285
- names raise `ValueError`.
285
+ Table names must match the pattern
286
+ `[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)?`. The optional prefix
287
+ selects an attached SQLite database, for example `archive.kv`. Each
288
+ identifier is quoted separately. Invalid names raise `ValueError`.
286
289
 
287
290
 
288
291
  Questions? Bugs? Suggestions?
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["flit_core >=3.2,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "tinykv"
7
+ authors = [{name = "Flavio Veloso Soares", email = "flaviovs@magnux.com"}]
8
+ license = {file = "LICENSE"}
9
+ readme = "README.md"
10
+ keywords = ["python", "sqlite", "sqlite3", "key-value store", "kv"]
11
+ classifiers = [
12
+ "License :: OSI Approved :: MIT License",
13
+ "Programming Language :: Python :: 3",
14
+ "Topic :: Database",
15
+ "Topic :: Software Development :: Libraries :: Python Modules",
16
+ ]
17
+ requires-python = ">=3.11"
18
+
19
+ dynamic = ["version", "description"]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/flaviovs/tinykv"
23
+ Repository = "https://github.com/flaviovs/tinykv"
24
+ Issues = "https://github.com/flaviovs/tinykv/issues"
25
+
26
+ [dependency-groups]
27
+ dev = [
28
+ 'ruff',
29
+ 'flit',
30
+ 'mypy',
31
+ ]
32
+
33
+ [tool.mypy]
34
+ files = "."
35
+ python_version = "3.11"
36
+ exclude = [".git", ".venv"]
37
+ strict = true
38
+ warn_redundant_casts = true
39
+ warn_return_any = true
40
+ warn_unreachable = true
41
+ pretty = true
42
+
43
+ [tool.ruff]
44
+ line-length = 79
45
+ include = ["**/*.py"]
46
+
47
+ [tool.ruff.format]
48
+ skip-magic-trailing-comma = false
49
+
50
+ [tool.ruff.lint]
51
+ extend-select = ["PLC0415"]
52
+ external = ["V107"]
53
+ select = [
54
+ "E", "F", "I", "B", "UP", "SIM", "RET", "ARG", "RUF", "PTH", "C4", "PIE", "D",
55
+ "TRY", "ERA", "ANN",
56
+ ]
57
+ ignore = ["TRY003", "COM812"]
58
+
59
+ [tool.ruff.lint.per-file-ignores]
60
+ "tests/**" = ["D"]
61
+
62
+ [tool.ruff.lint.isort]
63
+ combine-as-imports = true
64
+ known-first-party = ["traderworkbench"]
65
+
66
+ [tool.ruff.lint.pydocstyle]
67
+ # Explicitly enforce Google-style docstrings instead of PEP 257 standard.
68
+ convention = "google"