proteobench.github.gh module#
This module provides the GithubProteobotRepo class to interact with GitHub repositories related to Proteobot and Proteobench. It allows cloning repositories, reading JSON result files, creating branches, committing changes, and creating pull requests.
- class proteobench.github.gh.GithubProteobotRepo(token: str | None = None, clone_dir: str = None, clone_dir_pr: str = None, proteobench_repo_name: str = 'Proteobench/Results_quant_ion_DDA', proteobot_repo_name: str = 'Proteobot/Results_quant_ion_DDA', username: str = 'Proteobot')[source]#
Bases:
objectA class to interact with GitHub repositories related to Proteobot and Proteobench, allowing cloning, committing, and creating pull requests.
- Parameters:
token (str | None, optional) – GitHub access token for authenticated access. Defaults to None.
clone_dir (str) – Directory where the repository will be cloned.
clone_dir_pr (str) – Directory for cloning pull request repositories.
proteobench_repo_name (str, optional) – Name of the Proteobench repository. Defaults to “Proteobench/Results_quant_ion_DDA”.
proteobot_repo_name (str, optional) – Name of the Proteobot repository. Defaults to “Proteobot/Results_quant_ion_DDA”.
username (str, optional) – GitHub username for authentication. Defaults to “Proteobot”.
- static clone(remote_url: str, clone_dir: str) Repo[source]#
Clone the repository from the given remote URL to the specified directory.
- Parameters:
- Returns:
The local repository object.
- Return type:
Repo
- Raises:
exc.NoSuchPathError – If the specified directory does not exist.
exc.InvalidGitRepositoryError – If the directory is not a valid Git repository.
- clone_repo() Repo[source]#
Clone the Proteobench repository using either an anonymous or authenticated GitHub access token.
If token is provided, it will use authenticated access; otherwise, it will clone anonymously.
- Returns:
The local repository object.
- Return type:
Repo
- clone_repo_anonymous() Repo[source]#
Clone the Proteobench repository anonymously with a shallow clone (without authentication).
- Returns:
The cloned repository object.
- Return type:
Repo
- clone_repo_pr() Repo[source]#
Clone the Proteobot repository (for pull request management) using either an anonymous or authenticated GitHub access token.
If token is provided, it will use authenticated access; otherwise, it will clone anonymously.
- Returns:
The local repository object for the pull request.
- Return type:
Repo
- commit(commit_name: str, commit_message: str) None[source]#
Stage all changes, commits them with the given commit name and message, and pushes the changes to the remote repository.
- create_branch(branch_name: str) <property object at 0x754c619856c0>[source]#
Create a new branch and checks it out.
- Parameters:
branch_name (str) – The name of the new branch to be created.
- Returns:
The newly created branch object.
- Return type:
Repo.head
- create_pull_request(commit_name: str, commit_message: str) int[source]#
Create a pull request on GitHub using the PyGithub API.
- get_remote_url_anon() str[source]#
Return the remote URL of the repository to be cloned anonymously (public access).
- Returns:
The public GitHub URL of the Proteobench repository.
- Return type:
- read_results_json_repo() DataFrame[source]#
Read all JSON result files from the cloned Proteobench repository.
- Returns:
A Pandas DataFrame containing aggregated results from multiple JSON files.
- Return type:
pd.DataFrame