AccessPath / accesspath.py
anonymous-accesspath's picture
Audited anonymous-review AccessPath release
2f382c4 verified
Raw
History Blame Contribute Delete
1.3 kB
#!/usr/bin/env python3
"""AccessPath command-line entry point for the full 2D/3D pipeline."""
from __future__ import annotations
import argparse
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
TOOLS = {
"2d": ROOT / "tools" / "accessibility_2d_completion.py",
"3d": ROOT / "tools" / "accessibility_3d_completion.py",
}
def main() -> int:
parser = argparse.ArgumentParser(
description="Run the AccessPath pipeline or one of its completion backends."
)
parser.add_argument(
"mode",
choices=("pipeline", *TOOLS),
help="Full Slurm pipeline, or a direct 2D/3D backend.",
)
parser.add_argument(
"args",
nargs=argparse.REMAINDER,
help="Arguments forwarded to the selected backend; prefix them with --.",
)
parsed = parser.parse_args()
forwarded = parsed.args[1:] if parsed.args[:1] == ["--"] else parsed.args
if parsed.mode == "pipeline":
from accesspath3r.cli import main as pipeline_main
sys.argv = [str(ROOT / "accesspath.py"), *forwarded]
return pipeline_main()
return subprocess.run([sys.executable, str(TOOLS[parsed.mode]), *forwarded], check=False).returncode
if __name__ == "__main__":
raise SystemExit(main())