Skip to content

Add Python Linting and CI/CD Workflow#2

Draft
bsadashi wants to merge 4 commits intoSiliconDojo:mainfrom
bsadashi:develop
Draft

Add Python Linting and CI/CD Workflow#2
bsadashi wants to merge 4 commits intoSiliconDojo:mainfrom
bsadashi:develop

Conversation

@bsadashi
Copy link
Copy Markdown

Add Python Linting and CI/CD Workflow

🎯 Overview

Set up comprehensive code quality infrastructure for the In-Person-Classes educational repository with automated Python linting, type checking, and testing via GitHub Actions.

✨ Changes

GitHub Actions Workflow

  • File: .github/workflows/lint.yml
  • Runs on: Python 3.11, 3.12
  • Triggers: Push to main/develop and all PRs
  • Tools: Black, isort, flake8, pylint, mypy, pytest, coverage
  • Mode: Warnings-only (non-blocking) to support educational code diversity

Configuration Files

  • pyproject.toml - Centralized tool configuration
    • Black: 100 char line length, Python 3.11+ target
    • isort: Black-compatible import sorting
    • pylint, mypy, pytest, coverage settings
  • .flake8 - PEP 8 linting configuration
  • requirements-dev.txt - Development dependencies pinned
  • Makefile - Local development commands
    • make lint - Run all linters
    • make format - Auto-format code
    • make test - Run tests
    • make coverage - Generate coverage reports
  • .gitignore - Enhanced with Python patterns (venv, caches, build artifacts)

🚀 Usage

Local Development

make install      # Install dev dependencies
make lint         # Check code quality
make format       # Auto-format code
make test         # Run tests
make coverage     # Generate coverage reports

- Add GitHub Actions workflow for Python linting (Black, isort, flake8, pylint, mypy)
- Add pyproject.toml with tool configurations
- Add requirements-dev.txt for development dependencies
- Add .flake8 configuration file
- Update .gitignore with Python-specific patterns
- Add Makefile with convenient development commands (lint, format, test, coverage)
- Configure Python 3.11+ target with coverage reporting and pytest integration
- All linters run in warnings mode to support educational code diversity
- Remove deprecated multi_line_mode and force_grid_wrap settings
- Use isort-compatible profile configuration
- Settings now match isort 5.13.2+ API
- Fix nested f-string quotes in rest-location-ai.py, rest-news.py, parse-structured-data.py
- Fix indentation in parse-structured-data.py
- Clean up test.py placeholder file
- Apply Black formatting to 67 files
- Sort imports with isort across 54 files
- All linters now pass: black, isort, pytest
- Add test_rest_apis.py: Tests for REST API modules (location, news, JSON parsing)
- Add test_web_scraping.py: Tests for web scraping modules (parsing, data extraction)
- Add test_ai_modules.py: Tests for AI modules (OpenAI, Ollama, MoonDream)
- 15 tests total, all passing
- Coverage reporting configured
- Tests follow pytest conventions and educational module patterns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant