Skip to main content

Modern Python CLI for automating GitHub Classroom assignment management

Project description

Classroom Pilot

A comprehensive Python CLI tool for automating GitHub Classroom assignment management with modular workflow orchestration, repository operations, and secret management.

PyPI version Python Support Tests

๐ŸŽฏ Overview

Classroom Pilot provides instructors with a powerful, modern CLI to automate GitHub Classroom workflows:

  • ๐Ÿ Modern Python CLI - Type-safe, intuitive commands with rich help and output
  • ๐Ÿ“ฆ PyPI Package - Simple installation: pip install classroom-pilot
  • ๐Ÿ”ง Modular Architecture - Organized command structure for different workflow areas
  • ๐Ÿ” Smart Repository Discovery - Automated filtering and batch operations
  • ๐Ÿ” Secret Management - Secure distribution of tokens and credentials
  • โš™๏ธ Configuration-Driven - Flexible, reusable assignment setups
  • ๐Ÿ›ก๏ธ Enterprise Support - Custom GitHub hosts and internal Git systems
  • ๐ŸŽฏ Instructor-Focused - Excludes instructor repos from batch operations automatically

๐Ÿ“ฆ Installation

Quick Install (Recommended)

# Install from PyPI
pip install classroom-pilot

# Verify installation
classroom-pilot --help

Development Installation

# Clone repository
git clone https://github.com/hugo-valle/classroom-pilot.git
cd classroom-pilot

# Install with Poetry
poetry install
poetry shell

# Or install in development mode
pip install -e .

Requirements

  • Python 3.10+ (3.11+ recommended)
  • Git for repository operations
  • GitHub CLI (optional, for enhanced authentication)

๐Ÿš€ Quick Start

1. Basic Configuration

Create an assignment configuration file:

# Create assignment.conf
cat > assignment.conf << 'EOF'
# GitHub Classroom Configuration
CLASSROOM_URL="https://classroom.github.com/classrooms/123/assignments/456"
TEMPLATE_REPO_URL="https://github.com/instructor/assignment-template"
ASSIGNMENT_FILE="homework.py"

# Authentication
GITHUB_TOKEN_FILE="github_token.txt"

# Optional: Secrets to distribute
SECRETS_LIST="API_KEY,DATABASE_URL"
EOF

2. Command Structure

Classroom Pilot uses a modular command structure:

# Main command groups
classroom-pilot assignments    # Assignment setup and orchestration
classroom-pilot repos         # Repository operations and collaboration
classroom-pilot secrets       # Secret and token management
classroom-pilot automation    # Scheduling and batch processing

# Legacy commands (for backward compatibility)
classroom-pilot setup         # Interactive assignment setup
classroom-pilot run           # Complete workflow execution

3. Common Workflows

# Setup a new assignment (interactive)
classroom-pilot assignments setup

# Discover student repositories
classroom-pilot repos fetch --config assignment.conf

# Add secrets to all student repos
classroom-pilot secrets add --config assignment.conf

# Run orchestrated workflow
classroom-pilot assignments orchestrate --config assignment.conf

# Check what would happen (dry-run)
classroom-pilot --dry-run assignments orchestrate

๐Ÿ”ง Command Reference

Assignment Management

# Setup new assignment configuration
classroom-pilot assignments setup

# Orchestrate complete assignment workflow
classroom-pilot assignments orchestrate [--config FILE] [--dry-run]

# Manage assignment templates
classroom-pilot assignments manage [--config FILE]

Repository Operations

# Fetch student repositories
classroom-pilot repos fetch [--config FILE]

# Manage collaborators
classroom-pilot repos collaborator add|remove [--config FILE]

Secret Management

# Add secrets to repositories
classroom-pilot secrets add [--config FILE] [--secrets LIST]

# Remove secrets from repositories  
classroom-pilot secrets remove [--config FILE] [--secrets LIST]

# List existing secrets
classroom-pilot secrets list [--config FILE]

Automation & Scheduling

# Setup cron jobs for automation
classroom-pilot automation scheduler setup [--config FILE]

# Run batch operations
classroom-pilot automation batch [--config FILE]

Global Options

Option Description Example
--dry-run Preview actions without executing classroom-pilot --dry-run assignments orchestrate
--verbose Enable detailed logging classroom-pilot --verbose repos fetch
--config FILE Use custom configuration file classroom-pilot --config my.conf assignments setup
--help Show help for any command classroom-pilot assignments --help

โš™๏ธ Configuration

Assignment Configuration File

The assignment.conf file contains all settings for your assignment:

# Required: GitHub Classroom assignment URL
CLASSROOM_URL="https://classroom.github.com/classrooms/123/assignments/456"

# Required: Template repository URL
TEMPLATE_REPO_URL="https://github.com/instructor/assignment-template"

# Required: Assignment file to validate
ASSIGNMENT_FILE="homework.py"

# Optional: GitHub Enterprise support
GITHUB_HOSTS="github.enterprise.com,git.company.internal"

# Optional: Authentication
GITHUB_TOKEN_FILE="github_token.txt"

# Optional: Secrets management
SECRETS_LIST="API_KEY,DATABASE_URL,SECRET_TOKEN"

# Optional: Repository filtering
EXCLUDE_REPOS="template,example,demo"
INSTRUCTOR_REPOS="instructor-solution"

Environment Variables

Override configuration with environment variables:

