from pathlib import Path


def path_to_module(path: Path) -> str:
    """Convert a path like "arthur/exts/foo/bar.py" to "arthur.exts.foo.bar"."""
    return str(path.parent.as_posix()).replace("/", ".") + f".{path.stem}"