from pathlib import Path from pydantic import AnyUrl def path_to_url(path: str | Path) -> AnyUrl: return AnyUrl(f"file://{Path(path).resolve()}")