Download sdk/python-runtime/src/codex_cli_bin/__init__.py from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/sdk/python-runtime/src/codex_cli_bin/__init__.py
- Command line
-
hf download hf://SaylorTwift/codex/sdk/python-runtime/src/codex_cli_bin/__init__.py
-
curl -L -o __init__.py https://huggingface.co/SaylorTwift/codex/resolve/main/sdk/python-runtime/src/codex_cli_bin/__init__.py
1.01 kB
| import os | |
| from pathlib import Path | |
| PACKAGE_NAME = "openai-codex-cli-bin" | |
| PACKAGE_METADATA_FILENAME = "codex-package.json" | |
| def bundled_package_dir() -> Path: | |
| path = Path(__file__).resolve().parent | |
| metadata_path = path / PACKAGE_METADATA_FILENAME | |
| if not metadata_path.is_file(): | |
| raise FileNotFoundError( | |
| f"{PACKAGE_NAME} is installed but missing its package metadata at {metadata_path}" | |
| ) | |
| return path | |
| def bundled_codex_path() -> Path: | |
| exe = "codex.exe" if os.name == "nt" else "codex" | |
| path = bundled_package_dir() / "bin" / exe | |
| if not path.is_file(): | |
| raise FileNotFoundError( | |
| f"{PACKAGE_NAME} is installed but missing its packaged codex binary at {path}" | |
| ) | |
| return path | |
| def bundled_path_dir() -> Path | None: | |
| path = bundled_package_dir() / "codex-path" | |
| return path if path.is_dir() else None | |
| __all__ = [ | |
| "PACKAGE_NAME", | |
| "bundled_codex_path", | |
| "bundled_package_dir", | |
| "bundled_path_dir", | |
| ] | |