Config - vcspull.config

Configuration functionality for vcspull.

vcspull.config.expand_dir(_dir, cwd=<bound method PathBase.cwd of <class 'pathlib._local.Path'>>)[source]

Return path with environmental variables and tilde ~ expanded.

Return type:

Path

Parameters:
  • _dir (pathlib.Path)

  • cwd (pathlib.Path, optional) – current working dir (for deciphering relative _dir paths), defaults to os.getcwd()

Returns:

Absolute directory path

Return type:

pathlib.Path

vcspull.config.extract_repos(config, cwd=<bound method PathBase.cwd of <class 'pathlib._local.Path'>>)[source]

Return expanded configuration.

end-user configuration permit inline configuration shortcuts, expand to identical format for parsing.

Return type:

list[ConfigDict]

Parameters:
  • config (dict) – the repo config in dict format.

  • cwd (pathlib.Path) – current working dir (for deciphering relative paths)

Returns:

list

Return type:

List of normalized repository information

vcspull.config.find_home_config_files(filetype=None)[source]

Return configs of .vcspull.{yaml,json} in user’s home directory.

Return type:

list[Path]

Parameters:

filetype (list[str] | None)

vcspull.config.find_config_files(path=None, match=None, filetype=None, include_home=False)[source]

Return repos from a directory and match. Not recursive.

Return type:

list[Path]

Parameters:
  • path (list) – list of paths to search

  • match (list) – list of globs to search against

  • filetype (list) – of filetypes to search against

  • include_home (bool) – Include home configuration files

Raises:

LoadConfigRepoConflict : – There are two configs that have same path and name with different repo urls.

Returns:

list of absolute paths to config files.

Return type:

list

vcspull.config.load_configs(files, cwd=<bound method PathBase.cwd of <class 'pathlib._local.Path'>>)[source]

Return repos from a list of files.

Return type:

list[ConfigDict]

Parameters:
Returns:

expanded config dict item

Return type:

list of dict

vcspull.config.detect_duplicate_repos(config1, config2)[source]

Return duplicate repos dict if repo_dir same and vcs different.

Return type:

list[tuple[ConfigDict, ConfigDict]]

Parameters:
Returns:

List of duplicate tuples

Return type:

list[ConfigDictTuple]

vcspull.config.in_dir(config_dir=None, extensions=None)[source]

Return a list of configs in config_dir.

Return type:

list[str]

Parameters:
  • config_dir (str) – directory to search

  • extensions (list) – filetypes to check (e.g. ['.yaml', '.json']).

Return type:

list

vcspull.config.filter_repos(config, path=None, vcs_url=None, name=None)[source]

Return a list list of repos from (expanded) config file.

path, vcs_url and name all support fnmatch.

Return type:

list[ConfigDict]

Parameters:
  • config (dict) – the expanded repo config in dict format.

  • path (str, Optional) – directory of checkout location, fnmatch pattern supported

  • vcs_url (str, Optional) – url of vcs remote, fn match pattern supported

  • name (str, Optional) – project name, fnmatch pattern supported

Returns:

Repos

Return type:

list

vcspull.config.is_config_file(filename, extensions=None)[source]

Return True if file has a valid config file type.

Return type:

bool

Parameters:
  • filename (str) – filename to check (e.g. mysession.json).

  • extensions (list or str) – filetypes to check (e.g. ['.yaml', '.json']).

Returns:

bool

Return type:

True if is a valid config file type