warg.packages.reloading.ensure_in_sys_path¶
- warg.packages.reloading.ensure_in_sys_path(path: str | Path | None, position: int | None = None, resolve: bool = False, absolute: bool = True, verbose: bool = False) None[source]¶
Ensures that a path is in sys.path, but avoids duplicates. Can also resolve and absolute paths for duplication. Does not clean the existing paths in sys.path
- Parameters:
verbose (bool) – Whether to print verbose info
path (Optional[Union[str, Path]]) – The path to be inserted
position (Optional[int]) – If not supplied, the path will be appended at the end of the existing sys.path
resolve (bool) – Whether to resolve the absolute path
absolute (bool) – Insert the absolute path
- Returns:
None
- Return type:
None