clowder package

Submodules

clowder.clowder_app module

Clowder command line app

clowder.clowder_app.clowder_help(args)

Clowder help handler

clowder.clowder_app.create_parsers() → argparse.ArgumentParser

Configure clowder CLI parsers

Returns:Configured argument parser for clowder command
Return type:argparse.ArgumentParser
clowder.clowder_app.main() → None

Clowder command CLI main function

clowder.clowder_controller module

Clowder command controller class

class clowder.clowder_controller.ClowderController

Bases: object

Class encapsulating project information from clowder yaml for controlling clowder

Variables:
  • Optional[name] (str) – Clowder name
  • ..] projects (Tuple[ResolvedProject,) – List of all ResolvedProjects
  • ..] project_names (Tuple[str,) – All possible project names
  • ..] upstream_names (Tuple[str,) – All possible upstream names
  • ..] project_upstream_names (Tuple[str,) – All possible project and upstream names
  • ..] project_paths (Tuple[str,) – All possible project paths
  • ..] project_groups (Tuple[str,) – All possible project groups
  • ..] project_choices (Tuple[str,) – All possible project and group choices
  • ..] project_choices_with_default (Tuple[str,) – All possible project and group choices, including ‘default’
  • error (Optional[Exception]) – Exception from failing to load clowder yaml file
get_all_upstream_project_names() → Tuple[str, ...]

Returns all project names containing upstreams

Returns:All project names containing upstreams
Return type:Tuple[str, ..]
get_project_sha(project_id: int, short: bool = False) → str

Return current project commit sha

Returns:Current active commit sha
Return type:str
Raises:ClowderError
static get_projects_output(projects: Tuple[clowder.data.resolved_project.ResolvedProject, ...]) → Tuple[str, ...]

Returns all project paths/names output for specified projects

Parameters:..] projects (Tuple[ResolvedProject,) – Projects to get paths/names output of
Returns:All project paths
Return type:Tuple[str, ..]
get_timestamp(timestamp_project: str) → str

Return timestamp for project

Parameters:timestamp_project (str) – Project to get timestamp of current HEAD commit
Returns:Commit timestamp string
Return type:str
Raises:ClowderError
get_yaml(resolved: bool = False) → dict

Return python object representation of model objects

Parameters:resolved (bool) – Whether to return resolved yaml
Returns:YAML python object
Return type:dict
static validate_print_output(projects: Tuple[clowder.data.resolved_project.ResolvedProject, ...]) → None

Validate projects/groups and print output

Parameters:..] projects (Tuple[ResolvedProject,) – Projects to validate/print
validate_projects_exist() → None

Validate all projects exist on disk

Raises:ClowderError

clowder.clowder_repo module

Clowder repo utils

clowder.clowder_repo.add(files: str) → None

Add files in clowder repo to git index

Parameters:files (str) – Files to git add
clowder.clowder_repo.branches() → None

Print current local branches

clowder.clowder_repo.checkout(ref: str) → None

Checkout ref in clowder repo

Parameters:ref (str) – Ref to git checkout
clowder.clowder_repo.clean() → None

Discard changes in clowder repo

Equivalent to: git clean -ffdx

clowder.clowder_repo.commit(message: str) → None

Commit current changes in clowder repo

Parameters:message (str) – Git commit message
clowder.clowder_repo.get_saved_version_names() → Optional[Tuple[str, ...]]

Return list of all saved versions

Returns:All saved version names
Return type:Optional[Tuple[str, ..]]
Raises:ClowderError
clowder.clowder_repo.git_status() → None

Print clowder repo git status

Equivalent to: git status -vv

clowder.clowder_repo.init(url: str, branch: str) → None

Clone clowder repo from url

Parameters:
  • url (str) – URL of repo to clone
  • branch (str) – Branch to checkout
clowder.clowder_repo.print_status(fetch: bool = False) → None

Print clowder repo status

Parameters:fetch (bool) – Fetch before printing status
clowder.clowder_repo.pull() → None

Pull clowder repo upstream changes

clowder.clowder_repo.push() → None

Push clowder repo changes

clowder.clowder_repo.run_command(command: str) → None

Run command in clowder repo

Parameters:command (str) – Command to run

clowder.environment module

Clowder environment

class clowder.environment.ClowderEnvironment

Bases: object

clowder paths class

Variables:
ambiguous_clowder_yaml_error = None
clowder_config_dir = None
clowder_config_yaml = None
clowder_dir = None
clowder_git_repo_dir = None
clowder_repo_dir = None
clowder_repo_existing_file_error = None
clowder_repo_plugins_dir = None
clowder_repo_versions_dir = None
clowder_yaml = None
clowder_yaml_missing_source_error = None
current_dir = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/clowder/checkouts/latest/docs')
has_ambiguous_clowder_yaml_files() → bool

Check for ambiguous clowder yaml files

Returns:Whether abmigous clowder yaml files exist
Return type:bool
Raises:ClowderError

clowder.error module

Clowder error

exception clowder.error.ClowderError(error_type: clowder.error.ClowderErrorType, messages: Union[str, List[str]], error: Optional[Exception] = None, exit_code: Optional[int] = None)

Bases: Exception

Clowder error type

Variables:
  • error_type (ClowderErrorType) – Clowder error type
  • messages (List[str]) – List of messages to print
  • ..] groups (Tuple[Group,) – List of all Groups
class clowder.error.ClowderErrorType

Bases: enum.IntEnum

An enumeration.

AMBIGUOUS_CLOWDER_YAML = 5
CLOWDER_ALREADY_INITIALIZED = 22
CLOWDER_REPO_EXISTING_FILE = 70
CLOWDER_YAML_DUPLICATE_PATH = 49
CLOWDER_YAML_DUPLICATE_REMOTE_NAME = 47
CLOWDER_YAML_SOURCE_NOT_FOUND = 48
CLOWDER_YAML_UNKNOWN = 40
CONFIG_YAML_INVALID_CLOWDER_PATH = 66
CONFIG_YAML_UNKNOWN = 64
CONFIG_YAML_UNKNOWN_PROJECT = 65
DIRECTORY_EXISTS = 19
DUPLICATE_SAVED_VERSIONS = 8
FAILED_CREATE_DIRECTORY = 18
FAILED_EXECUTE_COMMAND = 10
FAILED_INIT = 9
FAILED_OPEN_FILE = 15
FAILED_REMOVE_DIRECTORY = 17
FAILED_REMOVE_FILE = 12
FAILED_SAVE_FILE = 14
FAILED_YAML_DUMP = 11
FILE_EXISTS = 13
GIT_ERROR = 6
INVALID_GIT_CONFIG_VALUE = 28
INVALID_GIT_PROTOCOL = 26
INVALID_GIT_SETTINGS_INIT_PARAMETERS = 29
INVALID_PROJECT_STATUS = 7
MISSING_CLOWDER_GIT_REPO = 35
MISSING_CLOWDER_REPO = 36
OFFLINE = 20
OPEN_FILE = 45
PARALLEL_COMMAND_FAILED = 16
PARALLEL_COMMAND_UNAVAILABLE = 27
PARSER_CREATION_FAILED = 71
PROJECT_NOT_FOUND = 72
PRUNE_NO_BRANCHES = 25
SAVE_DEFAULT_VERSION = 23
SOURCES_ALREADY_VALIDATED = 76
SOURCES_NOT_VALIDATED = 75
UNKNOWN = 3
UNKNOWN_CONFIG_TYPE = 21
USER_INTERRUPT = 4
VERSION_ALREADY_EXISTS = 24
WRONG_GROUP_TYPE = 77
WRONG_SOURCE_TYPE = 73
WRONG_SUBMODULES_TYPE = 78
WRONG_UPSTREAM_TYPE = 74
YAML_EMPTY_FILE = 44
YAML_JSONSCHEMA_VALIDATION_FAILED = 46
YAML_MISSING_FILE = 42
YAML_UNKNOWN = 41

clowder.logging module

Clowder logging utilities

clowder.logging.LOG_DEBUG(message: str, exception: Optional[BaseException] = None) → None

clowder.sitecustomize module

sitecustomize.py

Module contents

clowder module __init__