mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
- Prevent accidental import of installed "cli" package from site-packages - Make `python3 cli/__main__.py ...` behave identical to `python -m cli ...` - Add env.development to .dockerignore to match .gitignore https://chatgpt.com/share/69720fd6-a1c8-800f-b1e2-6909aa63643a
21 lines
563 B
Python
Executable File
21 lines
563 B
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Ensure project root is on sys.path when executing this file directly:
|
|
# python3 cli/__main__.py ...
|
|
#
|
|
# Without this, sys.path[0] points to "<root>/cli", and importing "cli.*"
|
|
# may accidentally resolve to an installed package from site-packages.
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from cli.core.app import main # noqa: E402
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|