clowder.model package

Submodules

clowder.model.defaults module

Representation of clowder.yaml defaults

class clowder.model.defaults.Defaults(defaults)

Bases: object

clowder.yaml Defaults model class

Variables:
  • ref (str) – Default ref
  • remote (str) – Default remote name
  • source (str) – Default source name
  • protocol (str) – Default git protocol
  • depth (int) – Default depth
  • recursive (bool) – Default recursive value
  • timestamp_author (str) – Default timestamp author
get_yaml()

Return python object representation for saving yaml

Returns:YAML python object
Return type:dict

clowder.model.fork module

Representation of clowder.yaml fork

class clowder.model.fork.Fork(fork, path, source, protocol)

Bases: object

clowder.yaml Project model class

Variables:
  • name (str) – Project name
  • path (str) – Project relative path
  • remote_name (str) – Git remote name
full_path()

Return full path to project

Returns:Project’s full file path
Return type:str
get_yaml()

Return python object representation for saving yaml

Returns:YAML python object
Return type:dict
status()

Return formatted fork status

Returns:Formatted fork status
Return type:str
url(protocol)

Return project url

Parameters:protocol (str) – Git protocol (‘ssh’ or ‘https’)

clowder.model.group module

Representation of clowder.yaml group

class clowder.model.group.Group(group, defaults, sources)

Bases: object

clowder.yaml Group model class

Variables:
  • name (str) – Group name
  • depth (int) – Group depth default
  • recursive (bool) – Group recursive default
  • timestamp_author (str) – Group timestamp author default
  • ref (str) – Group ref default
  • remote_name (str) – Group remote name default
  • source (Source) – Group source default
  • projects (list[Project]) – List of group’s projects
existing_branch(branch, is_remote)

Checks if given branch exists in any project

Parameters:
  • branch (str) – Branch to check for
  • is_remote (bool) – Check for remote branch
Returns:

True, if at least one branch exists

Return type:

bool

existing_projects()

Validate existence status of all projects

Returns:True, if all projects exist
Return type:bool
get_yaml(resolved=False)

Return python object representation of model objects

get_yaml(self, resolved=False)
Parameters:resolved (Optional[bool]) – Whether to return resolved yaml
Returns:YAML python object
Return type:dict
is_dirty()

Check if group has at least one dirty project

Returns:True, if any project is dirty
Return type:bool
is_valid()

Validate status of all projects

Returns:True, if all projects are valid
Return type:bool
print_existence_message()

Print existence validation message for projects in group

print_validation()

Print validation message for projects in group

clowder.model.project module

Representation of clowder.yaml project

class clowder.model.project.Project(project, group, defaults, sources)

Bases: object

clowder.yaml Project model class

Variables:
  • name (str) – Project name
  • path (str) – Project relative path
  • ref (str) – Default git ref
  • remote (str) – Default remote name
  • depth (int) – Depth to clone project repo
  • recursive (bool) – Whether to recursively clone submodules
  • source (Source) – Default source
  • fork (Fork) – Project’s associated Fork
branch(*args, **kwargs)

Wrapper

checkout(*args, **kwargs)

Wrapper

clean(*args, **kwargs)

Wrapper

clean_all(*args, **kwargs)

Wrapper

diff(*args, **kwargs)

Wrapper

existing_branch(branch, is_remote)

Check if branch exists

Parameters:
  • branch (str) – Branch to check for
  • is_remote (bool) – Check for remote branch
Returns:

True, if branch exists

Return type:

bool

fetch_all(*args, **kwargs)

Wrapper

formatted_project_path()

Return formatted project path

Returns:Formatted string of full file path
Return type:str
full_path()

Return full path to project

Returns:Project’s full file path
Return type:str
get_current_timestamp()

Return timestamp of current HEAD commit

Returns:HEAD commit timestamp
Return type:str
get_yaml(resolved=False)

Return python object representation for saving yaml

get_yaml(resolved=False)
Parameters:resolved (Optional[bool]) – Return default ref rather than current commit sha
Returns:YAML python object
Return type:dict
herd(**kwargs)

Clone project or update latest from upstream

herd(branch=None, tag=None, depth=0, rebase=False, parallel=False)
Keyword Arguments:
 
  • branch (str) – Branch to attempt to herd
  • tag (str) – Tag to attempt to herd
  • depth (int) – Git clone depth. 0 indicates full clone, otherwise must be a positive integer
  • rebase (bool) – Whether to use rebase instead of pulling latest changes
  • parallel (bool) – Whether command is being run in parallel, affects output
  • protocol (str) – Git protocol (‘ssh’ or ‘https’)
is_dirty()

Check if project is dirty

Returns:True, if dirty
Return type:bool
is_valid()

Validate status of project

Returns:True, if not dirty or if the project doesn’t exist on disk
Return type:bool
print_validation()

Print validation message for project

prune(*args, **kwargs)

Wrapper

reset(timestamp=None, parallel=False)

Reset project branch to upstream or checkout tag/sha as detached HEAD

reset(timestamp=None, parallel=False)
Parameters:
  • timestamp (Optional[str]) – Reset to commit at timestamp, or closest previous commit
  • parallel (Optional[bool]) – Whether command is being run in parallel, affects output
run(commands, ignore_errors, parallel=False)

Run commands or script in project directory

run(commands, ignore_errors, parallel=False)
Parameters:
  • commands (list[str]) – Commands to run
  • ignore_errors (bool) – Whether to exit if command returns a non-zero exit code
  • parallel (Optional[bool]) – Whether commands are being run in parallel, affects output
start(*args, **kwargs)

Wrapper

stash(*args, **kwargs)

Wrapper

status(padding=None)

Return formatted status for project

Parameters:padding (Optional[int]) – Amount of padding to use for printing project on left and current ref on right
Returns:Formatting project name and status
Return type:str
sync(protocol, rebase=False, parallel=False)

Sync fork project with upstream remote

sync(rebase=False, parallel=False)
Parameters:
  • rebase (Optional[bool]) – Whether to use rebase instead of pulling latest changes
  • parallel (Optional[bool]) – Whether command is being run in parallel, affects output
clowder.model.project.project_repo_exists(func)

If no git repo exists, print message and return

clowder.model.source module

Representation of clowder.yaml source

class clowder.model.source.Source(source)

Bases: object

clowder.yaml Source model class

Variables:
  • name (str) – Source name
  • url (str) – Source url
get_yaml()

Return python object representation for saving yaml

Returns:YAML python object
Return type:dict

Module contents