Skip to main content

A CLI tool for managing GitHub repos

Project description

ghops

PyPI Version Python Support Test Coverage Build Status License

A powerful, modular CLI tool for managing GitHub repositories at scale. Automate repository operations, track PyPI packages, manage licenses, and coordinate social media promotion for your open source projects.

๐ŸŽ‰ What's New in v0.6.0

  • ๐Ÿ—๏ธ Complete Architecture Overhaul: Fully modular design with separated command modules
  • ๐Ÿงช Comprehensive Testing: 138 tests with 86% coverage - robust and reliable
  • โšก Enhanced Performance: Optional API checks with --no-pypi-check and --no-pages-check flags
  • ๐Ÿ“ฑ Social Media Automation: Template-driven posting for Twitter, LinkedIn, and Mastodon
  • โš™๏ธ Advanced Configuration: TOML/JSON support with environment variable overrides
  • ๐Ÿ“„ License Management: Full GitHub API integration with template customization
  • ๐ŸŒ GitHub Pages Detection: Multi-method detection for documentation sites
  • ๐Ÿ”ง Error Resilience: Graceful handling of network failures and edge cases

โœจ Features

๐Ÿ—๏ธ Robust Architecture

  • Modular Design: Clean separation of concerns with dedicated command modules
  • Extensible: Easy to add new commands and functionality
  • Well-Tested: 86% test coverage with 138 comprehensive unit and integration tests
  • Error Resilient: Graceful handling of network failures and edge cases

๐Ÿ“ฆ Repository Management

  • Multi-Repository Operations: Clone, update, and monitor multiple repositories efficiently
  • Intelligent Sync: Smart pull with rebase, conflict detection, and resolution strategies
  • Progress Tracking: Real-time progress bars and detailed operation summaries
  • Flexible Discovery: Recursive repository scanning with configurable ignore patterns

๐Ÿ PyPI Integration

  • Smart Package Detection: Automatically detects Python packages from pyproject.toml, setup.py, and setup.cfg
  • Publishing Status: Real-time PyPI status checking with version comparison
  • Package Analytics: Track which projects are published and their update status
  • Performance Optimized: Optional PyPI checks for faster operations

๐Ÿ“„ License Management

  • GitHub Integration: Fetch license templates directly from GitHub API
  • Bulk Operations: Add licenses to multiple repositories at once
  • Template Customization: Automatic placeholder replacement for author details
  • Multiple Formats: Support for all major open source licenses

๐ŸŒ GitHub Pages Detection

  • Multi-Method Detection: Scans for Jekyll, MkDocs, Sphinx, and custom configurations
  • URL Construction: Automatically builds GitHub Pages URLs from repository metadata
  • Documentation Tracking: Monitor which projects have active documentation sites

๐Ÿ“ฑ Social Media Automation

  • Content Generation: Template-driven post creation for Twitter, LinkedIn, and Mastodon
  • Smart Sampling: Random repository selection with configurable filters
  • Dry Run Support: Preview posts before publishing
  • Rate Limiting: Built-in posting frequency controls and daily limits

โš™๏ธ Configuration Management

  • Flexible Formats: Support for both JSON and TOML configuration files
  • Environment Overrides: All settings can be controlled via environment variables
  • Default Merging: Intelligent combination of defaults, file settings, and overrides
  • Example Generation: Built-in config template generation

๐Ÿš€ Installation

You can install ghops via pip:

pip install ghops

Or from source:

git clone https://github.com/queelius/ghops.git
cd ghops
make install

โšก Quick Start

# Generate a configuration file with examples
ghops config generate

# Clone all your repos
ghops get

# Update all repos in the current directory
ghops update -r

# Check the status of all repos (includes PyPI and GitHub Pages info)
ghops status -r

# Quick status check without PyPI detection
ghops status --no-pypi-check

# Sample repositories for social media posting
ghops social sample --size 3

# Create social media posts (dry run)
ghops social post --dry-run

๐Ÿ“‹ Commands

Repository Operations

  • ghops get [options] - Clone all repositories from your GitHub account

    • --users USER [USER ...] - Specify GitHub usernames to clone from
    • --dir DIRECTORY - Target directory for cloning
    • --ignore REPO [REPO ...] - Skip specific repositories
    • --license LICENSE - Add license files during cloning
    • --dry-run - Preview operations without making changes
  • ghops update [options] - Update local repositories

    • -r, --recursive - Search for repositories recursively
    • --auto-commit - Commit changes before pulling
    • --commit-message MESSAGE - Custom commit message
    • --conflicts {abort,ours,theirs} - Conflict resolution strategy
    • --prompt - Ask before pushing changes
    • --license LICENSE - Add/update license files during update
  • ghops status [options] - Comprehensive repository status

    • -r, --recursive - Search recursively
    • --json - Output in JSON format for scripting
    • --no-pypi-check - Skip PyPI status checks (faster)
    • --no-pages-check - Skip GitHub Pages detection
    • --summary - Show summary statistics

Configuration Management

  • ghops config generate - Create example configuration file
  • ghops config show - Display current configuration with all merges applied

License Operations

  • ghops license list [--json] - Show available license templates
  • ghops license show LICENSE [--json] - Display specific license template

Social Media Automation

  • ghops social sample [options] - Preview repository selection

    • --size N - Number of repositories to sample
    • --json - Output in JSON format
  • ghops social post [options] - Generate and post content

    • --size N - Number of posts to create
    • --dry-run - Preview posts without publishing
    • --platforms PLATFORM [PLATFORM ...] - Target specific platforms

