config-cli-gui 0.3.0__tar.gz → 0.3.1__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.
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/HISTORY.md +9 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/PKG-INFO +23 -1
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/README.md +22 -0
- config_cli_gui-0.3.1/docs/_static/img/settings_dlg.png +0 -0
- config_cli_gui-0.3.1/docs/_static/img/settings_doc.png +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/index.md +22 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/_version.py +3 -3
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/cli.py +2 -2
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/config.py +5 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/configtypes/font.py +28 -9
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/PKG-INFO +23 -1
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/SOURCES.txt +2 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/test_cli.py +18 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/FUNDING.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/actions/setup-environment/action.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/dependabot.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/init.sh +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/release_message.sh +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/update_funding.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/workflows/main.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/workflows/release.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.github/workflows/update_readme.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.gitignore +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.idea/runConfigurations/config_generate.xml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.idea/runConfigurations/example_project_cli.xml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.idea/runConfigurations/example_project_gui.xml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.pre-commit-config.yaml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.readthedocs.yaml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/LICENSE +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/Makefile +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/config.yaml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/.nav.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/_static/img/favicon.png +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/_static/img/logo.png +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/css/custom.css +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/develop/contributing.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/develop/make_windows.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/develop/naming_convention.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/funding/funding.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/getting-started/install.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/getting-started/virtual-environment.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/usage/cli.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/docs/usage/config.md +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/mkdocs.yml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/pyproject.toml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/scripts/show_filelist.ps1 +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/scripts/show_tree.ps1 +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/scripts/show_tree.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/scripts/update_readme.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/setup.cfg +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/configtypes/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/configtypes/color.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/configtypes/vector.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/docs.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/gui.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui/logging.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/dependency_links.txt +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/entry_points.txt +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/requires.txt +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/top_level.txt +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/template.yml.url +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/__main__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/cli/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/cli/__main__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/cli/cli_example.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/config/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/config/config_example.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/core/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/core/base.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/example.gpx +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/gui/__init__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/gui/__main__.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/gui/config.yaml +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/gui/gui_example.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/test_config_manager.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/test_docs.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/test_generic_cli.py +0 -0
- {config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/uv.lock +0 -0
|
@@ -4,6 +4,15 @@ Changelog
|
|
|
4
4
|
|
|
5
5
|
(unreleased)
|
|
6
6
|
------------
|
|
7
|
+
- Fix typings, improve cli test. [Paul Magister]
|
|
8
|
+
- Update README.md from docs/index.md. [github-actions]
|
|
9
|
+
- Improve doc. [Paul Magister]
|
|
10
|
+
- Search for some more paths in windows. [Paul Magister]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
0.3.0 (2025-12-03)
|
|
14
|
+
------------------
|
|
15
|
+
- Docs: Update HISTORY.md for release 0.3.0. [Paul Magister]
|
|
7
16
|
- Docs: Update HISTORY.md for release 0.2.9. [Paul Magister]
|
|
8
17
|
- Refactoring: config parameters will stay ordered like in the config.
|
|
9
18
|
[Paul Magister]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: config-cli-gui
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Feature-rich Python project template for config-cli-gui.
|
|
5
5
|
Author: pamagister
|
|
6
6
|
Requires-Python: <3.12,>=3.10
|
|
@@ -63,11 +63,33 @@ pip install config-cli-gui
|
|
|
63
63
|
## ✨ Features
|
|
64
64
|
|
|
65
65
|
* **Single Source of Truth**: Define all your application parameters in one place using simple, dataclass-like structures based on Pydantic's `BaseModel`. This ensures consistency and reduces errors across your application.
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
gui:
|
|
69
|
+
# GUI theme setting | type=str | choices=['light', 'dark', 'auto']
|
|
70
|
+
theme: light
|
|
71
|
+
misc:
|
|
72
|
+
# Example integer | type=int
|
|
73
|
+
some_numeric: 42
|
|
74
|
+
# Path to the file to use | type=PosixPath
|
|
75
|
+
some_file: some_file.txt
|
|
76
|
+
# Color setting for the application | type=Color
|
|
77
|
+
some_color: '#ff0000'
|
|
78
|
+
# Font setting for the application | type=Font
|
|
79
|
+
some_font: 'DejaVuSans.ttf, 12, #0000ff'
|
|
80
|
+
```
|
|
81
|
+
|
|
66
82
|
* **Categorized Configuration**: Organize your parameters into logical categories (e.g., `cli`, `app`, `gui`) for better structure and maintainability.
|
|
67
83
|
* **Dynamic CLI Generation**: Automatically generate `argparse`-compatible command-line arguments directly from your defined configuration parameters, including help texts, types, and choices.
|
|
68
84
|
* **Config File Management**: Easily load and save configurations from/to YAML or JSON files, allowing users to customize default settings.
|
|
69
85
|
* **GUI Settings Dialogs**: Dynamically create Tkinter-based settings dialogs for your application, allowing users to intuitively modify configuration parameters via a graphical interface.
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
70
89
|
* **Documentation Generation**: Generate detailed Markdown documentation for both your CLI options and all configuration parameters, keeping your user guides always up-to-date with your codebase.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
71
93
|
* **Override System**: Supports robust overriding of configuration values via configuration files and command-line arguments, with clear precedence.
|
|
72
94
|
|
|
73
95
|
---
|
|
@@ -35,11 +35,33 @@ pip install config-cli-gui
|
|
|
35
35
|
## ✨ Features
|
|
36
36
|
|
|
37
37
|
* **Single Source of Truth**: Define all your application parameters in one place using simple, dataclass-like structures based on Pydantic's `BaseModel`. This ensures consistency and reduces errors across your application.
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
gui:
|
|
41
|
+
# GUI theme setting | type=str | choices=['light', 'dark', 'auto']
|
|
42
|
+
theme: light
|
|
43
|
+
misc:
|
|
44
|
+
# Example integer | type=int
|
|
45
|
+
some_numeric: 42
|
|
46
|
+
# Path to the file to use | type=PosixPath
|
|
47
|
+
some_file: some_file.txt
|
|
48
|
+
# Color setting for the application | type=Color
|
|
49
|
+
some_color: '#ff0000'
|
|
50
|
+
# Font setting for the application | type=Font
|
|
51
|
+
some_font: 'DejaVuSans.ttf, 12, #0000ff'
|
|
52
|
+
```
|
|
53
|
+
|
|
38
54
|
* **Categorized Configuration**: Organize your parameters into logical categories (e.g., `cli`, `app`, `gui`) for better structure and maintainability.
|
|
39
55
|
* **Dynamic CLI Generation**: Automatically generate `argparse`-compatible command-line arguments directly from your defined configuration parameters, including help texts, types, and choices.
|
|
40
56
|
* **Config File Management**: Easily load and save configurations from/to YAML or JSON files, allowing users to customize default settings.
|
|
41
57
|
* **GUI Settings Dialogs**: Dynamically create Tkinter-based settings dialogs for your application, allowing users to intuitively modify configuration parameters via a graphical interface.
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
42
61
|
* **Documentation Generation**: Generate detailed Markdown documentation for both your CLI options and all configuration parameters, keeping your user guides always up-to-date with your codebase.
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
43
65
|
* **Override System**: Supports robust overriding of configuration values via configuration files and command-line arguments, with clear precedence.
|
|
44
66
|
|
|
45
67
|
---
|
|
Binary file
|
|
Binary file
|
|
@@ -33,11 +33,33 @@ pip install config-cli-gui
|
|
|
33
33
|
## ✨ Features
|
|
34
34
|
|
|
35
35
|
* **Single Source of Truth**: Define all your application parameters in one place using simple, dataclass-like structures based on Pydantic's `BaseModel`. This ensures consistency and reduces errors across your application.
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
gui:
|
|
39
|
+
# GUI theme setting | type=str | choices=['light', 'dark', 'auto']
|
|
40
|
+
theme: light
|
|
41
|
+
misc:
|
|
42
|
+
# Example integer | type=int
|
|
43
|
+
some_numeric: 42
|
|
44
|
+
# Path to the file to use | type=PosixPath
|
|
45
|
+
some_file: some_file.txt
|
|
46
|
+
# Color setting for the application | type=Color
|
|
47
|
+
some_color: '#ff0000'
|
|
48
|
+
# Font setting for the application | type=Font
|
|
49
|
+
some_font: 'DejaVuSans.ttf, 12, #0000ff'
|
|
50
|
+
```
|
|
51
|
+
|
|
36
52
|
* **Categorized Configuration**: Organize your parameters into logical categories (e.g., `cli`, `app`, `gui`) for better structure and maintainability.
|
|
37
53
|
* **Dynamic CLI Generation**: Automatically generate `argparse`-compatible command-line arguments directly from your defined configuration parameters, including help texts, types, and choices.
|
|
38
54
|
* **Config File Management**: Easily load and save configurations from/to YAML or JSON files, allowing users to customize default settings.
|
|
39
55
|
* **GUI Settings Dialogs**: Dynamically create Tkinter-based settings dialogs for your application, allowing users to intuitively modify configuration parameters via a graphical interface.
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
40
59
|
* **Documentation Generation**: Generate detailed Markdown documentation for both your CLI options and all configuration parameters, keeping your user guides always up-to-date with your codebase.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
41
63
|
* **Override System**: Supports robust overriding of configuration values via configuration files and command-line arguments, with clear precedence.
|
|
42
64
|
|
|
43
65
|
---
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.3.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 3,
|
|
31
|
+
__version__ = version = '0.3.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 3, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g32c96636f'
|
|
@@ -62,7 +62,7 @@ class CliGenerator:
|
|
|
62
62
|
continue
|
|
63
63
|
|
|
64
64
|
# OPTIONAL FLAG
|
|
65
|
-
kwargs = {
|
|
65
|
+
kwargs: dict[str, Any] = {
|
|
66
66
|
"help": f"{p.help} (default: {p.value})",
|
|
67
67
|
"default": argparse.SUPPRESS,
|
|
68
68
|
}
|
|
@@ -117,7 +117,7 @@ class CliGenerator:
|
|
|
117
117
|
|
|
118
118
|
# Load config_file only ONCE
|
|
119
119
|
config = ConfigManager(
|
|
120
|
-
categories=
|
|
120
|
+
categories=self.config_manager.get_categories(),
|
|
121
121
|
config_file=getattr(args, "config", None),
|
|
122
122
|
)
|
|
123
123
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from pathlib import Path
|
|
@@ -134,6 +135,10 @@ class ConfigManager:
|
|
|
134
135
|
"""Retrieve a category by name."""
|
|
135
136
|
return self._categories.get(name)
|
|
136
137
|
|
|
138
|
+
def get_categories(self) -> tuple[ConfigCategory, ...]:
|
|
139
|
+
values: Iterable[ConfigCategory] = self._categories.values()
|
|
140
|
+
return tuple(values)
|
|
141
|
+
|
|
137
142
|
def apply_overrides(self, overrides: dict[str, Any]) -> None:
|
|
138
143
|
"""Apply keyword overrides in the format `category__param=value`."""
|
|
139
144
|
for key, value in overrides.items():
|
|
@@ -8,22 +8,36 @@ from config_cli_gui.configtypes.color import Color
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def list_system_fonts() -> list[str]:
|
|
11
|
+
# Common font directories on Linux, macOS, Windows
|
|
11
12
|
font_dirs = [
|
|
13
|
+
# Linux
|
|
12
14
|
"/usr/share/fonts",
|
|
13
15
|
"/usr/local/share/fonts",
|
|
14
16
|
str(Path.home() / ".fonts"),
|
|
17
|
+
str(Path.home() / ".local/share/fonts"),
|
|
18
|
+
# macOS system + user
|
|
15
19
|
"/Library/Fonts",
|
|
16
20
|
"/System/Library/Fonts",
|
|
21
|
+
str(Path.home() / "Library/Fonts"),
|
|
22
|
+
"/Network/Library/Fonts",
|
|
23
|
+
# Windows system + user-scoped installed fonts
|
|
17
24
|
"C:/Windows/Fonts",
|
|
25
|
+
str(Path(os.environ.get("LOCALAPPDATA", "") + "/Microsoft/Windows/Fonts")),
|
|
18
26
|
]
|
|
19
27
|
|
|
20
28
|
fonts: list[str] = []
|
|
29
|
+
seen = set() # Prevent duplicates
|
|
30
|
+
|
|
21
31
|
for d in font_dirs:
|
|
22
|
-
if os.path.isdir(d):
|
|
32
|
+
if d and os.path.isdir(d):
|
|
23
33
|
for root, _, files in os.walk(d):
|
|
24
34
|
for f in files:
|
|
25
|
-
if f.lower().endswith((".ttf", ".otf")):
|
|
26
|
-
|
|
35
|
+
if f.lower().endswith((".ttf", ".otf", ".ttc", ".woff", ".woff2")):
|
|
36
|
+
full = os.path.join(root, f)
|
|
37
|
+
if full not in seen:
|
|
38
|
+
seen.add(full)
|
|
39
|
+
fonts.append(full)
|
|
40
|
+
|
|
27
41
|
return fonts
|
|
28
42
|
|
|
29
43
|
|
|
@@ -95,17 +109,22 @@ class Font:
|
|
|
95
109
|
:param dpi: if dpi is provided, the font size is re-calculated on base of the dpi
|
|
96
110
|
:return:
|
|
97
111
|
"""
|
|
112
|
+
size = self.size * dpi / 25.4
|
|
98
113
|
try:
|
|
99
114
|
if self.name in self.font_names:
|
|
100
115
|
idx = self.font_names.index(self.name)
|
|
101
116
|
path = self.font_files_sorted[idx]
|
|
102
|
-
|
|
103
|
-
return ImageFont.truetype(path, size)
|
|
117
|
+
return ImageFont.truetype(font=path, size=size)
|
|
104
118
|
except Exception as e:
|
|
105
|
-
print(f"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
print(f"Error loading font '{self.name}': {e}")
|
|
120
|
+
fallback_font = "Arial.ttf"
|
|
121
|
+
try:
|
|
122
|
+
return ImageFont.truetype(font=fallback_font, size=size)
|
|
123
|
+
except Exception as e:
|
|
124
|
+
print(f"Error loading default fallback font '{fallback_font}': {e}")
|
|
125
|
+
|
|
126
|
+
print("Fallback: use Default-Font.")
|
|
127
|
+
return ImageFont.load_default(size=size)
|
|
109
128
|
|
|
110
129
|
def __repr__(self) -> str:
|
|
111
130
|
return f"Font(type='{self.name}', size={self.size}, color={self.color!r})"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: config-cli-gui
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Feature-rich Python project template for config-cli-gui.
|
|
5
5
|
Author: pamagister
|
|
6
6
|
Requires-Python: <3.12,>=3.10
|
|
@@ -63,11 +63,33 @@ pip install config-cli-gui
|
|
|
63
63
|
## ✨ Features
|
|
64
64
|
|
|
65
65
|
* **Single Source of Truth**: Define all your application parameters in one place using simple, dataclass-like structures based on Pydantic's `BaseModel`. This ensures consistency and reduces errors across your application.
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
gui:
|
|
69
|
+
# GUI theme setting | type=str | choices=['light', 'dark', 'auto']
|
|
70
|
+
theme: light
|
|
71
|
+
misc:
|
|
72
|
+
# Example integer | type=int
|
|
73
|
+
some_numeric: 42
|
|
74
|
+
# Path to the file to use | type=PosixPath
|
|
75
|
+
some_file: some_file.txt
|
|
76
|
+
# Color setting for the application | type=Color
|
|
77
|
+
some_color: '#ff0000'
|
|
78
|
+
# Font setting for the application | type=Font
|
|
79
|
+
some_font: 'DejaVuSans.ttf, 12, #0000ff'
|
|
80
|
+
```
|
|
81
|
+
|
|
66
82
|
* **Categorized Configuration**: Organize your parameters into logical categories (e.g., `cli`, `app`, `gui`) for better structure and maintainability.
|
|
67
83
|
* **Dynamic CLI Generation**: Automatically generate `argparse`-compatible command-line arguments directly from your defined configuration parameters, including help texts, types, and choices.
|
|
68
84
|
* **Config File Management**: Easily load and save configurations from/to YAML or JSON files, allowing users to customize default settings.
|
|
69
85
|
* **GUI Settings Dialogs**: Dynamically create Tkinter-based settings dialogs for your application, allowing users to intuitively modify configuration parameters via a graphical interface.
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
70
89
|
* **Documentation Generation**: Generate detailed Markdown documentation for both your CLI options and all configuration parameters, keeping your user guides always up-to-date with your codebase.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
71
93
|
* **Override System**: Supports robust overriding of configuration values via configuration files and command-line arguments, with clear precedence.
|
|
72
94
|
|
|
73
95
|
---
|
|
@@ -155,3 +155,21 @@ def test_cli_overrides_applied_correctly(cli_gen):
|
|
|
155
155
|
assert overrides["cli__min_dist"] == "55" or overrides["cli__min_dist"] == 55
|
|
156
156
|
assert overrides["cli__output"] == "out.gpx"
|
|
157
157
|
assert overrides["cli__input"] == "tests/input.gpx"
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_verbosity_arguments(cli_gen):
|
|
161
|
+
# Test --verbose
|
|
162
|
+
argv_verbose = ["prog", "--verbose", "tests/input.gpx"]
|
|
163
|
+
with patch.object(sys, "argv", argv_verbose):
|
|
164
|
+
parser_verbose = cli_gen.create_argument_parser()
|
|
165
|
+
args_verbose = parser_verbose.parse_args()
|
|
166
|
+
overrides_verbose = cli_gen.create_config_overrides(args_verbose)
|
|
167
|
+
assert overrides_verbose["app__log_level"] == "DEBUG"
|
|
168
|
+
|
|
169
|
+
# Test --quiet
|
|
170
|
+
argv_quiet = ["prog", "--quiet", "tests/input.gpx"]
|
|
171
|
+
with patch.object(sys, "argv", argv_quiet):
|
|
172
|
+
parser_quiet = cli_gen.create_argument_parser()
|
|
173
|
+
args_quiet = parser_quiet.parse_args()
|
|
174
|
+
overrides_quiet = cli_gen.create_config_overrides(args_quiet)
|
|
175
|
+
assert overrides_quiet["app__log_level"] == "WARNING"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.idea/runConfigurations/example_project_cli.xml
RENAMED
|
File without changes
|
{config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/.idea/runConfigurations/example_project_gui.xml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/src/config_cli_gui.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{config_cli_gui-0.3.0 → config_cli_gui-0.3.1}/tests/example_project/config/config_example.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|