flet-storage 0.1.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.
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026 Andrii Bogdanovych
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-storage
3
+ Version: 0.1.2
4
+ Summary: A lightweight utility for simplified client-side storage management in Flet applications.
5
+ Author-email: Andrii Bogdanovych <a@bogdanovych.org>
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/BogdanovychA/flet-storage.git
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: flet>=0.80.2
15
+ Dynamic: license-file
16
+
17
+ # Flet Storage
18
+
19
+ A lightweight, asynchronous utility for simplified client-side storage management in [Flet](https://flet.dev) applications.
20
+
21
+ This package provides a clean wrapper around Flet's `SharedPreferences`, adding automatic JSON serialization so you can store complex Python objects (dicts, lists) without manual conversion.
22
+
23
+ ## Features
24
+
25
+ - **Automatic JSON Serialization:** Store and retrieve dictionaries and lists directly.
26
+ - **Asynchronous API:** Built to work seamlessly with Flet's async architecture.
27
+ - **Namespaced Storage:** Easily organize data by `app_name` to avoid collisions.
28
+ - **Simplified Syntax:** Clean, functional approach to persistent data.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install flet-storage
@@ -0,0 +1,17 @@
1
+ # Flet Storage
2
+
3
+ A lightweight, asynchronous utility for simplified client-side storage management in [Flet](https://flet.dev) applications.
4
+
5
+ This package provides a clean wrapper around Flet's `SharedPreferences`, adding automatic JSON serialization so you can store complex Python objects (dicts, lists) without manual conversion.
6
+
7
+ ## Features
8
+
9
+ - **Automatic JSON Serialization:** Store and retrieve dictionaries and lists directly.
10
+ - **Asynchronous API:** Built to work seamlessly with Flet's async architecture.
11
+ - **Namespaced Storage:** Easily organize data by `app_name` to avoid collisions.
12
+ - **Simplified Syntax:** Clean, functional approach to persistent data.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install flet-storage
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "flet-storage"
7
+ version = "0.1.2"
8
+ authors = [
9
+ { name = "Andrii Bogdanovych", email = "a@bogdanovych.org" }
10
+ ]
11
+ description = "A lightweight utility for simplified client-side storage management in Flet applications."
12
+ readme = "README.md"
13
+ requires-python = ">=3.12"
14
+ dependencies = [
15
+ "flet>=0.80.2",
16
+ ]
17
+ license = {text = "MIT"}
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ ]
23
+
24
+ [project.urls]
25
+ Repository = "https://github.com/BogdanovychA/flet-storage.git"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .base import clear, list_keys, load, save
2
+
3
+ __all__ = ["save", "load", "clear", "list_keys"]
@@ -0,0 +1,60 @@
1
+ import json
2
+
3
+ import flet as ft
4
+
5
+
6
+ async def save(name: str, app_name: str, obj: object) -> None:
7
+ """
8
+ Saves a Python object to SharedPreferences after serializing it to JSON.
9
+
10
+ Args:
11
+ name (str): The specific key name for the data.
12
+ app_name (str): The namespace or prefix for your application to avoid key collisions.
13
+ obj (object): The Python object (dict, list, etc.) to be stored.
14
+
15
+ Example:
16
+ >>> await save("settings", "my_app", {"theme": "dark"})
17
+ """
18
+ name_obj = f"{app_name}.{name}"
19
+ obj_json = json.dumps(obj)
20
+
21
+ await ft.SharedPreferences().set(name_obj, obj_json)
22
+
23
+
24
+ async def load(name: str, app_name: str) -> object:
25
+ """
26
+ Loads a JSON string from SharedPreferences and deserializes it back into a Python object.
27
+
28
+ Args:
29
+ name (str): The specific key name of the data to retrieve.
30
+ app_name (str): The namespace or prefix used during saving.
31
+
32
+ Returns:
33
+ object: The deserialized Python object.
34
+
35
+ Note:
36
+ Raises json.JSONDecodeError if the stored data is not valid JSON.
37
+ """
38
+ obj_json = await ft.SharedPreferences().get(f"{app_name}.{name}")
39
+ obj = json.loads(obj_json)
40
+
41
+ return obj
42
+
43
+
44
+ async def clear() -> None:
45
+ """
46
+ Removes all stored keys and values from the application's SharedPreferences.
47
+
48
+ This operation is destructive and cannot be undone.
49
+ """
50
+ await ft.SharedPreferences().clear()
51
+
52
+
53
+ async def list_keys() -> None:
54
+ """
55
+ Prints a list of all existing keys in SharedPreferences to the console.
56
+
57
+ Useful for debugging and inspecting the current state of the local storage.
58
+ """
59
+ keys = await ft.SharedPreferences().get_keys("")
60
+ print(keys)
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-storage
3
+ Version: 0.1.2
4
+ Summary: A lightweight utility for simplified client-side storage management in Flet applications.
5
+ Author-email: Andrii Bogdanovych <a@bogdanovych.org>
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/BogdanovychA/flet-storage.git
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: flet>=0.80.2
15
+ Dynamic: license-file
16
+
17
+ # Flet Storage
18
+
19
+ A lightweight, asynchronous utility for simplified client-side storage management in [Flet](https://flet.dev) applications.
20
+
21
+ This package provides a clean wrapper around Flet's `SharedPreferences`, adding automatic JSON serialization so you can store complex Python objects (dicts, lists) without manual conversion.
22
+
23
+ ## Features
24
+
25
+ - **Automatic JSON Serialization:** Store and retrieve dictionaries and lists directly.
26
+ - **Asynchronous API:** Built to work seamlessly with Flet's async architecture.
27
+ - **Namespaced Storage:** Easily organize data by `app_name` to avoid collisions.
28
+ - **Simplified Syntax:** Clean, functional approach to persistent data.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install flet-storage
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/flet_storage/__init__.py
5
+ src/flet_storage/base.py
6
+ src/flet_storage.egg-info/PKG-INFO
7
+ src/flet_storage.egg-info/SOURCES.txt
8
+ src/flet_storage.egg-info/dependency_links.txt
9
+ src/flet_storage.egg-info/requires.txt
10
+ src/flet_storage.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ flet>=0.80.2
@@ -0,0 +1 @@
1
+ flet_storage