# Custom GitHub hosts
export GITHUB_HOSTS="git.company.internal,github.enterprise.com"

# GitHub token
export GITHUB_TOKEN="ghp_your_token_here"

# Custom assignment file
export ASSIGNMENT_FILE="main.cpp"

# Run with overrides
classroom-pilot assignments orchestrate

๐Ÿ’ก Best Practices

Workflow Recommendations

  • Always test with --dry-run before making changes
  • Use --verbose for debugging configuration issues
  • Keep configuration files in version control with your assignment
  • Use environment variables for sensitive information
  • Test with single student first using filtered configuration

Security Guidelines

  • Store GitHub tokens securely using GITHUB_TOKEN_FILE
  • Use environment variables for sensitive configuration
  • Review --dry-run output before executing changes
  • Limit repository access with proper filtering
  • Audit secret distribution using verbose logging

Configuration Management

  • Separate configs per assignment for better organization
  • Use descriptive filenames like midterm-exam.conf
  • Document custom GitHub hosts in your assignment README
  • Validate URLs before running batch operations

๐Ÿ› ๏ธ Development

Project Architecture

classroom_pilot/
โ”œโ”€โ”€ __init__.py              # Package initialization
โ”œโ”€โ”€ __main__.py             # CLI entry point
โ”œโ”€โ”€ cli.py                  # Main Typer CLI interface
โ”œโ”€โ”€ config.py               # Configuration management
โ”œโ”€โ”€ bash_wrapper.py         # Legacy script wrapper
โ”œโ”€โ”€ utils.py                # Utility functions
โ”œโ”€โ”€ assignments/            # Assignment management
โ”‚   โ”œโ”€โ”€ setup.py           # Interactive setup
โ”‚   โ”œโ”€โ”€ orchestrator.py    # Workflow orchestration
โ”‚   โ””โ”€โ”€ manage.py          # Template management
โ”œโ”€โ”€ repos/                  # Repository operations
โ”‚   โ”œโ”€โ”€ fetch.py           # Repository discovery
โ”‚   โ””โ”€โ”€ collaborator.py    # Collaborator management
โ”œโ”€โ”€ secrets/                # Secret management
โ”‚   โ”œโ”€โ”€ add.py             # Secret distribution
โ”‚   โ”œโ”€โ”€ remove.py          # Secret removal
โ”‚   โ””โ”€โ”€ list.py            # Secret listing
โ”œโ”€โ”€ automation/             # Automation & scheduling
โ”‚   โ”œโ”€โ”€ scheduler.py       # Cron job management
โ”‚   โ””โ”€โ”€ batch.py           # Batch processing
โ””โ”€โ”€ config/                 # Configuration system
    โ”œโ”€โ”€ loader.py          # Configuration loading
    โ”œโ”€โ”€ validator.py       # Validation logic
    โ””โ”€โ”€ generator.py       # Config generation

Contributing

# Clone and setup development environment
git clone https://github.com/hugo-valle/classroom-pilot.git
cd classroom-pilot

# Install with Poetry
poetry install
poetry shell

# Run tests
poetry run pytest tests/ -v

# Test CLI functionality
poetry run classroom-pilot --help

# Format code
poetry run black classroom_pilot/
poetry run isort classroom_pilot/

# Type checking
poetry run mypy classroom_pilot/

# Create feature branch
git checkout -b feature/new-feature

Testing

The project includes comprehensive testing:

  • 153+ tests across all modules
  • Unit tests for individual components
  • Integration tests for workflow validation
  • CLI tests for command-line interface
  • 100% test pass rate requirement
# Run all tests
poetry run pytest tests/ -v

# Run specific test categories
poetry run pytest tests/test_assignments.py -v
poetry run pytest tests/test_cli.py -v

# Test with coverage
poetry run pytest tests/ --cov=classroom_pilot

๐Ÿ“š Documentation

Key Resources

Version Information

  • Current Version: 3.1.0-alpha.1
  • Python Support: 3.10, 3.11, 3.12
  • Package Distribution: PyPI with automated CI/CD
  • Release Cycle: Semantic versioning with automated publishing

๐Ÿ†˜ Support

๐Ÿ“œ License

MIT License - see LICENSE file for details.


Classroom Pilot - Modern Python automation for GitHub Classroom assignment management.

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

classroom_pilot-3.1.0a1.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

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

classroom_pilot-3.1.0a1-py3-none-any.whl (95.2 kB view details)

Uploaded Python 3

File details

Details for the file classroom_pilot-3.1.0a1.tar.gz.

File metadata

  • Download URL: classroom_pilot-3.1.0a1.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for classroom_pilot-3.1.0a1.tar.gz
Algorithm Hash digest
SHA256 82cfbe79e15d3fb6d87dcd5f82ac69c0b2b28934d137cc09313e8f450efc1ede
MD5 97245c995e707e86b23c49b23bd57e1b
BLAKE2b-256 f554bfb250123e7967e8d60ddb1f406d5b7150edf8ada3587c0e609ce876148d

See more details on using hashes here.

File details

Details for the file classroom_pilot-3.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: classroom_pilot-3.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 95.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for classroom_pilot-3.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 73141e64bc6530d7c54e603ae3c828b1b3b73384905ecea28ae6acf9410060bf
MD5 b6b01a82935671583c90b4aab8a91fec
BLAKE2b-256 3fcdb3a971dfe58ba70ca99847a7b135cfde51ec80b5bd0a37af68bf83cbca78

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