Created
May 3, 2024 17:41
-
-
Save richardliaw/3946d3078cf03860460d0d93355a3e86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from datetime import datetime | |
| def get_issues_with_ray_in_title(repo_name): | |
| issues = [] | |
| page = 1 | |
| # headers = {'Authorization': 'token YOUR_GITHUB_TOKEN'} | |
| while True: | |
| issues_url = f"https://api.github.com/repos/{repo_name}/issues?page={page}&per_page=100&state=open" | |
| response = requests.get(issues_url)# headers=headers) | |
| if response.status_code == 200: | |
| page_issues = response.json() | |
| if not page_issues: | |
| break | |
| issues.extend(page_issues) | |
| page += 1 | |
| else: | |
| print(f"Failed to fetch issues from page {page}. Status code: {response.status_code}") | |
| break | |
| filtered_issues = [issue for issue in issues if 'ray' in issue['title'].lower()] | |
| return filtered_issues | |
| def days_since_last_update(updated_at): | |
| last_update_date = datetime.strptime(updated_at, "%Y-%m-%dT%H:%M:%SZ") | |
| return (datetime.utcnow() - last_update_date).days | |
| # Example usage | |
| from tabulate import tabulate | |
| repo_name = "vllm-project/vllm" | |
| issues_with_ray = get_issues_with_ray_in_title(repo_name) | |
| headers = ["Issue Title", "URL", "Author", "Days Since Last Update"] | |
| table = [] | |
| for issue in issues_with_ray: | |
| days_since_update = days_since_last_update(issue['updated_at']) | |
| truncated_title = (issue['title'][:47] + '...') if len(issue['title']) > 50 else issue['title'] | |
| table.append([truncated_title, issue['html_url'], issue['user']['login'], days_since_update]) | |
| print(tabulate(table, headers, tablefmt="grid")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment