Skip to content

Commit a0339d1

Browse files
author
Panos
committed
first
0 parents  commit a0339d1

File tree

9 files changed

+837
-0
lines changed

9 files changed

+837
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
share/python-wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
MANIFEST
24+
25+
# Virtual environments
26+
venv/
27+
env/
28+
ENV/
29+
env.bak/
30+
venv.bak/
31+
32+
# IDE
33+
.vscode/
34+
.idea/
35+
*.swp
36+
*.swo
37+
38+
# OS
39+
.DS_Store
40+
.DS_Store?
41+
._*
42+
.Spotlight-V100
43+
.Trashes
44+
ehthumbs.db
45+
Thumbs.db

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 GitHub Trending CLI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# 🚀 GitHub Trending CLI
2+
3+
A simple and elegant command-line tool to browse GitHub trending repositories with interactive navigation and README viewing.
4+
5+
## ✨ Features
6+
7+
- 📊 **Browse trending repositories** from GitHub's trending page
8+
- 📅 **Multiple time ranges**: daily, weekly, and monthly trends
9+
- 🧭 **Interactive navigation** to explore repositories
10+
- 📖 **README viewer** to read project documentation directly in terminal
11+
- 🎨 **Beautiful, modern interface** with Unicode box drawing, language-specific emojis, and trending indicators
12+
-**Fast and lightweight** with minimal dependencies
13+
14+
## 🛠️ Installation
15+
16+
### Option 1: Install from source (Recommended)
17+
18+
```bash
19+
# Clone the repository
20+
git clone https://github.com/your-username/github-trending-cli.git
21+
cd github-trending-cli
22+
23+
# Create and activate virtual environment
24+
python3 -m venv venv
25+
source venv/bin/activate # On Windows: venv\Scripts\activate
26+
27+
# Install dependencies
28+
pip install -r requirements.txt
29+
30+
# Install the package
31+
pip install -e .
32+
```
33+
34+
### Option 2: Direct installation
35+
36+
```bash
37+
# Install dependencies
38+
pip install requests beautifulsoup4 lxml
39+
40+
# Run directly
41+
python -m github_trending.cli
42+
```
43+
44+
## ⚡ Quick Start
45+
46+
```bash
47+
# After installation, simply run:
48+
github-trending
49+
50+
# Or try different time ranges:
51+
github-trending --range weekly
52+
github-trending --range monthly
53+
```
54+
55+
## 🚀 Usage
56+
57+
### Basic Commands
58+
59+
```bash
60+
# Show today's trending repositories
61+
github-trending
62+
63+
# Show this week's trending repositories
64+
github-trending --range weekly
65+
66+
# Show this month's trending repositories
67+
github-trending --range monthly
68+
69+
# Short form
70+
github-trending -r weekly
71+
```
72+
73+
### Interactive Navigation
74+
75+
Once the tool displays the trending repositories, you can:
76+
77+
- **Enter a number (1-25)** to view a repository's README
78+
- **Enter 'list' or 'l'** to show the repository list again
79+
- **Enter 'quit' or 'q'** to exit the application
80+
81+
### Example Session
82+
83+
```bash
84+
$ github-trending --range weekly
85+
86+
════════════════════════════════════════════════════════════════════════════════
87+
🚀 GitHub Trending Repositories - Weekly 📊
88+
🌟 Discover the hottest projects on GitHub
89+
════════════════════════════════════════════════════════════════════════════════
90+
91+
┌─ 1. 📦 microsoft/TypeScript
92+
├─ 🔷 TypeScript
93+
├─ 🔥 95,234 stars (+234 today)
94+
└─ 📝 TypeScript is a superset of JavaScript that compiles to clean JavaScript...
95+
💡 Type '1' to view README
96+
────────────────────────────────────────────────────────────
97+
98+
┌─ 2. 📦 facebook/react
99+
├─ 🟨 JavaScript
100+
├─ 🔥 201,456 stars (+456 today)
101+
└─ 📝 A declarative, efficient, and flexible JavaScript library for building...
102+
💡 Type '2' to view README
103+
104+
════════════════════════════════════════════════════════════════════════════════
105+
📊 Found 25 trending repositories • Happy coding! 🎉
106+
════════════════════════════════════════════════════════════════════════════════
107+
108+
╔══════════════════════════════════════════════════════════╗
109+
║ 🧭 Navigation Menu ║
110+
╠══════════════════════════════════════════════════════════╣
111+
║ 📖 Enter a number (1-25) to view README ║
112+
║ 📋 Enter 'list' or 'l' to show repositories again ║
113+
║ 🚪 Enter 'quit' or 'q' to exit
114+
╚══════════════════════════════════════════════════════════╝
115+
116+
👉 Your choice: 1
117+
118+
================================================================================
119+
📦 Repository Details
120+
================================================================================
121+
📦 Name: microsoft/TypeScript
122+
🔗 URL: https://github.com/microsoft/TypeScript
123+
🏷️ Language: TypeScript
124+
⭐ Stars: 95234 (234 today)
125+
📝 Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript...
126+
127+
📖 Fetching README...
128+
129+
--------------------------------------------------------------------------------
130+
📖 README
131+
--------------------------------------------------------------------------------
132+
# TypeScript
133+
134+
TypeScript is a language for application-scale JavaScript...
135+
[README content continues...]
136+
137+
📖 Press Enter to continue...
138+
```
139+
140+
## 📁 Project Structure
141+
142+
```
143+
github-trending-cli/
144+
├── github_trending/
145+
│ ├── __init__.py # Package initialization
146+
│ ├── cli.py # Main CLI interface and argument parsing
147+
│ ├── scraper.py # GitHub trending page scraper
148+
│ └── display.py # Output formatting and display logic
149+
├── requirements.txt # Python dependencies
150+
├── setup.py # Package setup configuration
151+
└── README.md # This file
152+
```
153+
154+
## 🏗️ Architecture
155+
156+
The project follows a clean, modular architecture:
157+
158+
### `scraper.py` - GitHubTrendingScraper
159+
- Handles HTTP requests to GitHub trending page
160+
- Parses HTML content using BeautifulSoup
161+
- Extracts repository information (name, stars, language, etc.)
162+
- Fetches README content from repositories
163+
164+
### `display.py` - DisplayManager
165+
- Manages all terminal output formatting
166+
- Handles repository list display
167+
- Provides README pagination for long content
168+
- Responsive terminal width detection
169+
170+
### `cli.py` - GitHubTrendingCLI
171+
- Command-line argument parsing
172+
- Interactive navigation loop
173+
- Coordinates between scraper and display components
174+
- Error handling and user input validation
175+
176+
## 🔧 Dependencies
177+
178+
- **requests** (≥2.28.0) - HTTP requests to GitHub
179+
- **beautifulsoup4** (≥4.11.0) - HTML parsing
180+
- **lxml** (≥4.9.0) - Fast XML/HTML parser backend
181+
182+
## 🎯 Usage Examples
183+
184+
### View Today's Trending
185+
```bash
186+
github-trending
187+
```
188+
189+
### View Weekly Trending
190+
```bash
191+
github-trending --range weekly
192+
```
193+
194+
### View Monthly Trending
195+
```bash
196+
github-trending -r monthly
197+
```
198+
199+
## 🤝 Contributing
200+
201+
1. Fork the repository
202+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
203+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
204+
4. Push to the branch (`git push origin feature/amazing-feature`)
205+
5. Open a Pull Request
206+
207+
## 📝 License
208+
209+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
210+
211+
## 🐛 Troubleshooting
212+
213+
### Common Issues
214+
215+
**Issue**: `ModuleNotFoundError: No module named 'github_trending'`
216+
**Solution**: Make sure you've installed the package with `pip install -e .`
217+
218+
**Issue**: `requests.exceptions.ConnectionError`
219+
**Solution**: Check your internet connection and GitHub's availability
220+
221+
**Issue**: Empty repository list
222+
**Solution**: GitHub might be rate-limiting requests. Wait a few minutes and try again.
223+
224+
### Getting Help
225+
226+
If you encounter any issues:
227+
228+
1. Check the [Issues](https://github.com/your-username/github-trending-cli/issues) page
229+
2. Create a new issue with detailed information about the problem
230+
3. Include your Python version and operating system
231+
232+
## 🌟 Acknowledgments
233+
234+
- GitHub for providing the trending repositories page
235+
- The Python community for excellent libraries like requests and BeautifulSoup
236+
- All the amazing open-source projects that inspire us daily
237+
238+
---
239+
240+
**Happy exploring! 🚀**

github_trending/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
GitHub Trending CLI Tool
3+
A simple command-line interface to browse GitHub trending repositories.
4+
"""
5+
6+
__version__ = "1.0.0"
7+
__author__ = "GitHub Trending CLI"

0 commit comments

Comments
 (0)