๐Ÿ”ง Advanced Configuration

ghops uses a configuration file located at ~/.ghopsrc (JSON or TOML format). Set custom location with GHOPS_CONFIG environment variable.

Key Configuration Sections

PyPI Settings

[pypi]
check_by_default = true         # Include PyPI info in status command
timeout_seconds = 10            # API request timeout
include_test_pypi = false       # Also check test.pypi.org

Social Media Platforms

[social_media.platforms.twitter]
enabled = false
api_key = "your_api_key"
api_secret = "your_api_secret"
access_token = "your_access_token"
access_token_secret = "your_access_token_secret"

[social_media.platforms.twitter.templates]
pypi_release = "๐Ÿš€ New release: {package_name} v{version} is now available on PyPI! {pypi_url} #{package_name} #python #opensource"
github_pages = "๐Ÿ“– Updated documentation for {repo_name}: {pages_url} #docs #opensource"
random_highlight = "โœจ Working on {repo_name}: {description} {repo_url} #{language} #coding"

Posting Rules

[social_media.posting]
random_sample_size = 3          # Number of repos to randomly highlight
daily_limit = 5                 # Maximum posts per day
min_hours_between_posts = 2     # Minimum time between posts
exclude_private = true          # Don't post about private repos
exclude_forks = true            # Don't post about forked repos

๐Ÿ’ก Examples

Check Repository Status

# Full status with PyPI and GitHub Pages
ghops status -r

# Fast status check
ghops status --no-pypi-check

# JSON output for scripting
ghops status --json

Social Media Promotion

# See what repositories would be selected
ghops social sample --size 5

# Preview social media posts
ghops social post --dry-run --size 3

# Actually post (requires configured API credentials)
ghops social post --size 2

Repository Management

# Clone all your repositories
ghops get --dir ~/projects

# Update repositories recursively
ghops update -r --dir ~/projects

# Add MIT license to repositories during update
ghops update -r --license mit --license-name "Your Name" --license-email "you@example.com"

โšก Performance & Advanced Usage

Performance Options

  • Use --no-pypi-check for faster status checks when you don't need PyPI information
  • Use --no-pages-check to skip GitHub Pages detection
  • Configure max_concurrent_operations in config for better performance

PyPI Package Detection

The tool automatically detects Python packages by scanning for:

  • pyproject.toml files
  • setup.py files
  • setup.cfg files

It then checks PyPI to see if packages are published and shows version information.

๐Ÿงช Testing & Quality

  • 138 comprehensive tests covering all major functionality
  • 86% test coverage with unit and integration testing
  • Continuous integration with automated testing
  • Error handling for network failures and edge cases
  • Performance benchmarks for large repository sets
  • Mock testing for reliable external API testing

Test Coverage by Module

  • CLI & Commands: Complete argument parsing and execution testing
  • Configuration System: All file formats and environment override scenarios
  • PyPI Integration: Package detection, API calls, and error conditions
  • Social Media: Content generation, platform integration, and rate limiting
  • License Management: GitHub API integration and template processing
  • Status Reporting: Repository scanning, progress tracking, and output formatting

๐Ÿ—๏ธ Architecture

ghops follows a clean, modular architecture designed for maintainability and extensibility:

ghops/
โ”œโ”€โ”€ cli.py              # Main CLI entry point with argparse
โ”œโ”€โ”€ __main__.py         # Python module execution entry
โ”œโ”€โ”€ commands/           # Modular command implementations
โ”‚   โ”œโ”€โ”€ get.py         # Repository cloning logic
โ”‚   โ”œโ”€โ”€ update.py      # Repository updating and syncing
โ”‚   โ”œโ”€โ”€ status.py      # Status reporting and analytics
โ”‚   โ””โ”€โ”€ license.py     # License management operations
โ”œโ”€โ”€ config.py          # Configuration loading and merging
โ”œโ”€โ”€ utils.py           # Shared utilities and helpers
โ”œโ”€โ”€ pypi.py            # PyPI package detection and API
โ””โ”€โ”€ social.py          # Social media content generation

Design Principles

  • Separation of Concerns: Each module has a single, well-defined responsibility
  • Error Resilience: Graceful handling of network failures and edge cases
  • Performance: Optional API checks and concurrent operations
  • Extensibility: Easy to add new commands and features
  • Testability: Comprehensive test coverage with mocking for external services

๐Ÿค Contributing

Contributions are welcome! Please see the Contributing Guide for more details.

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


ยฉ 2025 Alex Towell

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghops-0.6.0.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghops-0.6.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file ghops-0.6.0.tar.gz.

File metadata

  • Download URL: ghops-0.6.0.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for ghops-0.6.0.tar.gz
Algorithm Hash digest
SHA256 a1fc32deb1e8dc1b9e2a2ce42702af3185e003d379b7a0b2f05589695b0bf1d0
MD5 2546ce1d5d74fc8909f765728c3424e6
BLAKE2b-256 76e16b445cf93f0f62b3dbfd34e3eed8256fdb23bb7d8ed207ba8c5633761c4d

See more details on using hashes here.

File details

Details for the file ghops-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: ghops-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for ghops-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40f103a2f4f98d7fe3f38f01e8737c127d09204e806c4cd87ac51c1c9f9bd825
MD5 060c5ffc20030fe64891b6ecd4f05b20
BLAKE2b-256 dc14f291b2b054cc74659860a732e69fb7812f38e7d2d8c7735d8bbbd2023e7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page