introduction.rst
1 Introduction 2 ============ 3 4 PyGithub is a Python library to use the `Github API v3 <http://developer.github.com/v3>`__. 5 With it, you can manage your `Github <http://github.com>`__ resources (repositories, user profiles, organizations, etc.) from Python scripts. 6 7 Should you have any question, any remark, or if you find a bug, 8 or if there is something you can do with the API but not with PyGithub, 9 please `open an issue <https://github.com/PyGithub/PyGithub/issues>`__. 10 11 (Very short) tutorial 12 --------------------- 13 14 First create a Github instance:: 15 16 from github import Github 17 18 # Authentication is defined via github.Auth 19 from github import Auth 20 21 # using an access token 22 auth = Auth.Token("access_token") 23 24 # Public Web Github 25 g = Github(auth=auth) 26 27 # Github Enterprise with custom hostname 28 g = Github(auth=auth, base_url="https://{hostname}/api/v3") 29 30 Then play with your Github objects:: 31 32 for repo in g.get_user().get_repos(): 33 print(repo.name) 34 repo.edit(has_wiki=False) 35 # to see all the available attributes and methods 36 print(dir(repo)) 37 38 To close connections after use:: 39 40 g.close() 41 42 Download and install 43 -------------------- 44 45 This package is in the `Python Package Index 46 <http://pypi.python.org/pypi/PyGithub>`__, so ``pip install PyGithub`` should 47 be enough. You can also clone it on `Github 48 <http://github.com/PyGithub/PyGithub>`__. 49 50 Licensing 51 --------- 52 53 PyGithub is distributed under the GNU Lesser General Public Licence. 54 See files COPYING and COPYING.LESSER, as requested by `GNU <http://www.gnu.org/licenses/gpl-howto.html>`__. 55 56 What next? 57 ---------- 58 59 You need to use a Github API and wonder which class implements it? `Reference of APIs <https://pygithub.readthedocs.io/en/latest/apis.html>`__. 60 61 You want all the details about PyGithub classes? `Reference of Classes <https://pygithub.readthedocs.io/en/latest/github_objects.html>`__. 62 63 Projects using PyGithub 64 ----------------------- 65 66 (`Open an issue <https://github.com/PyGithub/PyGithub/issues>`__ if you want to be listed here, I'll be glad to add your project) 67 68 * `Github-iCalendar <http://danielpocock.com/github-issues-as-an-icalendar-feed>`__ returns all of your Github issues and pull requests as a list of tasks / VTODO items in iCalendar format. 69 * `DevAssistant <http://devassistant.org>`_ 70 * `Upverter <https://upverter.com>`__ is a web-based schematic capture and PCB layout tool for people who design electronics. Designers can attach a Github project to an Upverter project. 71 * `Notifico <http://n.tkte.ch>`__ receives messages (such as commits and issues) from services and scripts and delivers them to IRC channels. It can import/sync from Github. 72 * `Tratihubis <http://pypi.python.org/pypi/tratihubis/>`__ converts Trac tickets to Github issues 73 * https://github.com/fga-gpp-mds/2018.1-Cardinals - website that shows metrics for any public repository (issues, commits, pull requests etc) 74 * https://github.com/CMB/cligh 75 * https://github.com/natduca/quickopen uses PyGithub to automatically create issues 76 * https://gist.github.com/3433798 77 * https://github.com/zsiciarz/aquila-dsp.org 78 * https://github.com/robcowie/virtualenvwrapper.github 79 * https://github.com/kokosing/git-gifi - Git and github enhancements to git. 80 * https://github.com/csurfer/gitsuggest - A tool to suggest github repositories based on the repositories you have shown interest in 81 * https://github.com/gomesfernanda/some-github-metrics - Python functions for relevant metrics on GitHub repositories 82 * https://github.com/SOM-Research/Gitana - a SQL-based Project Activity Inspector 83 * https://github.com/plus3it/satsuki - Automate GitHub releases and uploading binary release assets 84 * `check-in <https://github.com/webknjaz/check-in>`_ — Python CLI distribution that allows user to use GitHub Checks API as a bot. 85 * https://github.com/hasii2011/gittodoistclone - Convert GitHub issues to Todoist tasks 86 87 They talk about PyGithub 88 ------------------------ 89 90 * http://stackoverflow.com/questions/10625190/most-suitable-python-library-for-github-api-v3 91 * http://stackoverflow.com/questions/12379637/django-social-auth-github-authentication 92 * http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/py-pygithub/ 93 * https://bugzilla.redhat.com/show_bug.cgi?id=910565