SPB Git

Repository Public MIT Research preview

_moteur.py 1.3 KB 30 lines python

1"""Rend le moteur du projet intégrateur (`atlas_agents`) importable, sans le copier ni l'installer.23Recherche : la variable d'environnement ATLAS_AGENTS_SRC si elle est définie, sinon le premier dossier4`projet-integrateur/src` trouvé en remontant depuis ce fichier. Le moteur exige Python 3.11 ou plus récent.5"""6from __future__ import annotations78import os9import sys10from pathlib import Path111213def localiser() -> Path:14    choix = os.environ.get("ATLAS_AGENTS_SRC")15    candidats = [Path(choix).expanduser()] if choix else [p / "projet-integrateur" / "src"16                                                         for p in Path(__file__).resolve().parents]17    for dossier in candidats:18        if (dossier / "atlas_agents" / "__init__.py").exists():19            return dossier.resolve()20    raise ImportError("moteur atlas_agents introuvable : placez ce dossier dans le cours, ou définissez "21                      "ATLAS_AGENTS_SRC=<chemin de projet-integrateur/src>")222324if sys.version_info < (3, 11):25    sys.exit("Python 3.11 ou plus récent est requis (le moteur emploie asyncio.TaskGroup).")26RACINE_MOTEUR = localiser()27RESULTATS_DU_MOTEUR = RACINE_MOTEUR.parent / "benchmarks" / "resultats"     # fichiers versionnés du banc d'essai28if str(RACINE_MOTEUR) not in sys.path:29    sys.path.insert(0, str(RACINE_MOTEUR))30
Files main
Menu

Theme