Python client for GitHub API
Quick Tour
Interacting with Pull Request
This project uses GitHub API to fetch information from GitHub using a Python wrapper.
You can find the exhaustive list of supported features in the documentation. For instance, you can retrieve basic information about your pull request as follows:
from ghapi.pulls import Repository, PullRequest
pr = PullRequest(Repository("frgfm", "torch-cam"), 187)
# Get the PR information
pr.get_info()
{'title': 'fix: Fixed zero division for weight computation in gradient based methods',
'created_at': '2022-09-18T17:08:50Z',
'description': 'This PR introduces an `eps` to all divisions in gradient methods to avoid NaNs.\r\n\r\nCloses #186',
'labels': [{'id': 1929545961,
'node_id': 'MDU6TGFiZWwxOTI5NTQ1OTYx',
'url': 'https://api.github.com/repos/frgfm/torch-cam/labels/type:%20bug',
'name': 'type: bug',
'color': 'd73a4a',
'default': False,
'description': "Something isn't working"},
{'id': 1929975543,
'node_id': 'MDU6TGFiZWwxOTI5OTc1NTQz',
'url': 'https://api.github.com/repos/frgfm/torch-cam/labels/ext:%20tests',
'name': 'ext: tests',
'color': 'f7e101',
'default': False,
'description': 'Related to test'},
{'id': 1929975788,
'node_id': 'MDU6TGFiZWwxOTI5OTc1Nzg4',
'url': 'https://api.github.com/repos/frgfm/torch-cam/labels/module:%20methods',
'name': 'module: methods',
'color': 'f7e101',
'default': False,
'description': 'Related to torchcam.methods'}],
'user': 'frgfm',
'mergeable': None,
'changed_files': 3,
'additions': 15,
'deletions': 8,
'base': {'branch': 'main', 'sha': '0a5e06051440e27de6027ec382517a2c71686298'},
'head': {'repo': 'frgfm/torch-cam',
'branch': 'grad-nans',
'sha': 'd49f4a3d847e130e99c3d20311e1450f074fd29f'}}
If you're interested in reviewing the pull request, you might be interested in the code diff:
# Retrieve the code diff
full_diff = pr.get_diff()
# Print the first diff section
print(full_diff["torchcam/methods/gradient.py"][0]["text"])
which yields:
- def _get_weights(self, class_idx: Union[int, List[int]], scores: Tensor, **kwargs: Any) -> List[Tensor]:
+ def _get_weights(
+ self, class_idx: Union[int, List[int]], scores: Tensor, eps: float = 1e-8, **kwargs: Any
+ ) -> List[Tensor]:
Setup
Python 3.6 (or higher) and pip/conda are required to install ghapi.
Stable release
You can install the last stable release of the package using pypi as follows:
pip install ghapi-client
or using conda:
conda install -c frgfm ghapi-client
Developer installation
Alternatively, if you wish to use the latest features of the project that haven't made their way to a release yet, you can install the package from source:
git clone https://github.com/frgfm/ghapi.git
pip install -e ghapi/.
What else
Documentation
The full package documentation is available here for detailed specifications.
Contributing
Feeling like extending the range of supported API feature? Or perhaps submitting a new feature idea? Any sort of contribution is greatly appreciated!
You can find a short guide in CONTRIBUTING to help grow this project!
License
Distributed under the Apache 2.0 License. See LICENSE for more information.
Metadata
Release files for ghapi-client 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ghapi-client-0.3.1.tar.gz | 29.6 kB | Without provenance | Details for ghapi-client-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ghapi_client-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for ghapi_client-0.3.1-py3-none-any.whl |
Total release size: 114.2 kB
Release files / ghapi-client-0.3.1.tar.gz
| Download URL | ghapi-client-0.3.1.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a53226eb4e2c2e638e9958147005a66956e7cda0f9ed825ab34963c4b5c75130
|
|
BLAKE2b-256 checksum How to use checksums |
7a8d35d67b252017af43ba9bf31bc58594f7c8423cbbfad4fce47b77482d63fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Release files / ghapi_client-0.3.1-py3-none-any.whl
| Download URL | ghapi_client-0.3.1-py3-none-any.whl |
|---|---|
| Size | 84.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
128771918e2f39ceed11e9cf04ac279d3e27cca32b611a06678ea5383fe30bee
|
|
BLAKE2b-256 checksum How to use checksums |
815918d106f032e3b713b50647a340fa9e24c46f879a7174634226dce7aea55b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.13
|
Security for ghapi-client 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.