Skip to content

Commit c3e1029

Browse files
committed
refactor: Refactor VenvManager et DepsAnalyser pour simplifier les choses et suppr de legacy code
1 parent 694a735 commit c3e1029

12 files changed

Lines changed: 289 additions & 1356 deletions

File tree

Core/Configs/__init__.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,8 @@
130130
"fallback_to_pip": True,
131131
}
132132

133-
# Alias kept for backward compatibility
134-
DEFAULT_EXCLUSION_PATTERNS = DEFAULT_EXCLUDE_PATTERNS
135-
136133
DEFAULT_CONFIG: dict[str, Any] = {
137134
**deepcopy(DEFAULT_ARK_CONFIG),
138-
"exclusion_patterns": list(DEFAULT_EXCLUDE_PATTERNS),
139-
"inclusion_patterns": ["**/*.py"],
140135
"dependencies": deepcopy(DEFAULT_DEPENDENCY_OPTIONS),
141136
"environment_manager": deepcopy(DEFAULT_ENVIRONMENT_MANAGER_OPTIONS),
142137
"build": {
@@ -209,12 +204,6 @@ def _looks_like_semver(value: str) -> bool:
209204
def _compatibility_view(config: dict[str, Any]) -> dict[str, Any]:
210205
normalized = normalize_ark_config(config)
211206
view = deepcopy(normalized)
212-
workspace_cfg = view.get("workspace")
213-
if not isinstance(workspace_cfg, dict):
214-
workspace_cfg = {}
215-
excludes = list(workspace_cfg.get("exclude") or DEFAULT_EXCLUDE_PATTERNS)
216-
view["exclusion_patterns"] = excludes
217-
view["inclusion_patterns"] = list(config.get("inclusion_patterns") or ["**/*.py"])
218207
view["dependencies"] = _deep_merge_dict(
219208
DEFAULT_DEPENDENCY_OPTIONS,
220209
config.get("dependencies") if isinstance(config.get("dependencies"), dict) else {},
@@ -235,31 +224,51 @@ def _compatibility_view(config: dict[str, Any]) -> dict[str, Any]:
235224
# ── Public API — workspace config ─────────────────────────────────────────────
236225

237226
def normalize_ark_config(config: dict[str, Any]) -> dict[str, Any]:
238-
merged = _deep_merge_dict(DEFAULT_ARK_CONFIG, config or {})
227+
"""Normalise une configuration brute en un dictionnaire canonique.
228+
229+
Cette version ne gère plus la rétro-compatibilité avec 'exclusion_patterns'
230+
et 'inclusion_patterns' au niveau racine. Ces réglages doivent désormais
231+
être exclusivement gérés dans 'workspace: exclude'.
232+
"""
233+
if not isinstance(config, dict):
234+
config = {}
235+
236+
# Fusion avec les valeurs par défaut
237+
merged = _deep_merge_dict(DEFAULT_ARK_CONFIG, config)
239238

239+
# Nettoyage explicite des clés obsolètes si présentes
240+
merged.pop("exclusion_patterns", None)
241+
merged.pop("inclusion_patterns", None)
242+
243+
# Normalisation de la section 'project'
240244
project = merged.get("project")
241245
if not isinstance(project, dict):
242246
project = {}
243247
project_name = str(project.get("name") or "").strip()
244248
project_version = str(project.get("version") or "").strip() or "1.0.0"
249+
250+
# Récupération de l'entrypoint (support build.entrypoint comme legacy interne)
245251
build_for_entry = merged.get("build")
246252
if not isinstance(build_for_entry, dict):
247253
build_for_entry = {}
248254
legacy_entry = build_for_entry.get("entrypoint")
249255
project_entry = str(project.get("entry") or legacy_entry or "").strip()
256+
250257
merged["project"] = {
251258
"name": project_name,
252259
"version": project_version,
253260
"entry": project_entry,
254261
}
255262

263+
# Normalisation de la section 'workspace'
256264
workspace_cfg = merged.get("workspace")
257265
if not isinstance(workspace_cfg, dict):
258266
workspace_cfg = {}
259267
merged["workspace"] = {
260268
"exclude": _normalize_workspace_exclude(workspace_cfg.get("exclude")),
261269
}
262270

271+
# Normalisation de la section 'build'
263272
build = merged.get("build")
264273
if not isinstance(build, dict):
265274
build = {}
@@ -272,6 +281,7 @@ def normalize_ark_config(config: dict[str, Any]) -> dict[str, Any]:
272281
if isinstance(icon_value, str) and icon_value.strip():
273282
normalized_build["icon"] = icon_value.strip()
274283
merged["build"] = normalized_build
284+
275285
return merged
276286

277287

@@ -608,7 +618,6 @@ def unset_config_value(key: str) -> bool:
608618
"DEFAULT_ARK_CONFIG",
609619
"DEFAULT_CONFIG",
610620
"DEFAULT_EXCLUDE_PATTERNS",
611-
"DEFAULT_EXCLUSION_PATTERNS",
612621
"DEFAULT_DEPENDENCY_OPTIONS",
613622
"DEFAULT_ENVIRONMENT_MANAGER_OPTIONS",
614623
"create_default_ark_config",

0 commit comments

Comments
 (0)