Skip to content
Get information and analytics about GitHub organizations
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples
getorg
.gitignore
.travis.yml
LICENSE
README.md
github_deploy_key.enc
setup.py

README.md

getorg

Github has a good API for some things, but there are many queries that the Github API does not natively support in one easy call. Organization-level queries are a particular pain point. Getorg is a project (very much in beta) to make it easy to get many different kinds of information and analytics about Github repositories and organizations.

Getorg uses the pygithub library for querying the Github API. It is built for python 3 (python 2.6 does not work, python 2.7 currently works, but is not guaranteed to be supported in the future).

Installation

Basic functionality

pip install getorg

Mapping functionality in Jupyter notebooks (assuming Jupyter is installed)

pip install getorg ipyleaflet
jupyter nbextension enable --py ipyleaflet

Dependencies

Required (installed by pip)

  • githubPy library for querying the Github API.
  • geopy (specifically Nominatim) for geolocating locations.
  • retrying for dealing with timeouts and API rate limits

Recommended (not installed by pip)

  • Jupyter notebook, ipywidgets, and ipyleaflets for plotting maps.

Usage

(See also the Jupyter notebooks in the examples folder)

Initialization

from github import Github
import getorg

# A file named ghlogin.py, containing my login key in the variable gh_key
# Get an API key (for just querying, give it no write permissions) at https://github.com/settings/tokens
import ghlogin

# You can leave login_or_token blank, but then you only get 60 queries an hour
gh = Github(login_or_token=ghlogin.gh_key)

If you're in a Jupyter notebook with IPyleaflet support

In [4]: org_leaflet_map, org_location_dict, org_metadata_dict = getorg.orgmap.map_orgs(gh, "getorg")

In [5]: org_leaflet_map
Out[5]: [a map should be displayed]

In [6]: org_location_dict
Out[6]: {'https://api.github.com/users/staeiou': Location(Berkeley, Alameda County, California, United States of America, (37.8708393, -122.2728638, 0.0))}

In [7]: org_metadata_dict
Out[7]: 
{'duplicate_count': 0,
 'error_count': 0,
 'no_loc_count': 0,
 'user_loc_count': 1}
 
In [8]: getorg.orgmap.output_html_cluster_map(org_location_dict,"cluster_map")
Out[8]: "Written map to cluster_map/map.html"

Or if you are not in a Jupyter notebook

In [4]: map, org_location_dict, org_metadata_dict = getorg.orgmap.map_orgs(gh,"getorg")

In [5]: org_location_dict
Out[5]: 
{'https://api.github.com/users/staeiou': Location(Berkeley, Alameda County, California, United States of America, (37.8708393, -122.2728638, 0.0))}

In [6]: getorg.orgmap.output_html_cluster_map(org_location_dict,"cluster_map")
Out[6]: "Written map to cluster_map/map.html"

Credits

Getorg is a package based on work originally done in some Jupyter notebooks with JamiesHQ, Carreau and namisaghaei.

You can’t perform that action at this time.