<jupyter_start><jupyter_text>Background information on reposSupports Python 3.6+<jupyter_code>import csv
import json
import os
import pprint

import requests
# get api token and set authorization
api_token = os.environ['GITHUB_API_TOKEN']
headers = {'Authorization': f'token {api_token}'}
# set url to a graphql endpoint
url = 'https://api.github.com/graphql'
# add a json query
query = """
{
  organization(login: "nteract") {
    name
    repositories(first: 80) {
      nodes {
        name
        url
        description
        id
        pushedAt
        createdAt
      }
    }
  }
}
"""
# submit the request
r = requests.post(url=url, json={'query': query}, headers=headers)
result = r.json()
#result
import pandas as pd
repos = pd.DataFrame(result['data']['organization']['repositories']['nodes'], columns=['name', 'url', 'description', 'pushedAt', 'createdAt'])
#repos<jupyter_output><empty_output><jupyter_text>Reports<jupyter_code># By repo name
sorted_df = repos.sort_values(by=['name'])
sorted_df
# by creation date
sorted_df = repos.sort_values(by=['createdAt'])
sorted_df
# Top 10 repos by latest activity (pushedAt)
sorted_df = repos.sort_values(by=['pushedAt'], ascending=False)
sorted_df.head(10)
# output data to a csv
# df.to_csv('issue_report.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1345119139123751, 'fraction_numerical': 0.006149116064565719, 'mean_word_length': 4.786666666666667, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '532678', 'license': 'MIT', 'n_tokens_mistral': 455, 'n_tokens_neox': 438, 'n_words': 104, 'path': 'nteract-repos.ipynb', 'repo_name': 'willingc/pyquery-ql', 'size': '1301'}