diskstore 0.3.1__tar.gz → 0.4.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.
- diskstore-0.4.0/LICENSE.txt +29 -0
- {diskstore-0.3.1 → diskstore-0.4.0}/PKG-INFO +8 -15
- {diskstore-0.3.1 → diskstore-0.4.0}/README.md +4 -13
- diskstore-0.4.0/pyproject.toml +80 -0
- diskstore-0.3.1/pyproject.toml → diskstore-0.4.0/pyproject.toml.orig +6 -3
- {diskstore-0.3.1 → diskstore-0.4.0}/src/diskstore/config.py +28 -0
- {diskstore-0.3.1 → diskstore-0.4.0}/src/diskstore/diskstore.py +2 -2
- {diskstore-0.3.1 → diskstore-0.4.0}/src/diskstore/__init__.py +0 -0
- {diskstore-0.3.1 → diskstore-0.4.0}/src/diskstore/const.py +0 -0
- {diskstore-0.3.1 → diskstore-0.4.0}/src/diskstore/diskread.py +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Wolfgang Langner
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: diskstore
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Simple MutableMapping compatible SQLite based disk storage.
|
|
5
5
|
Author: tds333
|
|
6
6
|
Author-email: tds333 <tds333@mailbox.org>
|
|
7
|
+
License-Expression: BSD-3-Clause
|
|
8
|
+
License-File: LICENSE.txt
|
|
7
9
|
Requires-Dist: apsw>=3.51.3
|
|
8
10
|
Requires-Python: >=3.10
|
|
9
11
|
Description-Content-Type: text/markdown
|
|
10
12
|
|
|
11
13
|
# DiskStore Sqlite based disk store
|
|
12
14
|
|
|
13
|
-
`DiskStore` is
|
|
15
|
+
`DiskStore` is a BSD-3-Clause licensed disk storage library, written
|
|
14
16
|
in pure Python.
|
|
15
17
|
|
|
16
18
|
Inspired by DiskCache library it implements a MutableMapping compatible sqlite
|
|
@@ -85,16 +87,7 @@ faster sqlite library apsw with up to date sqlite library version.
|
|
|
85
87
|
License
|
|
86
88
|
-------
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Licensed under the Apache License, Version 2.0 (the "License") or MIT; you may not use
|
|
91
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
92
|
-
License at
|
|
90
|
+
`DiskStore` is distributed under the terms of the
|
|
91
|
+
[BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) license.
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
https://mit-license.org/
|
|
96
|
-
|
|
97
|
-
Unless required by applicable law or agreed to in writing, software distributed
|
|
98
|
-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
99
|
-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
100
|
-
specific language governing permissions and limitations under the License.
|
|
93
|
+
Copyright 2025-2026 Wolfgang Langner
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DiskStore Sqlite based disk store
|
|
2
2
|
|
|
3
|
-
`DiskStore` is
|
|
3
|
+
`DiskStore` is a BSD-3-Clause licensed disk storage library, written
|
|
4
4
|
in pure Python.
|
|
5
5
|
|
|
6
6
|
Inspired by DiskCache library it implements a MutableMapping compatible sqlite
|
|
@@ -75,16 +75,7 @@ faster sqlite library apsw with up to date sqlite library version.
|
|
|
75
75
|
License
|
|
76
76
|
-------
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Licensed under the Apache License, Version 2.0 (the "License") or MIT; you may not use
|
|
81
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
82
|
-
License at
|
|
78
|
+
`DiskStore` is distributed under the terms of the
|
|
79
|
+
[BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) license.
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
https://mit-license.org/
|
|
86
|
-
|
|
87
|
-
Unless required by applicable law or agreed to in writing, software distributed
|
|
88
|
-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
89
|
-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
90
|
-
specific language governing permissions and limitations under the License.
|
|
81
|
+
Copyright 2025-2026 Wolfgang Langner
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "diskstore"
|
|
3
|
+
version = "0.4.0"
|
|
4
|
+
description = "Simple MutableMapping compatible SQLite based disk storage."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
license-files = ["LICENSE.txt"]
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
dependencies = ["apsw>=3.51.3"]
|
|
10
|
+
|
|
11
|
+
[[project.authors]]
|
|
12
|
+
name = "tds333"
|
|
13
|
+
email = "tds333@mailbox.org"
|
|
14
|
+
|
|
15
|
+
[dependency-groups]
|
|
16
|
+
dev = [
|
|
17
|
+
"msgspec>=0.20.0",
|
|
18
|
+
"pydantic>=2.12.5,<=2.99.99b0",
|
|
19
|
+
"pytest",
|
|
20
|
+
"pytest-asyncio>=1.3.0",
|
|
21
|
+
"pytest-cov",
|
|
22
|
+
"pytest-examples>=0.0.18",
|
|
23
|
+
"pytest-xdist",
|
|
24
|
+
"structtype>=0.8.1",
|
|
25
|
+
]
|
|
26
|
+
docs = [
|
|
27
|
+
"mkdocstrings[python]>=1.0.3",
|
|
28
|
+
"zensical>=0.0.23",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["uv_build>=0.9.2,<1"]
|
|
33
|
+
build-backend = "uv_build"
|
|
34
|
+
|
|
35
|
+
[tool.coverage.run]
|
|
36
|
+
parallel = true
|
|
37
|
+
branch = true
|
|
38
|
+
source = ["diskstore"]
|
|
39
|
+
|
|
40
|
+
[tool.coverage.report]
|
|
41
|
+
show_missing = true
|
|
42
|
+
skip_covered = true
|
|
43
|
+
exclude_lines = [
|
|
44
|
+
"no cov",
|
|
45
|
+
"if __name__ == .__main__.:",
|
|
46
|
+
"if TYPE_CHECKING:",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.pytest]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
exclude = [
|
|
54
|
+
".env",
|
|
55
|
+
".venv",
|
|
56
|
+
"venv",
|
|
57
|
+
]
|
|
58
|
+
line-length = 88
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint]
|
|
61
|
+
select = [
|
|
62
|
+
"E",
|
|
63
|
+
"W",
|
|
64
|
+
"F",
|
|
65
|
+
"I",
|
|
66
|
+
"C",
|
|
67
|
+
"B",
|
|
68
|
+
"PT",
|
|
69
|
+
"N",
|
|
70
|
+
"PL",
|
|
71
|
+
"RUF",
|
|
72
|
+
]
|
|
73
|
+
ignore = [
|
|
74
|
+
"B008",
|
|
75
|
+
"C901",
|
|
76
|
+
"RET504",
|
|
77
|
+
"PLR2004",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.uv]
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "diskstore"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Simple MutableMapping compatible SQLite based disk storage."
|
|
5
5
|
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
license-files = ["LICENSE.txt"]
|
|
6
8
|
requires-python = ">=3.10"
|
|
7
9
|
authors = [{ name = "tds333", email = "tds333@mailbox.org" }]
|
|
8
10
|
dependencies = ["apsw>=3.51.3"]
|
|
@@ -15,7 +17,8 @@ dev = [
|
|
|
15
17
|
"pytest-asyncio>=1.3.0",
|
|
16
18
|
"pytest-cov",
|
|
17
19
|
"pytest-examples>=0.0.18",
|
|
18
|
-
"pytest-xdist"
|
|
20
|
+
"pytest-xdist",
|
|
21
|
+
"structtype>=0.8.1",
|
|
19
22
|
]
|
|
20
23
|
docs = [
|
|
21
24
|
"mkdocstrings[python]>=1.0.3",
|
|
@@ -67,4 +70,4 @@ ignore = [
|
|
|
67
70
|
]
|
|
68
71
|
|
|
69
72
|
[tool.uv]
|
|
70
|
-
exclude-newer = "1 days"
|
|
73
|
+
#exclude-newer = "1 days"
|
|
@@ -245,3 +245,31 @@ class PydanticConfig(BaseConfig):
|
|
|
245
245
|
|
|
246
246
|
def load_data(self, data: tuple) -> Any:
|
|
247
247
|
return self.model.model_validate_json(data[1])
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class StructtypeConfig(BaseConfig):
|
|
251
|
+
def __init__( # noqa: PLR0913, PLR0917
|
|
252
|
+
self,
|
|
253
|
+
struct,
|
|
254
|
+
tablename=None,
|
|
255
|
+
key_type=None,
|
|
256
|
+
timeout=None,
|
|
257
|
+
pragmas=None,
|
|
258
|
+
auto_migrate=None,
|
|
259
|
+
):
|
|
260
|
+
tablename = struct.__name__ if not tablename else tablename
|
|
261
|
+
super().__init__(
|
|
262
|
+
tablename=tablename,
|
|
263
|
+
key_type=key_type,
|
|
264
|
+
timeout=timeout,
|
|
265
|
+
pragmas=pragmas,
|
|
266
|
+
auto_migrate=auto_migrate,
|
|
267
|
+
)
|
|
268
|
+
self.fields = (("value", "BLOB", NO_DEFAULT),)
|
|
269
|
+
self.struct = struct
|
|
270
|
+
|
|
271
|
+
def dump_value(self, key: KeyType | None, value: Any) -> Sequence:
|
|
272
|
+
return (key, value.struct_dump_json())
|
|
273
|
+
|
|
274
|
+
def load_data(self, data: tuple) -> Any:
|
|
275
|
+
return self.struct.struct_validate_json(data[1])
|
|
@@ -97,7 +97,7 @@ class DiskStore(DiskRead, MutableMapping):
|
|
|
97
97
|
# apply them all on fresh connection
|
|
98
98
|
for key, value in self._pragmas.items():
|
|
99
99
|
con.pragma(key, value)
|
|
100
|
-
self.
|
|
100
|
+
self._migrate_table(con, self._config)
|
|
101
101
|
self._local.con = con
|
|
102
102
|
|
|
103
103
|
return con
|
|
@@ -117,7 +117,7 @@ class DiskStore(DiskRead, MutableMapping):
|
|
|
117
117
|
return field_create
|
|
118
118
|
|
|
119
119
|
@staticmethod
|
|
120
|
-
def
|
|
120
|
+
def _migrate_table(con: Connection, config: ConfigProtocol) -> None:
|
|
121
121
|
"""Ensure the table exists, optionally migrating to match config.fields.
|
|
122
122
|
|
|
123
123
|
If the table does not exist it is created from *config*. If
|
|
File without changes
|
|
File without changes
|
|
File without changes
|