pydantic-gui-settings-editor 1.0.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.
- pydantic_gui_settings_editor-1.0.0/PKG-INFO +87 -0
- pydantic_gui_settings_editor-1.0.0/README.md +52 -0
- pydantic_gui_settings_editor-1.0.0/UNLICENSE +24 -0
- pydantic_gui_settings_editor-1.0.0/pyproject.toml +96 -0
- pydantic_gui_settings_editor-1.0.0/pyproject.toml.orig +95 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/__init__.py +10 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/config.py +59 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/gui.py +934 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/manager.py +327 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/py.typed +0 -0
- pydantic_gui_settings_editor-1.0.0/src/pydantic_gui_settings_editor/types.py +23 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: pydantic-gui-settings-editor
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A PySide6 / Qt based GUI editor for Pydantic(v2) settings models
|
|
5
|
+
Author: TheTimebreaker
|
|
6
|
+
Author-email: TheTimebreaker <github@thetimebreaker.mozmail.com>
|
|
7
|
+
License: This is free and unencumbered software released into the public domain.
|
|
8
|
+
|
|
9
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
10
|
+
distribute this software, either in source code form or as a compiled
|
|
11
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
12
|
+
means.
|
|
13
|
+
|
|
14
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
15
|
+
of this software dedicate any and all copyright interest in the
|
|
16
|
+
software to the public domain. We make this dedication for the benefit
|
|
17
|
+
of the public at large and to the detriment of our heirs and
|
|
18
|
+
successors. We intend this dedication to be an overt act of
|
|
19
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
20
|
+
software under copyright law.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
23
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
24
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
25
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
26
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
27
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
28
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
For more information, please refer to <https://unlicense.org/>
|
|
31
|
+
Requires-Dist: pydantic>=2.13.5
|
|
32
|
+
Requires-Dist: pyside6>=6.11.2
|
|
33
|
+
Requires-Python: >=3.12
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Pydantic GUI settings editor
|
|
37
|
+
A PySide6 / Qt based GUI editor for Pydantic(v2) settings models.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
Have you worked on a python project and wanted to add user settings and/or customizability?
|
|
42
|
+
|
|
43
|
+
Everyone LOVES being able to tinker an app to ones own liking. But just dumping a config file somewhere is also not ideal. Documentation on the settings may be hard to find and not all users even want to tinker directly with the config files. And then theres no guarantee of the user inputs actually working as intended.
|
|
44
|
+
|
|
45
|
+
This project aims to give developers the tools needed to
|
|
46
|
+
|
|
47
|
+
- (A) create settings that are verifiably valid, using `Pydantic` models
|
|
48
|
+
- (B) create a graphical way for users to securely interact with settings
|
|
49
|
+
- (C) without having to create the GUI manually, which is difficult to change later
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- Edit `Pydantic` models through a automatically generated GUI based on said model
|
|
54
|
+
- Nest your settings however deep your heart desires
|
|
55
|
+
- Settings will always be validated through pydantic
|
|
56
|
+
- A beautiful interface made with `PySide6 / Qt`
|
|
57
|
+
- Light and Dark modes out of the box
|
|
58
|
+
- Add descriptions and titles in your `Pydantic` model, which will automatically appear in the GUI to document your settings right where the user needs them
|
|
59
|
+
|
|
60
|
+
## Currently supported field types
|
|
61
|
+
|
|
62
|
+
A `Pydantic` field should be defined as:
|
|
63
|
+
```python
|
|
64
|
+
setting: <typehint> = Field(
|
|
65
|
+
default=<default value>,
|
|
66
|
+
title=<Optional: title>,
|
|
67
|
+
description=<Optional: description>
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
The `title` and `description` field are strongly recommended, to get the most out of the documentation.
|
|
71
|
+
|
|
72
|
+
The following setting types are currently supported:
|
|
73
|
+
|
|
74
|
+
- `bool`
|
|
75
|
+
- `int` and `float`
|
|
76
|
+
- `str` and `set[str]`
|
|
77
|
+
- `Enum` and `set[Enum]`
|
|
78
|
+
- `pathlib.Path` and `set[pathlib.Path]`
|
|
79
|
+
- a special typehint for `FilePath`s and `DirectoryPath`s has been added to `pydantic_gui_settings_editor.types`, which you can import to specify a path to a file or a file to a path, while just type hinting a field as `Path` will allow any path.
|
|
80
|
+
- more (nested) `Pydantic` models
|
|
81
|
+
- `list[BaseModel]`
|
|
82
|
+
|
|
83
|
+
If there is a data type missing for your usecase, don't be afraid to create an issue on GitHub!
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
Currently, this project is unpublished on `PyPi`. Therefore, you have to install it directly from the releases tab.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Pydantic GUI settings editor
|
|
2
|
+
A PySide6 / Qt based GUI editor for Pydantic(v2) settings models.
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
Have you worked on a python project and wanted to add user settings and/or customizability?
|
|
7
|
+
|
|
8
|
+
Everyone LOVES being able to tinker an app to ones own liking. But just dumping a config file somewhere is also not ideal. Documentation on the settings may be hard to find and not all users even want to tinker directly with the config files. And then theres no guarantee of the user inputs actually working as intended.
|
|
9
|
+
|
|
10
|
+
This project aims to give developers the tools needed to
|
|
11
|
+
|
|
12
|
+
- (A) create settings that are verifiably valid, using `Pydantic` models
|
|
13
|
+
- (B) create a graphical way for users to securely interact with settings
|
|
14
|
+
- (C) without having to create the GUI manually, which is difficult to change later
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Edit `Pydantic` models through a automatically generated GUI based on said model
|
|
19
|
+
- Nest your settings however deep your heart desires
|
|
20
|
+
- Settings will always be validated through pydantic
|
|
21
|
+
- A beautiful interface made with `PySide6 / Qt`
|
|
22
|
+
- Light and Dark modes out of the box
|
|
23
|
+
- Add descriptions and titles in your `Pydantic` model, which will automatically appear in the GUI to document your settings right where the user needs them
|
|
24
|
+
|
|
25
|
+
## Currently supported field types
|
|
26
|
+
|
|
27
|
+
A `Pydantic` field should be defined as:
|
|
28
|
+
```python
|
|
29
|
+
setting: <typehint> = Field(
|
|
30
|
+
default=<default value>,
|
|
31
|
+
title=<Optional: title>,
|
|
32
|
+
description=<Optional: description>
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
The `title` and `description` field are strongly recommended, to get the most out of the documentation.
|
|
36
|
+
|
|
37
|
+
The following setting types are currently supported:
|
|
38
|
+
|
|
39
|
+
- `bool`
|
|
40
|
+
- `int` and `float`
|
|
41
|
+
- `str` and `set[str]`
|
|
42
|
+
- `Enum` and `set[Enum]`
|
|
43
|
+
- `pathlib.Path` and `set[pathlib.Path]`
|
|
44
|
+
- a special typehint for `FilePath`s and `DirectoryPath`s has been added to `pydantic_gui_settings_editor.types`, which you can import to specify a path to a file or a file to a path, while just type hinting a field as `Path` will allow any path.
|
|
45
|
+
- more (nested) `Pydantic` models
|
|
46
|
+
- `list[BaseModel]`
|
|
47
|
+
|
|
48
|
+
If there is a data type missing for your usecase, don't be afraid to create an issue on GitHub!
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Currently, this project is unpublished on `PyPi`. Therefore, you have to install it directly from the releases tab.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org/>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pydantic-gui-settings-editor"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "A PySide6 / Qt based GUI editor for Pydantic(v2) settings models"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pydantic>=2.13.5",
|
|
9
|
+
"pyside6>=6.11.2",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[project.license]
|
|
13
|
+
file = "UNLICENSE"
|
|
14
|
+
|
|
15
|
+
[[project.authors]]
|
|
16
|
+
name = "TheTimebreaker"
|
|
17
|
+
email = "github@thetimebreaker.mozmail.com"
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = [
|
|
21
|
+
"black>=26.5.1",
|
|
22
|
+
"jactionlint>=2.4.0",
|
|
23
|
+
"mypy>=2.3.1",
|
|
24
|
+
"pytest>=9.1.1",
|
|
25
|
+
"ruff>=0.16.9",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["uv_build>=0.12.4,<0.13.0"]
|
|
30
|
+
build-backend = "uv_build"
|
|
31
|
+
|
|
32
|
+
[tool.ruff]
|
|
33
|
+
line-length = 150
|
|
34
|
+
target-version = "py315"
|
|
35
|
+
exclude = [
|
|
36
|
+
".venv*",
|
|
37
|
+
"build",
|
|
38
|
+
"dist",
|
|
39
|
+
"__pycache__",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint]
|
|
43
|
+
select = [
|
|
44
|
+
"E",
|
|
45
|
+
"F",
|
|
46
|
+
"I",
|
|
47
|
+
"B",
|
|
48
|
+
"UP",
|
|
49
|
+
"N",
|
|
50
|
+
"ERA",
|
|
51
|
+
"ANN",
|
|
52
|
+
"ASYNC",
|
|
53
|
+
"FIX",
|
|
54
|
+
"ISC",
|
|
55
|
+
"ICN",
|
|
56
|
+
"G",
|
|
57
|
+
"INP",
|
|
58
|
+
"PIE",
|
|
59
|
+
"Q",
|
|
60
|
+
"TD",
|
|
61
|
+
"ARG",
|
|
62
|
+
"RUF",
|
|
63
|
+
]
|
|
64
|
+
extend-select = [
|
|
65
|
+
"N815",
|
|
66
|
+
"N816",
|
|
67
|
+
]
|
|
68
|
+
ignore = [
|
|
69
|
+
"ANN401",
|
|
70
|
+
"TD003",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.pylint.MASTER]
|
|
74
|
+
disable = ["all"]
|
|
75
|
+
|
|
76
|
+
[tool.black]
|
|
77
|
+
line-length = 150
|
|
78
|
+
target-version = ["py315"]
|
|
79
|
+
|
|
80
|
+
[tool.mypy]
|
|
81
|
+
python_version = "3.15"
|
|
82
|
+
disallow_untyped_calls = true
|
|
83
|
+
disallow_untyped_defs = true
|
|
84
|
+
disallow_incomplete_defs = true
|
|
85
|
+
disallow_any_generics = true
|
|
86
|
+
check_untyped_defs = true
|
|
87
|
+
warn_unused_ignores = true
|
|
88
|
+
warn_return_any = true
|
|
89
|
+
exclude = [".venv*"]
|
|
90
|
+
|
|
91
|
+
[[tool.mypy.overrides]]
|
|
92
|
+
module = []
|
|
93
|
+
ignore_missing_imports = true
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
pythonpath = ["tests"]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pydantic-gui-settings-editor"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "A PySide6 / Qt based GUI editor for Pydantic(v2) settings models"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { file = "UNLICENSE" }
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "TheTimebreaker", email = "github@thetimebreaker.mozmail.com" }
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"pydantic>=2.13.5",
|
|
13
|
+
"pyside6>=6.11.2",
|
|
14
|
+
]
|
|
15
|
+
[dependency-groups]
|
|
16
|
+
dev = [
|
|
17
|
+
"black>=26.5.1",
|
|
18
|
+
"jactionlint>=2.4.0",
|
|
19
|
+
"mypy>=2.3.1",
|
|
20
|
+
"pytest>=9.1.1",
|
|
21
|
+
"ruff>=0.16.9",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["uv_build>=0.12.4,<0.13.0"]
|
|
27
|
+
build-backend = "uv_build"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
[tool.ruff]
|
|
31
|
+
line-length = 150
|
|
32
|
+
target-version = "py315"
|
|
33
|
+
|
|
34
|
+
exclude = [
|
|
35
|
+
".venv*",
|
|
36
|
+
"build",
|
|
37
|
+
"dist",
|
|
38
|
+
"__pycache__",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.ruff.lint]
|
|
42
|
+
select = [
|
|
43
|
+
"E", # pycodestyle (errors)
|
|
44
|
+
"F", # pyflakes
|
|
45
|
+
"I", # isort (import sorting)
|
|
46
|
+
"B", # flake8-bugbear (extra checks for likely bugs)
|
|
47
|
+
"UP", # pyupgrade (modern Python syntax suggestions)
|
|
48
|
+
"N", # pep8-naming
|
|
49
|
+
"ERA", # Mark commented out code
|
|
50
|
+
"ANN", # Some type annotations
|
|
51
|
+
"ASYNC", # Async checks
|
|
52
|
+
"FIX",
|
|
53
|
+
"ISC", # implicit str concat
|
|
54
|
+
"ICN", # import conventions
|
|
55
|
+
"G", #Logging format
|
|
56
|
+
"INP", #implicit-no-pep420
|
|
57
|
+
"PIE",
|
|
58
|
+
"Q", #flake8-quotes
|
|
59
|
+
"TD", #TODOs,
|
|
60
|
+
"ARG", #Unused args
|
|
61
|
+
"RUF", #Ruff specifics
|
|
62
|
+
]
|
|
63
|
+
extend-select = ["N815", "N816"]
|
|
64
|
+
|
|
65
|
+
ignore = [
|
|
66
|
+
"ANN401", #allow type:Any
|
|
67
|
+
"TD003", #Missing issue link for TODO
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.pylint."MASTER"]
|
|
71
|
+
disable = ["all"]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
[tool.black]
|
|
75
|
+
line-length = 150
|
|
76
|
+
target-version = ["py315"]
|
|
77
|
+
|
|
78
|
+
[tool.mypy]
|
|
79
|
+
python_version = "3.15"
|
|
80
|
+
disallow_untyped_calls = true
|
|
81
|
+
disallow_untyped_defs = true
|
|
82
|
+
disallow_incomplete_defs = true
|
|
83
|
+
disallow_any_generics = true
|
|
84
|
+
check_untyped_defs = true
|
|
85
|
+
warn_unused_ignores = true
|
|
86
|
+
warn_return_any = true
|
|
87
|
+
exclude = [".venv*"]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
[[tool.mypy.overrides]]
|
|
91
|
+
module = []
|
|
92
|
+
ignore_missing_imports = true
|
|
93
|
+
|
|
94
|
+
[tool.pytest.ini_options]
|
|
95
|
+
pythonpath = ["tests"]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
__lazy_modules__ = ["pydantic"]
|
|
2
|
+
|
|
3
|
+
from enum import StrEnum
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Theme(StrEnum):
|
|
10
|
+
"""This enum lets you define a theme for the application."""
|
|
11
|
+
|
|
12
|
+
SYSTEM = "system"
|
|
13
|
+
LIGHT = "light"
|
|
14
|
+
DARK = "dark"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Encoding(StrEnum):
|
|
18
|
+
"""This enum lets you choose the encoding used for the on-disk settings file."""
|
|
19
|
+
|
|
20
|
+
UTF8 = "utf-8"
|
|
21
|
+
UTF16 = "utf-16"
|
|
22
|
+
ASCII = "ascii"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ConfigCollapeNestedSettings(StrEnum):
|
|
26
|
+
DISABLED = "disabled"
|
|
27
|
+
"""Disables collapsing nested settings entirely."""
|
|
28
|
+
ENABLED_COLLAPSED = "start collapsed"
|
|
29
|
+
"""Enables collapsing nested settings and starts all nested sections collapsed."""
|
|
30
|
+
ENABLED_EXPANDED = "start expanded"
|
|
31
|
+
"""Enables collapsing nested settings and starts all nested sections expanded."""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class SettingsManagerConfig(BaseModel):
|
|
35
|
+
"""This class configures a SettingsManager instance."""
|
|
36
|
+
|
|
37
|
+
title: str = "Settings Editor"
|
|
38
|
+
"""Title displayed in the settings window."""
|
|
39
|
+
|
|
40
|
+
theme: Theme = Theme.SYSTEM
|
|
41
|
+
"""Color scheme used by the application."""
|
|
42
|
+
|
|
43
|
+
collapsed_nested_settings: ConfigCollapeNestedSettings = ConfigCollapeNestedSettings.ENABLED_EXPANDED
|
|
44
|
+
"""Controls nested settings to be collapsable."""
|
|
45
|
+
|
|
46
|
+
create_backup: bool = True
|
|
47
|
+
"""Flag that forces a backup file to be created before changes are written to disk."""
|
|
48
|
+
|
|
49
|
+
enable_tooltips: bool = True
|
|
50
|
+
"""Flag that will show the description of a field as a tooltip, when hovering over it in the GUI."""
|
|
51
|
+
|
|
52
|
+
encoding: Encoding = Encoding.UTF8
|
|
53
|
+
"""Encoding used for the stored settings files."""
|
|
54
|
+
|
|
55
|
+
icon_path: Path | None = None
|
|
56
|
+
"""Path to the image file used for the settings window icon and the taskbar icon."""
|
|
57
|
+
|
|
58
|
+
float_precision: int = Field(default=15, ge=0, le=15)
|
|
59
|
+
"""Precision of floating point numbers. If a float has more digits than this value, it will come back rounded."""
|