hardpy 0.15.1__tar.gz → 0.16.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.
Files changed (95) hide show
  1. {hardpy-0.15.1 → hardpy-0.16.0}/PKG-INFO +2 -2
  2. {hardpy-0.15.1 → hardpy-0.16.0}/README.md +1 -1
  3. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/__init__.py +9 -5
  4. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/cli/cli.py +16 -10
  5. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/config.py +70 -50
  6. {hardpy-0.15.1/hardpy/pytest_hardpy/utils → hardpy-0.16.0/hardpy/common}/singleton.py +1 -1
  7. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/api.py +13 -2
  8. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/allPaths-CV5wjLMB.js → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/allPaths-Cy69sdSD.js +1 -1
  9. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-JIzW_pSb.js → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-D993NqQ9.js +2 -2
  10. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Bfs1BwbR.ttf → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-B2twAPZE.ttf +0 -0
  11. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-RCDSkC4W.eot → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-C0Unyq1d.eot +0 -0
  12. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-CzsyEoPG.svg → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-CVy9qFng.svg +249 -3
  13. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Ck1ifK4A.woff +0 -0
  14. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-DwWyHYRo.woff2 +0 -0
  15. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-9zitLjlL.woff2 +0 -0
  16. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-CjKGIKxE.woff +0 -0
  17. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DyVnGNfQ.svg → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DQ09GSQq.svg +249 -3
  18. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-BGGGsqDJ.ttf → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DmR755bS.ttf +0 -0
  19. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-Doom1bSH.eot → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-p9MhBXD8.eot +0 -0
  20. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-DD76sq2d.js +2 -0
  21. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/index-B-fsa5Ru.js +1 -0
  22. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/index-B7T9xvaW.css +1 -0
  23. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/index-C93zcGIi.js +4672 -0
  24. hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/index-DLOviMB1.js +1 -0
  25. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-DkZadBcn.js → hardpy-0.16.0/hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-D4hRORV6.js +1 -1
  26. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/index.html +2 -2
  27. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/de/translation.json +9 -0
  28. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/en/translation.json +9 -0
  29. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/es/translation.json +9 -0
  30. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/fr/translation.json +9 -0
  31. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json +9 -0
  32. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json +9 -0
  33. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json +9 -0
  34. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/__init__.py +12 -0
  35. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/base_store.py +25 -4
  36. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/runstore.py +1 -1
  37. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/schema/v1.py +10 -8
  38. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/statestore.py +1 -1
  39. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/plugin.py +34 -21
  40. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/pytest_call.py +26 -36
  41. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/pytest_wrapper.py +9 -7
  42. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/reporter/base.py +21 -1
  43. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/reporter/hook_reporter.py +29 -0
  44. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/reporter/runner_reporter.py +1 -1
  45. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_loader/stand_cloud_loader.py +35 -4
  46. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/__init__.py +0 -16
  47. {hardpy-0.15.1 → hardpy-0.16.0}/pyproject.toml +1 -1
  48. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Btb8d-Hu.woff +0 -0
  49. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-DrH54W_x.woff2 +0 -0
  50. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-D9WO2FSG.woff2 +0 -0
  51. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-ZW-9JnPf.woff +0 -0
  52. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-CccdstaD.js +0 -2
  53. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/index-6RIgWzcZ.js +0 -790
  54. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/index-BMEat_ws.js +0 -1
  55. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/index-BwCQzehg.css +0 -1
  56. hardpy-0.15.1/hardpy/hardpy_panel/frontend/dist/assets/index-xb4M2ucX.js +0 -1
  57. hardpy-0.15.1/hardpy/pytest_hardpy/db/base_connector.py +0 -31
  58. hardpy-0.15.1/hardpy/pytest_hardpy/db/base_server.py +0 -14
  59. hardpy-0.15.1/hardpy/pytest_hardpy/utils/connection_data.py +0 -13
  60. {hardpy-0.15.1 → hardpy-0.16.0}/.gitignore +0 -0
  61. {hardpy-0.15.1 → hardpy-0.16.0}/LICENSE +0 -0
  62. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/cli/__init__.py +0 -0
  63. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/cli/template.py +0 -0
  64. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/__init__.py +0 -0
  65. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/__init__.py +0 -0
  66. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/connector.py +0 -0
  67. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/exception.py +0 -0
  68. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/oauth2.py +0 -0
  69. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/registration.py +0 -0
  70. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/token_manager.py +0 -0
  71. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/common/stand_cloud/utils.py +0 -0
  72. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/__init__.py +0 -0
  73. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/assets/logo_smol-CK3jE85c.png +0 -0
  74. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/favicon.ico +0 -0
  75. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/logo192.png +0 -0
  76. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/logo512.png +0 -0
  77. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/hardpy_panel/frontend/dist/manifest.json +0 -0
  78. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/__init__.py +0 -0
  79. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/const.py +0 -0
  80. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/db/schema/__init__.py +0 -0
  81. {hardpy-0.15.1/hardpy/pytest_hardpy/utils → hardpy-0.16.0/hardpy/pytest_hardpy/db}/stand_type.py +0 -0
  82. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/reporter/__init__.py +0 -0
  83. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/__init__.py +0 -0
  84. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/couchdb_config.py +0 -0
  85. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_loader/__init__.py +0 -0
  86. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_loader/couchdb_loader.py +0 -0
  87. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_reader/__init__.py +0 -0
  88. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_reader/couchdb_reader.py +0 -0
  89. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/result/report_reader/stand_cloud_reader.py +0 -0
  90. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/const.py +0 -0
  91. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/dialog_box.py +0 -0
  92. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/exception.py +0 -0
  93. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/machineid.py +0 -0
  94. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/node_info.py +0 -0
  95. {hardpy-0.15.1 → hardpy-0.16.0}/hardpy/pytest_hardpy/utils/progress_calculator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hardpy
