gitconductor.cli module
Main CLI arguments.
-
class gitconductor.cli.CursorRestoringGroup(*args, **kwargs)[source]
Bases: RichGroup
Click group that restores Rich terminal cursor state after each invocation.
-
main(*args, **kwargs)[source]
Run the command and restore the cursor before returning.
- Return type:
object
gitconductor.gitlab module
GitLab-related constructs.
-
class gitconductor.gitlab.GitlabGroup(**data)[source]
Bases: GitlabInstance
A GitLab group convenience class.
-
...
-
build()[source]
Build each project object.
- Return type:
None
- Returns:
None
-
cfg: Settings | None
-
property count: int
How many repositories are in the full group structure?
- Returns:
Total number of projects in all recursive subgeoups.
- Return type:
int
-
dump()[source]
Dump to file.
- Return type:
None
-
fullname: str
-
gitlab_key: str
-
group: Any | None
-
property members: list
Get members.
- Returns:
Number of members.
- Return type:
int
-
model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
model_post_init(_GitlabGroup__context=None)[source]
Post-init function calls.
- Return type:
None
-
name: str
-
property path: Path
Auto-generated path.
- Returns:
Project path.
- Return type:
pathlib.Path
-
projects: list[str]
-
rebuild(cfg)[source]
Rebuild the objects when reloaded (new directories, etc.).
- Parameters:
cfg (Path) – Serialised .pkl file.
- Return type:
None
- Returns:
None
-
recursive_command(command, **kwargs)[source]
Recursively walk down group tree, finding projects and executing commands.
- Parameters:
-
- Returns:
List of returns from each command execution.
- Return type:
None
-
source: str | None
-
subgroup: bool
-
subgroups: list[str]
-
property visibility: str
Project visibility.
- Returns:
Project visibility (private, internal, public).
- Return type:
str
-
class gitconductor.gitlab.GitlabInstance(**data)[source]
Bases: BaseModel
A GitLab generic instance convenience class.
-
...
-
cfg: Settings | None
-
flat: bool
-
gitlab_key: str
-
model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
root: Path
-
server: Any | None
-
property toplevel_dir: Path
What is the top level work directory?
- Returns:
Directory name.
- Return type:
pathlib.Path
-
class gitconductor.gitlab.GitlabProject(**data)[source]
Bases: GitlabInstance
A GitLab project convenience class.
-
add(fnames, all_)[source]
Add files to staging area.
- Return type:
None
- Returns:
None
-
branch(name=None)[source]
Make branch in a repository.
- Return type:
None
- Returns:
None
-
checkout(name=None)[source]
Checkout a branch in a repository.
- Return type:
None
- Returns:
None
-
clone(resume=False)[source]
Clone a repository.
- Parameters:
resume (bool) – Reuse an existing matching repository when present.
- Return type:
None
- Returns:
None
-
commit(message)[source]
Add files to staging area.
- Return type:
None
- Returns:
None
-
fullname: str
-
git: Any | None
-
gitlab_key: str
-
property is_python_package: bool
Is this project a Python package?
- Returns:
Is this project a Python package?
- Return type:
bool
-
property members: list
Get members.
- Returns:
Number of members.
- Return type:
int
-
model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
model_post_init(_GitlabProject__context=None)[source]
Post-init function calls.
- Return type:
None
-
name: str
-
property path: Path
Auto-generated path.
- Returns:
Project path.
- Return type:
pathlib.Path
-
project: Any
-
push()[source]
Push recursively.
- Return type:
None
- Returns:
None
-
pyinstall(pm='uv pip', editable=False, index=None)[source]
Install Python package.
- Return type:
None
- Returns:
None
-
pyreqs()[source]
Generate requirements.txt file for Python package.
- Return type:
None
- Returns:
None
-
property python_package_name: str
What is the name of the Python package?
- Returns:
Name of the Python package.
- Return type:
str
-
pywheel()[source]
Generate wheel file for Python package.
- Return type:
None
- Returns:
None
-
recursive_command(command, **kwargs)[source]
Trick to execute a command recursively on a project to keep code the same elsewhere.
- Parameters:
-
- Returns:
List of returns from each command execution.
- Return type:
None
-
rows: list
-
status()[source]
Return git status.
- Return type:
None
- Returns:
None
-
validate_existing_clone()[source]
Validate an existing clone can be reused.
- Returns:
Existing repository.
- Return type:
Repo
-
property visibility: str
Project visibility.
- Returns:
Project visibility (private, internal, public).
- Return type:
str
-
gitconductor.gitlab.clone_target_path(remote, directory, flat)[source]
Determine the path a clone command will manage.
- Parameters:
remote (str) – HTTPS, HTTP, SSH, or scp-style GitLab URL.
directory (Path) – Directory passed to gitconductor clone.
flat (bool) – Whether clone output will use a flat layout.
- Returns:
Path to check before cloning.
- Return type:
Path
-
gitconductor.gitlab.parse_gitlab_remote(remote)[source]
Parse a GitLab group or project URL into API URL and full path.
- Parameters:
remote (str) – HTTPS, HTTP, SSH, or scp-style GitLab URL.
- Returns:
GitLab API base URL and group or project full path.
- Return type:
tuple[str, str]
gitconductor.output module
Outputs for user info.
-
class gitconductor.output.CloneProgress[source]
Bases: RemoteProgress
Override git.RemoteProgress to update progress bars.
-
error_lines: List[str]
-
last_op_code = None
-
other_lines: List[str]
-
update(op_code, cur_count, max_count=None, message='')[source]
Get updates from git, pass to rich output.
- Return type:
None
-
gitconductor.output.restore_cursor()[source]
Ensure the terminal cursor is visible.
- Return type:
None
gitconductor.visualise module
Visualisation options.
-
gitconductor.visualise.access(group, explicit=False, maxdepth=None)[source]
Make an access visualisation.
- Parameters:
group (GitlabGroup) – GitLab group instance.
explicit (bool) – Explicitly show all members of all groups/projects?
maxdepth (int | None) – Maximum recursion depth (0=PWD).
- Return type:
None
- Returns:
None
-
gitconductor.visualise.access_matrix(group, maxdepth=None)[source]
Make an access matrix visualisation.
- Parameters:
-
- Return type:
None
- Returns:
None
-
gitconductor.visualise.build_access(group, rows=None, depth=0, unique_ids=None, explicit=False, root=PosixPath('.'), maxdepth=None, colour_only=False)[source]
Iteratively build access lists.
- Parameters:
group (GitlabGroup | GitlabProject) – GitLab group instance.
rows (None | list[str]) – Previous table rows.
depth (int) – Depth inside the tree.
unique_ids (list[str] | None) – List of all unique IDs printed
explicit (bool) – Explicitly show all members of all groups/projects?
root (Path) – Top level directory.
maxdepth (int | None) – Maximum recursion depth (0=PWD).
colour_only (bool) – Only return the colour code for the access level.
- Returns:
New row to print to table.
- Return type:
list[str]
-
gitconductor.visualise.build_table(group, rows=None, depth=0, maxdepth=None)[source]
Iteratively build the table.
- Parameters:
group (GitlabGroup) – GitLab group instance.
rows (None | list[str]) – Previous table rows.
depth (int) – Depth inside the tree.
maxdepth (int | None) – Maximum recursion depth (0=PWD).
- Returns:
New row to print to table.
- Return type:
list[str]
-
gitconductor.visualise.build_tree(group, tree)[source]
Iteratively build the tree.
- Parameters:
-
- Returns:
Updated Tree instance.
- Return type:
Tree
-
gitconductor.visualise.membership_warning(group, error)[source]
Build a warning row for hidden membership.
- Parameters:
-
- Returns:
Warning row.
- Return type:
list[str]
-
gitconductor.visualise.table(group, maxdepth=None)[source]
Make a table visualisation.
- Parameters:
-
- Return type:
None
- Returns:
None
-
gitconductor.visualise.tree(group)[source]
Make a tree visualisation.
- Parameters:
group (GitlabGroup) – GitLab group instance.
- Return type:
None
- Returns:
None
-
gitconductor.visualise.visible_members(group)[source]
Safely list visible members.
- Parameters:
group (GitlabGroup | GitlabProject) – GitLab group or project.
- Returns:
Members plus a warning row when access is hidden.
- Return type:
tuple[list, list[str] | None]
Module contents
GitLab wrapper.