# AI GitHub
AI GitHub is a Python package that allows you to search for GitHub repositories using the GitHub API. It provides a simple interface to search for repositories based on different criteria.
## Benefits
- Easily search for GitHub repositories based on various criteria.
- Simple pagination support for browsing through search results.
- Easy integration with your Python projects.
## Installation
You can install the package using pip:
```bash
pip install github-ai
```
## Usage
### Basic Search
```python
import github_ai
# Basic search
results = github_ai.search(query="machine learning")
print(f"Found {results['total_count']} repositories.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
### Search with Pagination
```python
import github_ai
# Search with pagination
results = github_ai.search(query="machine learning", per_page=5, page=1)
print(f"Found {results['total_count']} repositories.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
### Search by User
```python
import github_ai
# Search repositories by a specific user
results = github_ai.search_by_user(user="username")
print(f"Found {results['total_count']} repositories.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
### Search by Language
```python
import github_ai
# Search repositories by programming language
results = github_ai.search_by_language(language="python")
print(f"Found {results['total_count']} Python repositories.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
### Search by Topic
```python
import github_ai
# Search repositories by topic
results = github_ai.search_by_topic(topic="data science")
print(f"Found {results['total_count']} Data Science repositories.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
### Cloning a Repository
```python
import github_ai
import os
try:
# Search with pagination
results = github_ai.search(query="machine learning", per_page=5, page=1)
def format_search_results(results):
formatted_results = []
for index, repo in enumerate(results['items'], start=1):
formatted_result = f"[{index:02d}] {repo['name']} - {repo['html_url']}"
print(formatted_result)
formatted_results.append(repo['html_url'])
return formatted_results
formatted_results = format_search_results(results)
except Exception as e:
print(f"An error occurred: {e}")
# Get user input
git_index = input("Enter the number of the repository to download: ")
try:
git_index = int(git_index)
if 1 <= git_index <= len(formatted_results):
repo_url = formatted_results[git_index - 1]
os.system(f"git clone {repo_url}")
else:
print("Invalid number entered.")
except ValueError:
print("Please enter a valid number.")
```
### Additional Usage Example
```python
import github_ai
# Search repositories by stars
results = github_ai.search(query="stars:>1000", per_page=10)
print(f"Found {results['total_count']} repositories with more than 1000 stars.")
for repo in results['items']:
print(f"Name: {repo['name']}")
print(f"Owner: {repo['owner']['login']}")
print(f"Stars: {repo['stargazers_count']}")
print(f"Forks: {repo['forks_count']}")
print(f"URL: {repo['html_url']}")
print('-' * 40)
```
## Acknowledgements
Thank you for using AI GitHub! If you find it useful, consider starring the repository on [GitHub](https://mrfidal.in/basic-pip-package/github-ai).
### Thanks
Thank you for using AI GitHub! If you find it useful, consider starring the repository on GitHub.
Raw data
{
"_id": null,
"home_page": "https://mrfidal.in/basic-pip-package/github-ai",
"name": "github-ai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Fidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/6b/b6/9c700578f3758060f195ca8ac0aa0fae95ed0ecc5315ca1a3189641d18ab/github-ai-1.0.1.tar.gz",
"platform": null,
"description": "# AI GitHub\r\n\r\nAI GitHub is a Python package that allows you to search for GitHub repositories using the GitHub API. It provides a simple interface to search for repositories based on different criteria.\r\n\r\n## Benefits\r\n\r\n- Easily search for GitHub repositories based on various criteria.\r\n- Simple pagination support for browsing through search results.\r\n- Easy integration with your Python projects.\r\n\r\n## Installation\r\n\r\nYou can install the package using pip:\r\n\r\n```bash \r\npip install github-ai\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Search\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Basic search\r\nresults = github_ai.search(query=\"machine learning\")\r\n\r\nprint(f\"Found {results['total_count']} repositories.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n### Search with Pagination\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Search with pagination\r\nresults = github_ai.search(query=\"machine learning\", per_page=5, page=1)\r\n\r\nprint(f\"Found {results['total_count']} repositories.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n### Search by User\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Search repositories by a specific user\r\nresults = github_ai.search_by_user(user=\"username\")\r\n\r\nprint(f\"Found {results['total_count']} repositories.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n### Search by Language\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Search repositories by programming language\r\nresults = github_ai.search_by_language(language=\"python\")\r\n\r\nprint(f\"Found {results['total_count']} Python repositories.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n### Search by Topic\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Search repositories by topic\r\nresults = github_ai.search_by_topic(topic=\"data science\")\r\n\r\nprint(f\"Found {results['total_count']} Data Science repositories.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n### Cloning a Repository\r\n\r\n```python\r\nimport github_ai\r\nimport os\r\n\r\ntry:\r\n # Search with pagination\r\n results = github_ai.search(query=\"machine learning\", per_page=5, page=1)\r\n\r\n def format_search_results(results):\r\n formatted_results = []\r\n for index, repo in enumerate(results['items'], start=1):\r\n formatted_result = f\"[{index:02d}] {repo['name']} - {repo['html_url']}\"\r\n print(formatted_result)\r\n formatted_results.append(repo['html_url'])\r\n return formatted_results\r\n\r\n formatted_results = format_search_results(results)\r\n \r\nexcept Exception as e:\r\n print(f\"An error occurred: {e}\")\r\n\r\n# Get user input\r\ngit_index = input(\"Enter the number of the repository to download: \")\r\n\r\ntry:\r\n git_index = int(git_index)\r\n if 1 <= git_index <= len(formatted_results):\r\n repo_url = formatted_results[git_index - 1]\r\n os.system(f\"git clone {repo_url}\")\r\n else:\r\n print(\"Invalid number entered.\")\r\nexcept ValueError:\r\n print(\"Please enter a valid number.\")\r\n```\r\n\r\n### Additional Usage Example\r\n\r\n```python\r\nimport github_ai\r\n\r\n# Search repositories by stars\r\nresults = github_ai.search(query=\"stars:>1000\", per_page=10)\r\n\r\nprint(f\"Found {results['total_count']} repositories with more than 1000 stars.\")\r\nfor repo in results['items']:\r\n print(f\"Name: {repo['name']}\")\r\n print(f\"Owner: {repo['owner']['login']}\")\r\n print(f\"Stars: {repo['stargazers_count']}\")\r\n print(f\"Forks: {repo['forks_count']}\")\r\n print(f\"URL: {repo['html_url']}\")\r\n print('-' * 40)\r\n```\r\n\r\n## Acknowledgements\r\n\r\nThank you for using AI GitHub! If you find it useful, consider starring the repository on [GitHub](https://mrfidal.in/basic-pip-package/github-ai).\r\n\r\n### Thanks\r\n\r\nThank you for using AI GitHub! If you find it useful, consider starring the repository on GitHub.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool to search GitHub repositories using the GitHub API",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://mrfidal.in/basic-pip-package/github-ai"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "536545c065c4ee5397294c2f666c098a0b5a690084eac7fbf3fa67c926a4eaf8",
"md5": "31f76e3737c6bc591ef624d02a812e59",
"sha256": "0b7dac9e08c44cebf5410682d567c99ffa0eaf64b8d8d7e9d914fec437703395"
},
"downloads": -1,
"filename": "github_ai-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "31f76e3737c6bc591ef624d02a812e59",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4005,
"upload_time": "2024-06-12T19:35:52",
"upload_time_iso_8601": "2024-06-12T19:35:52.743501Z",
"url": "https://files.pythonhosted.org/packages/53/65/45c065c4ee5397294c2f666c098a0b5a690084eac7fbf3fa67c926a4eaf8/github_ai-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6bb69c700578f3758060f195ca8ac0aa0fae95ed0ecc5315ca1a3189641d18ab",
"md5": "819168119a7453d50b9037e4b2253267",
"sha256": "3e8ba65cc326b0dffc2f6bddd4cc43a622863abde7ea36abdec340bce54ad33e"
},
"downloads": -1,
"filename": "github-ai-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "819168119a7453d50b9037e4b2253267",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3853,
"upload_time": "2024-06-12T19:35:55",
"upload_time_iso_8601": "2024-06-12T19:35:55.157841Z",
"url": "https://files.pythonhosted.org/packages/6b/b6/9c700578f3758060f195ca8ac0aa0fae95ed0ecc5315ca1a3189641d18ab/github-ai-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 19:35:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "github-ai"
}