3
- Version: 0.15.1
3
+ Version: 0.16.0
4
4
  Summary: HardPy library for device testing
5
5
  Project-URL: Homepage, https://github.com/everypinio/hardpy/
6
6
  Project-URL: Documentation, https://everypinio.github.io/hardpy/
@@ -109,7 +109,7 @@ hardpy run
109
109
  4. View operator panel in browser: http://localhost:8000/
110
110
  5. View the latest test report: http://localhost:5984/_utils
111
111
 
112
- Login and password: **dev**, database - **runstore**, document - **current**.
112
+ Login and password: **dev**, database - **runstore**.
113
113
 
114
114
  ## Examples
115
115
 
@@ -53,7 +53,7 @@ hardpy run
53
53
  4. View operator panel in browser: http://localhost:8000/
54
54
  5. View the latest test report: http://localhost:5984/_utils
55
55
 
56
- Login and password: **dev**, database - **runstore**, document - **current**.
56
+ Login and password: **dev**, database - **runstore**.
57
57
 
58
58
  ## Examples
59
59
 
@@ -2,6 +2,13 @@
2
2
  # GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
4
  from hardpy.common.stand_cloud import StandCloudConnector, StandCloudError
5
+ from hardpy.pytest_hardpy.db import (
6
+ Chart,
7
+ Instrument,
8
+ NumericMeasurement,
9
+ StringMeasurement,
10
+ SubUnit,
11
+ )
5
12
  from hardpy.pytest_hardpy.pytest_call import (
6
13
  ErrorCode,
7
14
  clear_operator_message,
@@ -43,22 +50,18 @@ from hardpy.pytest_hardpy.result import (
43
50
  from hardpy.pytest_hardpy.result.couchdb_config import CouchdbConfig
44
51
  from hardpy.pytest_hardpy.utils import (
45
52
  BaseWidget,
46
- Chart,
47
53
  ChartType,
48
54
  CheckboxWidget,
49
55
  ComparisonOperation,
50
56
  DialogBox,
51
57
  DuplicateParameterError,
58
+ Group,
52
59
  HTMLComponent,
53
60
  ImageComponent,
54
- Instrument,
55
61
  MultistepWidget,
56
62
  NumericInputWidget,
57
- NumericMeasurement,
58
63
  RadiobuttonWidget,
59
64
  StepWidget,
60
- StringMeasurement,
61
- SubUnit,
62
65
  TestStandNumberError,
63
66
  TextInputWidget,
64
67
  )
@@ -74,6 +77,7 @@ __all__ = [
74
77
  "DialogBox",
75
78
  "DuplicateParameterError",
76
79
  "ErrorCode",
80
+ "Group",
77
81
  "HTMLComponent",
78
82
  "ImageComponent",
79
83
  "Instrument",
@@ -28,7 +28,7 @@ if __debug__:
28
28
  disable_warnings(InsecureRequestWarning)
29
29
 
30
30
  cli = typer.Typer(add_completion=False)
31
- default_config = ConfigManager().get_config()
31
+ default_config = HardpyConfig()
32
32
 
33
33
 
34
34
  @cli.command()
@@ -92,7 +92,8 @@ def init( # noqa: PLR0913
92
92
  sc_connection_only (bool): Flag to check StandCloud service availability
93
93
  """
94
94
  dir_path = Path(Path.cwd() / tests_dir if tests_dir else "tests")
95
- ConfigManager().init_config(
95
+ config_manager = ConfigManager()
96
+ config_manager.init_config(
96
97
  tests_name=tests_name if tests_name else dir_path.name,
97
98
  database_user=database_user,
98
99
  database_password=database_password,
@@ -112,7 +113,7 @@ def init( # noqa: PLR0913
112
113
  Path.mkdir(dir_path / "database", exist_ok=True, parents=True)
113
114
 
114
115
  # create hardpy.toml
115
- ConfigManager().create_config(dir_path)
116
+ config_manager.create_config(dir_path)
116
117
 
117
118
  config = _get_config(dir_path)
118
119
  template = TemplateGenerator(config)
@@ -151,12 +152,16 @@ def run(tests_dir: Annotated[Optional[str], typer.Argument()] = None) -> None:
151
152
 
152
153
  print(f"http://{config.frontend.host}:{config.frontend.port}\n")
153
154
 
154
- uvicorn_run(
155
- "hardpy.hardpy_panel.api:app",
156
- host=config.frontend.host,
157
- port=config.frontend.port,
158
- log_level="critical",
159
- )
155
+ try:
156
+ uvicorn_run(
157
+ "hardpy.hardpy_panel.api:app",
158
+ host=config.frontend.host,
159
+ port=config.frontend.port,
160
+ log_level="critical",
161
+ )
162
+ except RuntimeError as exc:
163
+ print(f"HardPy server cannot be started: {exc}")
164
+ sys.exit()
160
165
 
161
166
 
162
167
  @cli.command()
@@ -260,7 +265,8 @@ def sc_logout(address: Annotated[str, typer.Argument()]) -> None:
260
265
 
261
266
  def _get_config(tests_dir: str | None = None, validate: bool = False) -> HardpyConfig:
262
267
  dir_path = Path.cwd() / tests_dir if tests_dir else Path.cwd()
263
- config = ConfigManager().read_config(dir_path)
268
+ config_manager = ConfigManager()
269
+ config = config_manager.read_config(dir_path)
264
270
 
265
271
  if not config:
266
272
  print(f"Config at path {dir_path} not found.")
@@ -7,7 +7,9 @@ from pathlib import Path
7
7
 
8
8
  import tomli
9
9
  import tomli_w
10
- from pydantic import BaseModel, ConfigDict, ValidationError
10
+ from pydantic import BaseModel, ConfigDict, Field, ValidationError
11
+
12
+ from hardpy.common.singleton import SingletonMeta
11
13
 
12
14
  logger = getLogger(__name__)
13
15
 
@@ -21,8 +23,14 @@ class DatabaseConfig(BaseModel):
21
23
  password: str = "dev"
22
24
  host: str = "localhost"
23
25
  port: int = 5984
26
+ doc_id: str = Field(exclude=True, default="")
27
+ url: str = Field(exclude=True, default="")
28
+
29
+ def model_post_init(self, __context) -> None: # noqa: ANN001,PYI063
30
+ """Get database connection url."""
31
+ self.url = self.get_url()
24
32
 
25
- def connection_url(self) -> str:
33
+ def get_url(self) -> str:
26
34
  """Get database connection url.
27
35
 
28
36
  Returns:
@@ -63,16 +71,42 @@ class HardpyConfig(BaseModel, extra="allow"):
63
71
  frontend: FrontendConfig = FrontendConfig()
64
72
  stand_cloud: StandCloudConfig = StandCloudConfig()
65
73
 
74
+ def model_post_init(self, __context) -> None: # noqa: ANN001,PYI063
75
+ """Get database document name."""
76
+ self.database.doc_id = self.get_doc_id()
77
+
78
+ def get_doc_id(self) -> str:
79
+ """Update database document name."""
80
+ return f"{self.frontend.host}_{self.frontend.port}"
81
+
66
82
 
67
- class ConfigManager:
83
+ class ConfigManager(metaclass=SingletonMeta):
68
84
  """HardPy configuration manager."""
69
85
 
70
- obj = HardpyConfig()
71
- tests_path = Path.cwd()
86
+ def __init__(self) -> None:
87
+ self._config = HardpyConfig()
88
+ self._test_path = Path.cwd()
89
+
90
+ @property
91
+ def config(self) -> HardpyConfig:
92
+ """Get HardPy configuration.
93
+
94
+ Returns:
95
+ HardpyConfig: HardPy configuration
96
+ """
97
+ return self._config
98
+
99
+ @property
100
+ def tests_path(self) -> Path:
101
+ """Get tests path.
102
+
103
+ Returns:
104
+ Path: HardPy tests path
105
+ """
106
+ return self._tests_path
72
107
 
73
- @classmethod
74
108
  def init_config( # noqa: PLR0913
75
- cls,
109
+ self,
76
110
  tests_name: str,
77
111
  database_user: str,
78
112
  database_password: str,
@@ -84,7 +118,9 @@ class ConfigManager:
84
118
  sc_address: str = "",
85
119
  sc_connection_only: bool = False,
86
120
  ) -> None:
87
- """Initialize HardPy configuration.
121
+ """Initialize the HardPy configuration.
122
+
123
+ Only call once to create a configuration.
88
124
 
89
125
  Args:
90
126
  tests_name (str): Tests suite name.
@@ -98,34 +134,37 @@ class ConfigManager:
98
134
  sc_address (str): StandCloud address.
99
135
  sc_connection_only (bool): StandCloud check availability.
100
136
  """
101
- cls.obj.tests_name = tests_name
102
- cls.obj.database.user = database_user
103
- cls.obj.database.password = database_password
104
- cls.obj.database.host = database_host
105
- cls.obj.database.port = database_port
106
- cls.obj.frontend.host = frontend_host
107
- cls.obj.frontend.port = frontend_port
108
- cls.obj.frontend.language = frontend_language
109
- cls.obj.stand_cloud.address = sc_address
110
- cls.obj.stand_cloud.connection_only = sc_connection_only
111
-
112
- @classmethod
113
- def create_config(cls, parent_dir: Path) -> None:
137
+ self._config.tests_name = tests_name
138
+ self._config.frontend.host = frontend_host
139
+ self._config.frontend.port = frontend_port
140
+ self._config.frontend.language = frontend_language
141
+ self._config.database.user = database_user
142
+ self._config.database.password = database_password
143
+ self._config.database.host = database_host
144
+ self._config.database.port = database_port
145
+ self._config.database.doc_id = self._config.get_doc_id()
146
+ self._config.database.url = self._config.database.get_url()
147
+ self._config.stand_cloud.address = sc_address
148
+ self._config.stand_cloud.connection_only = sc_connection_only
149
+
150
+ def create_config(self, parent_dir: Path) -> None:
114
151
  """Create HardPy configuration.
115
152
 
116
153
  Args:
117
154
  parent_dir (Path): Configuration file parent directory.
118
155
  """
119
- if not cls.obj.stand_cloud.address:
120
- del cls.obj.stand_cloud
121
- if not cls.obj.tests_name:
122
- del cls.obj.tests_name
123
- config_str = tomli_w.dumps(cls.obj.model_dump())
156
+ config = self._config
157
+ if not self._config.stand_cloud.address:
158
+ del config.stand_cloud
159
+ if not self._config.tests_name:
160
+ del config.tests_name
161
+ if not self._config.database.doc_id:
162
+ del config.database.doc_id
163
+ config_str = tomli_w.dumps(config.model_dump())
124
164
  with Path.open(parent_dir / "hardpy.toml", "w") as file:
125
165
  file.write(config_str)
126
166
 
127
- @classmethod
128
- def read_config(cls, toml_path: Path) -> HardpyConfig | None:
167
+ def read_config(self, toml_path: Path) -> HardpyConfig | None:
129
168
  """Read HardPy configuration.
130
169
 
131
170
  Args:
@@ -134,10 +173,9 @@ class ConfigManager:
134
173
  Returns:
135
174
  HardpyConfig | None: HardPy configuration
136
175
  """
137
- cls.tests_path = toml_path
176
+ self._tests_path = toml_path
138
177
  toml_file = toml_path / "hardpy.toml"
139
178
  if not toml_file.exists():
140
- logger.error("File hardpy.toml not found at path: %s", toml_file)
141
179
  return None
142
180
  try:
143
181
  with Path.open(toml_path / "hardpy.toml", "rb") as f:
@@ -148,26 +186,8 @@ class ConfigManager:
148
186
  return None
149
187
 
150
188
  try:
151
- cls.obj = HardpyConfig(**toml_data)
189
+ self._config = HardpyConfig(**toml_data)
152
190
  except ValidationError:
153
191
  logger.exception("Error parsing TOML")
154
192
  return None
155
- return cls.obj
156
-
157
- @classmethod
158
- def get_config(cls) -> HardpyConfig:
159
- """Get HardPy configuration.
160
-
161
- Returns:
162
- HardpyConfig: HardPy configuration
163
- """
164
- return cls.obj
165
-
166
- @classmethod
167
- def get_tests_path(cls) -> Path:
168
- """Get tests path.
169
-
170
- Returns:
171
- Path: HardPy tests path
172
- """
173
- return cls.tests_path
193
+ return self._config
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Everypin
1
+ # Copyright (c) 2025 Everypin
2
2
  # GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
  from __future__ import annotations
4
4
 
@@ -107,13 +107,24 @@ def couch_connection() -> dict:
107
107
  Returns:
108
108
  dict[str, str]: couchdb connection string
109
109
  """
110
- connection_url = ConfigManager().get_config().database.connection_url()
110
+ config_manager = ConfigManager()
111
111
 
112
112
  return {
113
- "connection_str": connection_url,
113
+ "connection_str": config_manager.config.database.url,
114
114
  }
115
115
 
116
116
 
117
+ @app.get("/api/database_document_id")
118
+ def database_document_id() -> dict:
119
+ """Get couchdb syncronized document name.
120
+
121
+ Returns:
122
+ dict[str, str]: couchdb connection string
123
+ """
124
+ config_manager = ConfigManager()
125
+ return {"document_id": config_manager.config.database.doc_id}
126
+
127
+
117
128
  @app.post("/api/confirm_dialog_box/{dialog_box_output}")
118
129
  def confirm_dialog_box(dialog_box_output: str) -> dict:
119
130
  """Confirm dialog box.
@@ -1 +1 @@
1
- import{I as n}from"./index-xb4M2ucX.js";import{I as e}from"./index-BMEat_ws.js";import{p as r,I as s}from"./index-6RIgWzcZ.js";function I(o,t){var a=r(o);return t===s.STANDARD?n[a]:e[a]}function p(o){return r(o)}export{n as IconSvgPaths16,e as IconSvgPaths20,I as getIconPaths,p as iconNameToPathsRecordKey};
1
+ import{I as n}from"./index-DLOviMB1.js";import{I as e}from"./index-B-fsa5Ru.js";import{p as r,I as s}from"./index-C93zcGIi.js";function I(o,t){var a=r(o);return t===s.STANDARD?n[a]:e[a]}function p(o){return r(o)}export{n as IconSvgPaths16,e as IconSvgPaths20,I as getIconPaths,p as iconNameToPathsRecordKey};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-CV5wjLMB.js","assets/index-xb4M2ucX.js","assets/index-BMEat_ws.js","assets/index-6RIgWzcZ.js","assets/index-BwCQzehg.css"])))=>i.map(i=>d[i]);
2
- import{_ as o,a as n,b as i}from"./index-6RIgWzcZ.js";var _=function(e,a){return o(void 0,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,i(()=>import("./allPaths-CV5wjLMB.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-Cy69sdSD.js","assets/index-DLOviMB1.js","assets/index-B-fsa5Ru.js","assets/index-C93zcGIi.js","assets/index-B7T9xvaW.css"])))=>i.map(i=>d[i]);
2
+ import{_ as o,a as n,b as i}from"./index-C93zcGIi.js";var _=function(e,a){return o(void 0,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,i(()=>import("./allPaths-Cy69sdSD.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};