pygitpub package¶
Subpackages¶
Submodules¶
pygitpub.configs module¶
All configurations for pygitpub
- class pygitpub.configs.ConfigAlgo[source]¶
Bases:
ConfigParameters to control the algorithm
- affiliation = 'owner'¶
- base_dir = '~/git'¶
- dryrun = False¶
- fork = True¶
- owner_login = None¶
- private = True¶
- public = True¶
- repos = []¶
- show_extra = True¶
- class pygitpub.configs.ConfigCleanup[source]¶
Bases:
ConfigParameters to control the cleanup
- delete_non_push_runs = False¶
- class pygitpub.configs.ConfigGithub[source]¶
Bases:
ConfigParameters for your github account
- apikey = <pytconf.param.Unique object>¶
pygitpub.main module¶
main entry point to the program
- pygitpub.main.for_each_repo(func: Callable[[Repository], list[str]]) None[source]¶
run func on every repo in parallel and print the lines it returns, in repo order
- pygitpub.main.get_affiliation() str[source]¶
validate the affiliation parameter and return it in the form github wants
- pygitpub.main.get_parallel_github() Github[source]¶
A client for walking the repos from several threads. The default client sleeps 0.25s before every request, which serializes the threads and alone made cleanup take 15 minutes; that pause is dropped. The 1s pause between writes stays, so parallel deletes do not trip github’s secondary limits.
- pygitpub.main.get_workflow_names(repo: Repository) dict[int, str][source]¶
a run’s own name is not always its workflow’s (pages runs are ‘pages build and deployment’ of workflow ‘pages-build-deployment’)
- pygitpub.main.graphql_bad_runs(bad_state: Callable[[str], bool], bad_conclusion: Callable[[str], bool]) list[tuple[str, str, str, int]][source]¶
Return (repo full name, workflow name, conclusion, run id) for every workflow that is not green on the default branch head commit of a repo.
Resolving statusCheckRollup is slow on github’s side (~4.5s per 50 repos) and cursor pagination would run the pages one after another, so the repos are split into small batches, each batch is one query with an aliased repository field per repo, and the batches run in parallel. Repos whose rollup state is bad then get one more query each to name the workflows. Only the head commit of the default branch is looked at, so a failed run on another branch, or a scheduled run on an older commit, does not show.
pygitpub.static module¶
version which can be consumed from within the module
Module contents¶
Initialize the module