Skip to content

Latest commit

 

History

History
255 lines (180 loc) · 6.33 KB

File metadata and controls

255 lines (180 loc) · 6.33 KB

github3.py

Release v|version|.

github3.py is wrapper for the GitHub API written in python. The design of github3.py is centered around having a logical organization of the methods needed to interact with the API. Let me demonstrate this with a code example.

Example

Let's get information about a user:

from github3 import login

gh = login('sigmavirus24', password='<password>')

sigmavirus24 = gh.me()
# <User [sigmavirus24:Ian Cordasco]>

print(sigmavirus24.name)
# Ian Cordasco
print(sigmavirus24.login)
# sigmavirus24
print(sigmavirus24.followers_count)
# 4

for f in gh.followers():
    print(str(f))

kennethreitz = gh.user('kennethreitz')
# <User [kennethreitz:Kenneth Reitz]>

print(kennethreitz.name)
print(kennethreitz.login)
print(kennethreitz.followers_count)

followers = [str(f) for f in gh.followers('kennethreitz')]

More Examples

.. toctree::
    :maxdepth: 2

    examples/two_factor_auth
    examples/oauth
    examples/gist
    examples/git
    examples/github
    examples/issue
    examples/iterators.rst
    examples/logging
    examples/octocat


Modules

.. toctree::
    :maxdepth: 1

    api
    auths
    events
    gists
    git
    github
    issues
    models
    notifications
    orgs
    pulls
    repos
    search_structs
    structs
    users

Internals

For objects you're not likely to see in practice. This is useful if you ever feel the need to contribute to the project.

.. toctree::
    :maxdepth: 1

    models
    decorators


Installation

$ pip install github3.py
# OR:
$ git clone git://github.com/sigmavirus24/github3.py.git github3.py
$ cd github3.py
$ python setup.py install

Dependencies

Contributing

I'm maintaining two public copies of the project. The first can be found on GitHub and the second on BitBucket. I would prefer pull requests to take place on GitHub, but feel free to do them via BitBucket. Please make sure to add yourself to the list of contributors in AUTHORS.rst, especially if you're going to be working on the list below.

Contributor Friendly Work

In order of importance:

Documentation

I know I'm not the best at writing documentation so if you want to clarify or correct something, please do so.

Examples

Have a clever example that takes advantage of github3.py? Feel free to share it.

Running the Unittests

The tests are generally run using tox. Tox can be installed lke so:

pip install tox

We test against PyPy and the following versions of Python:

  • 2.6
  • 2.7
  • 3.2
  • 3.3
  • 3.4

If you simply run tox it will run tests against all of these versions of python and run flake8 against the codebase as well. If you want to run against one specific version, you can do:

tox -e py34

And if you want to run tests against a specific file, you can do:

tox -e py34 -- tests/uni/test_github.py

To run the tests, tox uses py.test so you can pass any options or parameters to py.test after specifying --. For example, you can get more verbose output by doing:

tox -e py34 -- -vv
.. toctree::

    testing


Contact

  • Twitter: @sigmavirus24
  • Private email: graffatcolmingov [at] gmail
  • Mailing list: github3.py [at] librelist.com

Latest Version's Changes

The full history of the project is available as well.

.. toctree::

    project_changelog

Testimonials

gotta hand it to @sigmavirus24 ... github3.py is really well written. It will soon be powering the github stuff on @workforpie

— Brad Montgomery # (@bkmontgomery) April 20, 2013

awesome github v3 api wrapper in python github.com/sigmavirus24/g#

— Mahdi Yusuf (@myusuf3) October 17, 2012

@sigmavirus24 github3 is awesome! Made my life much easier tonight, which is a very good thing.

— Mike Grouchy (@mgrouchy) March 26, 2013

@sigmavirus24 "There are so many Python client libraries for GitHub API, I tried all of them, and my conclusion is: github3.py is the best."

— Hong Minhee (@hongminhee) March 23, 2013

@sigmavirus24 I cannot wait to use your github package for #zci. Do you have it packaged for debian by any chance?

— Zygmunt Krynicki (@zygoon) March 26, 2013

Developing against github3.py's API is a joy, kudos to @sigmavirus24

— Alejandro Gomez (@dialelo) March 27, 2013