Skip to content

Commit 2514bf6

Browse files
committed
reformating et correction en suppr de ce qui est inutle dans ark config
1 parent 55db768 commit 2514bf6

3 files changed

Lines changed: 86 additions & 89 deletions

File tree

Core/ark_config_loader.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,6 @@ def create_default_ark_config(workspace_dir: str) -> bool:
290290
- "app.py"
291291
auto_detect_entry_points: true
292292
293-
# OUTPUT CONFIGURATION
294-
output:
295-
directory: "dist"
296-
clean_before_build: false
297-
298293
# DEPENDENCIES
299294
dependencies:
300295
auto_generate_from_imports: true
@@ -320,5 +315,3 @@ def create_default_ark_config(workspace_dir: str) -> bool:
320315
except Exception as e:
321316
print(f"Warning: Failed to create ARK_Main_Config.yml: {e}")
322317
return False
323-
324-

Core/engines_loader/config_manager.py

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class EnginesConfigManager:
3030
"""
3131
Manages engine configurations in a centralized directory structure.
32-
32+
3333
Directory structure:
3434
workspace_root/
3535
└── ark_engines_config/
@@ -46,7 +46,7 @@ class EnginesConfigManager:
4646
def __init__(self, workspace_dir: str):
4747
"""
4848
Initialize the engines config manager.
49-
49+
5050
Args:
5151
workspace_dir: Root directory of the workspace
5252
"""
@@ -58,7 +58,7 @@ def _ensure_config_root(self) -> None:
5858
"""Ensure the ark_engines_config directory exists at workspace root."""
5959
if not self.workspace_dir:
6060
return
61-
61+
6262
self._config_root = self.workspace_dir / self.CONFIG_DIR_NAME
6363
try:
6464
self._config_root.mkdir(parents=True, exist_ok=True)
@@ -69,31 +69,33 @@ def _ensure_config_root(self) -> None:
6969
def get_engine_config_dir(self, engine_id: str) -> Optional[Path]:
7070
"""
7171
Get or create the configuration directory for a specific engine.
72-
72+
7373
Args:
7474
engine_id: The engine identifier
75-
75+
7676
Returns:
7777
Path to the engine's config directory, or None if creation failed
7878
"""
7979
if not self._config_root or not engine_id:
8080
return None
81-
81+
8282
engine_config_dir = self._config_root / engine_id
8383
try:
8484
engine_config_dir.mkdir(parents=True, exist_ok=True)
8585
return engine_config_dir
8686
except Exception as e:
87-
print(f"Warning: Failed to create config directory for engine '{engine_id}': {e}")
87+
print(
88+
f"Warning: Failed to create config directory for engine '{engine_id}': {e}"
89+
)
8890
return None
8991

9092
def get_engine_config_file(self, engine_id: str) -> Optional[Path]:
9193
"""
9294
Get the configuration file path for a specific engine.
93-
95+
9496
Args:
9597
engine_id: The engine identifier
96-
98+
9799
Returns:
98100
Path to the engine's config.json file, or None if directory creation failed
99101
"""
@@ -105,17 +107,17 @@ def get_engine_config_file(self, engine_id: str) -> Optional[Path]:
105107
def load_engine_config(self, engine_id: str) -> Dict[str, Any]:
106108
"""
107109
Load configuration for a specific engine.
108-
110+
109111
Args:
110112
engine_id: The engine identifier
111-
113+
112114
Returns:
113115
Dictionary containing the engine configuration, or empty dict if not found
114116
"""
115117
config_file = self.get_engine_config_file(engine_id)
116118
if not config_file or not config_file.exists():
117119
return {}
118-
120+
119121
try:
120122
with open(config_file, "r", encoding="utf-8") as f:
121123
config = json.load(f)
@@ -127,26 +129,26 @@ def load_engine_config(self, engine_id: str) -> Dict[str, Any]:
127129
def save_engine_config(self, engine_id: str, config: Dict[str, Any]) -> bool:
128130
"""
129131
Save configuration for a specific engine.
130-
132+
131133
Args:
132134
engine_id: The engine identifier
133135
config: Dictionary containing the configuration to save
134-
136+
135137
Returns:
136138
True if successful, False otherwise
137139
"""
138140
if not isinstance(config, dict):
139141
print(f"Warning: Config for engine '{engine_id}' must be a dictionary")
140142
return False
141-
143+
142144
config_file = self.get_engine_config_file(engine_id)
143145
if not config_file:
144146
return False
145-
147+
146148
try:
147149
# Ensure parent directory exists
148150
config_file.parent.mkdir(parents=True, exist_ok=True)
149-
151+
150152
with open(config_file, "w", encoding="utf-8") as f:
151153
json.dump(config, f, indent=2, ensure_ascii=False)
152154
return True
@@ -157,59 +159,62 @@ def save_engine_config(self, engine_id: str, config: Dict[str, Any]) -> bool:
157159
def update_engine_config(self, engine_id: str, updates: Dict[str, Any]) -> bool:
158160
"""
159161
Update specific keys in an engine's configuration.
160-
162+
161163
Args:
162164
engine_id: The engine identifier
163165
updates: Dictionary containing the keys to update
164-
166+
165167
Returns:
166168
True if successful, False otherwise
167169
"""
168170
if not isinstance(updates, dict):
169171
print(f"Warning: Updates for engine '{engine_id}' must be a dictionary")
170172
return False
171-
173+
172174
# Load existing config
173175
config = self.load_engine_config(engine_id)
174-
176+
175177
# Update with new values
176178
config.update(updates)
177-
179+
178180
# Save updated config
179181
return self.save_engine_config(engine_id, config)
180182

181183
def delete_engine_config(self, engine_id: str) -> bool:
182184
"""
183185
Delete configuration directory for a specific engine.
184-
186+
185187
Args:
186188
engine_id: The engine identifier
187-
189+
188190
Returns:
189191
True if successful, False otherwise
190192
"""
191193
engine_dir = self.get_engine_config_dir(engine_id)
192194
if not engine_dir or not engine_dir.exists():
193195
return False
194-
196+
195197
try:
196198
import shutil
199+
197200
shutil.rmtree(engine_dir)
198201
return True
199202
except Exception as e:
200-
print(f"Warning: Failed to delete config directory for engine '{engine_id}': {e}")
203+
print(
204+
f"Warning: Failed to delete config directory for engine '{engine_id}': {e}"
205+
)
201206
return False
202207

203208
def list_engine_configs(self) -> list[str]:
204209
"""
205210
List all engine IDs that have configurations.
206-
211+
207212
Returns:
208213
List of engine IDs with existing configurations
209214
"""
210215
if not self._config_root or not self._config_root.exists():
211216
return []
212-
217+
213218
try:
214219
engine_ids = []
215220
for item in self._config_root.iterdir():
@@ -223,7 +228,7 @@ def list_engine_configs(self) -> list[str]:
223228
def get_config_root_path(self) -> Optional[Path]:
224229
"""
225230
Get the root configuration directory path.
226-
231+
227232
Returns:
228233
Path to ark_engines_config directory, or None if not available
229234
"""
@@ -232,10 +237,10 @@ def get_config_root_path(self) -> Optional[Path]:
232237
def engine_has_config(self, engine_id: str) -> bool:
233238
"""
234239
Check if an engine has a configuration file.
235-
240+
236241
Args:
237242
engine_id: The engine identifier
238-
243+
239244
Returns:
240245
True if config file exists, False otherwise
241246
"""
@@ -247,23 +252,25 @@ def engine_has_config(self, engine_id: str) -> bool:
247252
_global_config_manager: Optional[EnginesConfigManager] = None
248253

249254

250-
def get_engines_config_manager(workspace_dir: Optional[str] = None) -> EnginesConfigManager:
255+
def get_engines_config_manager(
256+
workspace_dir: Optional[str] = None,
257+
) -> EnginesConfigManager:
251258
"""
252259
Get or create the global engines config manager instance.
253-
260+
254261
Args:
255262
workspace_dir: Workspace directory (required for first call)
256-
263+
257264
Returns:
258265
EnginesConfigManager instance
259266
"""
260267
global _global_config_manager
261-
268+
262269
if _global_config_manager is None:
263270
if not workspace_dir:
264271
raise ValueError("workspace_dir is required for first initialization")
265272
_global_config_manager = EnginesConfigManager(workspace_dir)
266-
273+
267274
return _global_config_manager
268275

269276

0 commit comments

Comments
 (0)