icub_pybullet.runtime_paths
Cross-platform runtime paths, user workspace/cache helpers, config/mesh resolution, and OS-agnostic process/network utilities for pyCub.
Attributes
Functions
|
Return the fallback path to the user's Documents directory. |
|
Return True when running inside a frozen bundle (e.g. PyInstaller). |
|
Normalize a path and convert separators to forward slashes (safe inside URDF XML on Windows). |
|
Return True only if directory is writable and NOT inside a frozen bundle directory. |
|
Return the user's writable pyCub workspace directory (default: ~/Documents/pyCub). |
|
Ensure standard user workspace subdirectories exist and return root path. |
|
Return the writable extra Python packages directory (~/Documents/pyCub/extra_packages). |
|
Return writable cache directory for generated URDFs and dynamic VHACD collision meshes. |
|
Return writable log directory (falls back to user data dir when package_dir/logs is read-only). |
|
Write text atomically via temp file + os.replace so concurrent instances never read partial URDFs. |
|
Resolve a YAML config path across: |
|
Resolve robot_urdf_path across absolute path, config dir, user workspace, and bundled package dir. |
|
Resolve an object .obj or .urdf path referenced in config.urdfs.paths across: |
|
Fast fingerprint combining canonical path, size, and mtime_ns. |
|
Locate an existing pre-baked |
|
Return a deterministic path in the user cache for a generated/patched URDF. |
|
Cross-platform IPv4 LAN addresses discovery (Windows, macOS, Linux). |
|
Cross-platform termination of child processes and all their descendants using psutil. |
Module Contents
- icub_pybullet.runtime_paths.user_documents_dir() str
Return the fallback path to the user’s Documents directory.
- icub_pybullet.runtime_paths.SKIP_IFACE_PREFIXES = ('lo', 'docker', 'br-', 'veth', 'virbr', 'lxc', 'tailscale', 'utun', 'awdl', 'llw')
- icub_pybullet.runtime_paths.is_frozen() bool
Return True when running inside a frozen bundle (e.g. PyInstaller).
- icub_pybullet.runtime_paths.to_posix(path: str | os.PathLike) str
Normalize a path and convert separators to forward slashes (safe inside URDF XML on Windows).
- icub_pybullet.runtime_paths.is_writable_dir(directory: str | os.PathLike) bool
Return True only if directory is writable and NOT inside a frozen bundle directory.
- icub_pybullet.runtime_paths.get_user_workspace_dir() pathlib.Path
Return the user’s writable pyCub workspace directory (default: ~/Documents/pyCub).
- icub_pybullet.runtime_paths.ensure_user_workspace() pathlib.Path
Ensure standard user workspace subdirectories exist and return root path.
- icub_pybullet.runtime_paths.get_extra_packages_dir() pathlib.Path
Return the writable extra Python packages directory (~/Documents/pyCub/extra_packages).
- icub_pybullet.runtime_paths.get_user_cache_dir() pathlib.Path
Return writable cache directory for generated URDFs and dynamic VHACD collision meshes.
- icub_pybullet.runtime_paths.get_user_log_dir(package_dir: str | None = None) pathlib.Path
Return writable log directory (falls back to user data dir when package_dir/logs is read-only).
- icub_pybullet.runtime_paths.write_text_atomic(target_path: str | os.PathLike, content: str) str
Write text atomically via temp file + os.replace so concurrent instances never read partial URDFs.
- icub_pybullet.runtime_paths.resolve_config_path(config: str, package_dir: str, caller_file: str | None = None) str
- Resolve a YAML config path across:
Direct / absolute path or relative to CWD
Relative to caller script directory
User workspace (~/Documents/pyCub/worlds, configs, root)
Bundled icub_pybullet/configs
- icub_pybullet.runtime_paths.resolve_robot_urdf_path(robot_urdf_rel: str, package_dir: str, config_dir: str | None = None) str
Resolve robot_urdf_path across absolute path, config dir, user workspace, and bundled package dir.
- icub_pybullet.runtime_paths.resolve_mesh_or_urdf_path(obj_path: str, package_dir: str, config_dir: str | None = None) str
- Resolve an object .obj or .urdf path referenced in config.urdfs.paths across:
Absolute path
Relative to the loaded config file’s directory
Relative to CWD
User workspace (~/Documents/pyCub/meshes and root)
Bundled icub_pybullet/other_meshes and package root
- icub_pybullet.runtime_paths.file_fingerprint(path: str) str
Fast fingerprint combining canonical path, size, and mtime_ns.
- icub_pybullet.runtime_paths.get_vhacd_cache_path(col_path: str, force_vhacd: bool = False) Tuple[str, bool]
Locate an existing pre-baked
*_vhacd.objor return a writable cache path. Returns (vhacd_mesh_path, needs_compute).
- icub_pybullet.runtime_paths.get_cached_urdf_path(stem: str, key: str, subdir: str = 'generated_urdf') str
Return a deterministic path in the user cache for a generated/patched URDF.
- icub_pybullet.runtime_paths.local_ipv4_addresses() List[str]
Cross-platform IPv4 LAN addresses discovery (Windows, macOS, Linux).
- icub_pybullet.runtime_paths.terminate_process_tree(procs: Iterable, timeout: float = 5.0) None
Cross-platform termination of child processes and all their descendants using psutil.