pjkm.core.groups.sources

Remote group source management: clone, cache, and sync git repos of group definitions.

Attributes

Classes

SourceEntry

A registered group source.

GroupSourceManager

Manages remote git repositories that provide group definitions.

Module Contents

pjkm.core.groups.sources.CACHE_DIR[source]
pjkm.core.groups.sources.SOURCES_FILE[source]
class pjkm.core.groups.sources.SourceEntry(url, name='', path='', ref='')[source]

A registered group source.

Parameters:
url[source]
name[source]
path = ''[source]
ref = ''[source]
property cache_dir: pathlib.Path[source]
Return type:

pathlib.Path

property groups_dir: pathlib.Path[source]

The directory containing group YAML files within the cached repo.

Return type:

pathlib.Path

to_dict()[source]
Return type:

dict[str, str]

classmethod from_dict(data)[source]
Parameters:

data (dict[str, Any])

Return type:

SourceEntry

class pjkm.core.groups.sources.GroupSourceManager[source]

Manages remote git repositories that provide group definitions.

Sources are registered in ~/.pjkm/sources.yaml and cached in ~/.pjkm/cache/sources/<name>/. They can also be declared in .pjkmrc.yaml under group_sources:.

load()[source]

Load registered sources from ~/.pjkm/sources.yaml.

Return type:

None

load_from_defaults(sources)[source]

Load additional sources from UserDefaults.group_sources.

Parameters:

sources (list[dict[str, str]])

Return type:

None

save()[source]

Persist the source list to ~/.pjkm/sources.yaml.

Return type:

None

property sources: list[SourceEntry][source]
Return type:

list[SourceEntry]

add(url, name='', path='', ref='')[source]

Register a new group source.

Parameters:
Return type:

SourceEntry

remove(name)[source]

Remove a registered source by name. Returns True if found.

Parameters:

name (str)

Return type:

bool

sync(name=None)[source]

Clone or pull registered sources.

Parameters:

name (str | None) – If given, only sync this source. Otherwise sync all.

Returns:

List of (source, success, message) tuples.

Return type:

list[tuple[SourceEntry, bool, str]]

get_all_group_dirs()[source]

Return (source_name, groups_dir) for all cached sources that exist.

Return type:

list[tuple[str, pathlib.Path]]