Transforming from a single-file script to a production-ready Python package with enhanced features and developer experience
Introduction #
After the success of my initial GitHub Repository Showcase project (v1.0.0), I’ve completely reimagined and rebuilt the entire system from the ground up. What started as a simple single-file Python script has evolved into a sophisticated, modular Python package that’s easier to maintain, extend, and deploy.
Visit GH ShowcaseWhat’s New in v2.0.0? #
Major Architectural Changes #
1. Modular Python Package Structure #
Gone are the days of a single main.py
file doing everything. v2.0.0 introduces a proper Python package structure:
src/github_showcase/
├── __init__.py
├── __main__.py # Entry point
├── config/
│ ├── __init__.py
│ └── settings.py # Centralized configuration
├── core/
│ ├── __init__.py
│ └── html_generator.py # HTML generation logic
└── utils/
├── __init__.py
├── blog_mapper.py # Blog URL mapping
├── github_api.py # GitHub API interactions
└── rate_limit.py # Rate limiting & error handling
2. Professional Package Installation #
# Install in development mode
pip install -e .
# Run the showcase generator
python -m github_showcase
3. Enhanced Configuration Management #
All settings are now centralized in config/settings.py
:
# GitHub Configuration
GITHUB_USERNAME = "vsingh55"
EXCLUDE_REPOS = ["vsingh55/vsingh55"]
OUTPUT_FILE = "index.html"
BLOG_BASE_URL = "https://blogs.vijaysingh.cloud"
# Technology Filters
TECH_FILTERS = [
"azure", "aws", "gcp", "docker", "kubernetes",
"terraform", "ansible", "devsecops", "python"
# ... and many more
]
# Blog Mapping Configuration
BLOG_MAPPING = {
"NBA-Analytics-Data-Lake": "data-lake",
"myGH-showcase": "mygh-showcase",
"DevSecOps-Pipeline": "project-devsecops-pipeline-pro",
# ... repository to blog slug mappings
}
Technical Deep Dive #
Architecture Overview #
Core Components Breakdown #
1. GitHub API Handler (utils/github_api.py
)
#
- Fetches repositories with pagination support
- Filters out forks, archived, and private repositories
- Sorts by last push date for relevance
- Robust error handling and debugging
def get_all_repositories() -> List[Dict]:
repos = []
page = 1
rate_limiter = RateLimitHandler()
while True:
url = f"https://api.github.com/users/{GITHUB_USERNAME}/repos?page={page}&per_page=100"
response = rate_limiter.make_request(url)
batch = response.json()
if not batch:
break
valid_repos = [
repo for repo in batch
if not repo['archived'] and
not repo['private'] and
not repo['fork'] and
repo['full_name'] not in EXCLUDE_REPOS
]
repos.extend(valid_repos)
page += 1
return sorted(repos, key=lambda r: r.get('pushed_at', ''), reverse=True)
2. Rate Limiting System (utils/rate_limit.py
)
#
- Intelligent rate limit detection and handling
- Exponential backoff with jitter
- GitHub token support for higher limits
- Comprehensive retry logic
class RateLimitHandler:
def __init__(self):
self.base_delay = 1
self.max_retries = 3
self.jitter_range = (1, 5)
def handle_rate_limit(self, response: requests.Response) -> Optional[int]:
if response.status_code == 403 and 'rate limit exceeded' in response.text.lower():
reset_time = int(response.headers.get('X-RateLimit-Reset', 0))
current_time = int(time.time())
wait_time = max(reset_time - current_time, 0)
jitter = random.uniform(*self.jitter_range)
return wait_time + jitter
return None
3. Blog Integration System (utils/blog_mapper.py
)
#
- Maps repositories to corresponding blog posts
- Flexible URL generation
- Clean separation of blog logic
def get_blog_link(repo_name: str) -> str | None:
slug = BLOG_MAPPING.get(repo_name)
if slug:
return f"{BLOG_BASE_URL}/{slug}"
return None
4. Enhanced HTML Generator (core/html_generator.py
)
#
- Modern, responsive design with dark/light themes
- Advanced filtering and search capabilities
- Sticky positioning for better UX
- Mobile-optimized responsive layout
UI/UX Improvements #
Visual Enhancements #
- Animated gradient headers with smooth color transitions
- Dual theme support (light/dark) with persistent preferences
- Improved typography with better font hierarchy
- Enhanced mobile responsiveness with optimized layouts
- Interactive elements with hover effects and smooth transitions
Functional Improvements #
- Real-time search across all repository content
- Multi-technology filtering with checkbox interface
- Sticky filter sidebar for better navigation
- Responsive table design with optimized column widths
- Smart blog integration showing “Coming Soon” for unmapped repositories
Installation & Setup #
For Users (Quick Start) #
# Clone and set up
git clone https://github.com/vsingh55/myGH-showcase.git
cd myGH-showcase
# Install in development mode
pip install -e .
# Generate your showcase
python -m github_showcase
# Preview locally
python -m http.server 8000
For Your Own Website #
- Fork the repository on GitHub
- Update configuration in
src/github_showcase/config/settings.py
:GITHUB_USERNAME = "your-username" BLOG_BASE_URL = "https://your-blog.com" BLOG_MAPPING = { "your-repo": "your-blog-slug" }
- Enable GitHub Pages in repository settings
- Push changes - GitHub Actions will automatically deploy
Advanced Features #
Environment Variable Support #
# Optional: Set GitHub token for higher rate limits
export GITHUB_TOKEN="your_github_token"
# Load from .env file (supported)
echo "GITHUB_TOKEN=your_token" > .env
Customizable Technology Filters #
Easily modify the technology stack shown in filters:
TECH_FILTERS = [
"azure", "aws", "gcp", "docker", "kubernetes",
"terraform", "ansible", "devsecops", "gitlab",
"github-actions", "ci/cd", "jenkins", "python"
]
Blog Integration #
Map your repositories to corresponding blog posts:
BLOG_MAPPING = {
"NBA-Analytics-Data-Lake": "data-lake",
"DevSecOps-Pipeline": "project-devsecops-pipeline-pro",
"Weather-Dashboard": "weather-dashboard"
}
Deployment & CI/CD #
Automated GitHub Actions Workflow #
name: Deploy GitHub Showcase
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 * * 0' # Weekly updates
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: pip install -e .
- name: Generate showcase
run: python -m github_showcase
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Performance & Features #
Key Performance Indicators #
- Build Time: < 30 seconds for complete deployment
- Page Load: < 1 second on broadband connections
- Responsive Design: Optimized for all device sizes
- Accessibility: WCAG compliant with proper contrast ratios
Migration from v1.0.0 #
If you’re upgrading from v1.0.0, here’s what changed:
Structure Changes #
# Old v1.0.0 structure
main.py
requirements.txt
.github/workflows/deploy.yml
# New v2.0.0 structure
src/github_showcase/
├── config/settings.py # Your configurations go here
├── core/html_generator.py
└── utils/
├── github_api.py
├── blog_mapper.py
└── rate_limit.py
setup.py
requirements.txt
Configuration Migration #
Move your settings from main.py
variables to src/github_showcase/config/settings.py
:
# Old way (v1.0.0)
GITHUB_USERNAME = "vsingh55" # In main.py
# New way (v2.0.0)
GITHUB_USERNAME = "vsingh55" # In config/settings.py
🤝 Contributing #
The new modular structure makes contributing much easier:
- Fork the repository
- Create a feature branch:
git checkout -b feat/amazing-feature
- Make changes in the appropriate module
- Add tests if applicable
- Submit a pull request
Areas for Contribution #
- UI/UX improvements - enhance the visual design
- New filtering options - add more filter categories
- Mobile optimization - improve mobile experience
- Internationalization - add multi-language support
- Performance optimization - enhance loading speeds
Conclusion #
GitHub RepoHub Showcase v2.0.0 represents a complete architectural overhaul that transforms a simple script into a production-ready Python package. The new modular structure, enhanced features, and improved developer experience make it an ideal solution for developers, teams, and organizations looking to showcase their GitHub repositories professionally.
Key Takeaways #
- Modular architecture improves maintainability and extensibility
- Professional packaging enables easy installation and distribution
- Enhanced UI/UX provides better user engagement
- Robust error handling ensures reliable operation
- Flexible configuration allows easy customization
Whether you’re a solo developer looking to showcase your projects or an organization wanting to highlight your open-source contributions, GitHub RepoHub Showcase v2.0.0 provides the tools and flexibility you need.
Ready to showcase your GitHub repositories like never before? Give GitHub RepoHub Showcase v2.0.0 a try and let me know what you think!
Happy coding! 🚀
Reply by Email