INNER CODE UNIT · Python

find_pyproject_toml

snakemake/snakefmt · snakefmt/config.py:71

def find_pyproject_toml(start_path: Sequence[str]) -> Optional[str]:
    root, _ = find_project_root(start_path)
    config_file = root / "pyproject.toml"
    return str(config_file) if config_file.is_file() else None


def read_snakefmt_config(path: Optional[str]) -> Dict[str, str]:
    """Parse Snakefmt configuration from provided toml."""
    if path is None:
        return dict()
    try:
        with open(path, "rb") as f:
            config_toml = tomllib.load(f)
        config = config_toml.get("tool", {}).get("snakefmt", {})
        config = {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}
        return config
    except (tomllib.TOMLDecodeError, OSError) as error:
        raise click.FileError(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…