Skip to main content

Python client for the GitHub API

Project description

Python client for GitHub API

CI Status Documentation Status Test coverage percentage black bandit

PyPi Status Anaconda pyversions license

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghapi-client-0.3.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

ghapi_client-0.3.1-py3-none-any.whl (84.6 kB view details)

Uploaded Python 3

File details

Details for the file ghapi-client-0.3.1.tar.gz.

File metadata

  • Download URL: ghapi-client-0.3.1.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for ghapi-client-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a53226eb4e2c2e638e9958147005a66956e7cda0f9ed825ab34963c4b5c75130
MD5 851a86d4523ee6af3b266fe90bd2b62a
BLAKE2b-256 7a8d35d67b252017af43ba9bf31bc58594f7c8423cbbfad4fce47b77482d63fa

See more details on using hashes here.

File details

Details for the file ghapi_client-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ghapi_client-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 84.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for ghapi_client-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 128771918e2f39ceed11e9cf04ac279d3e27cca32b611a06678ea5383fe30bee
MD5 203b404654a73b31108a5b2608003e2e
BLAKE2b-256 815918d106f032e3b713b50647a340fa9e24c46f879a7174634226dce7aea55b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page