Extract some stats for Code.gov using the Github GraphQL API
To view the Jupyter Notebook
This repository is useful once you have all unique repository owners (AKA agencies for Code.gov) or if you use the U.S. Federal Agency List compiled by Github.
The goal is to extract some basic repository information / stats from the Code.gov inventory. The data we are interested in is:
- Owner name
- Owner email
- Owner Github URL
- Repo's name with owner
- Repo's created at date
- Total fork count
- Is the repo a fork
- Total watchers
- Total stargazers
- Total pull requests
- Total issues
Eg.
{
'created_at': '2012-01-26T17:30:51Z',
'fork_count': 24,
'is_fork': False,
'issues': 50,
'name_with_owner': 'cfpb/django-nudge',
'owner_email': '',
'owner_name': 'Consumer Financial Protection Bureau',
'owner_url': 'https://github.com/cfpb',
'pull_request': 13,
'stargazers': 75,
'watchers': 13
}
This Jupyter Notebook makes use of Github GraphQL API (API v4). If you are unfamiliar with GraphQL and/or Github API v4 we recommend reading:
We also recommend taking a look at Github's GraphQL API v4 Explorer. With this tool you will be able to test the GraphQL queries that we use in this notebook.
- Python 3.6+ - Should work with other versions of Python but has not been tested. To install Python please take a look at: https://www.python.org/downloads/
We are using Pipenv in this project to manage our dependencies. To install pipenv please take a look at: https://pipenv.readthedocs.io/en/latest/#install-pipenv-today
After installing pipenv you can install the dependencies by executing:
$ pipenv install
- Jupyter Notebook: To read up on how to install please visit Jupyter.org - Install
- graphcool/python-graphql-client
pip install graphqlclient
- All other dependencies are found in the standard library
If you are using pipenv you need to activate the virtual environment that was created. To activate this project's virtualenv, run pipenv shell
.
$ pipenv shell
$ (your-virtualenv) jupyter notebook
To exit the virtualenv just execute the exit
command.
Alternatively, you can run a command inside the virtualenv with pipenv run
.
$ pipenv run jupyter notebook
Here’s how you can help contribute to this repo:
- Code of Conduct
- Community is very important for us. We strive to be welcoming to all. To achive this we have drafted a Code of Conduct, please take a look at it and leave us any feedback as a Github issue
- See something that's not quite right? Have a question or some feedback? Please let us know by creating a Github Issue on this repo.
- Want to be more hands on? We evaluate and accept Pull Requests!