Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 2 column 56
---
title: "Python GitHub Setup"
description: Python GitHub Setup Technical Encyclopedia: CI/CD Workflows, Secret Management (OIDC), Branch Protection, and Template Orchestration.
location: skills/python-github-setup.md
agent_priority: Standard
last_updated: 2026-03-08
---
🔗 Related Python Skills:
- Python Core Standards - CPython Internals, Memory Optimization, Security
- Python Containerization - Docker, Distroless Images, Security Hardening
- Pandas & Scikit-learn - Memory Optimization, Pipeline Orchestration
- PyTorch & Sklearn Integration - TorchDynamo, ONNX, Skorch
Comprehensive technical protocols for the design and orchestration of Python-centric GitHub repositories in the 2025 ecosystem. This document defines the standards for CI/CD pipeline engineering, OIDC-based secret management, and deterministic repository state management.
Standardizing on YAML-based workflows for automated testing, linting, and deployment.
- Triggers: Mandatory use of
pull_requestandpushtomainwith path-awareness (e.g.,paths: ["src/**", "tests/**"]). - Job Concurrency: Using
concurrencygroups to cancel outdated runs, saving CI minutes. - Environment Matrix: Testing across multiple Python versions (3.12, 3.13) and OS targets (Ubuntu, macOS).
# .github/workflows/ci.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v2
- name: Install dependencies
run: uv sync --frozen
- name: Run Tests
run: uv run pytest --cov=src --cov-report=xmlImplementing "Zero-Trust" protocols for repository credentials.
- Logic: Eliminating long-lived GitHub Secrets for cloud deployments (AWS/GCP/PyPI).
- Protocol: Utilizing short-lived JWT tokens provided by GitHub to authenticate directly with the target provider via
permissions: id-token: write.
- The "Clean-Only" Standard: Mandatory status checks (CI passing), required reviews (Min: 1), and "Require linear history" (Squash merge only).
- Security Scanning: Mandatory integration of CodeQL and Dependabot for automated vulnerability detection and dependency updates.
Ensuring consistency across multiple projects using standardized manifests.
- Standard Files:
.gitignore,.editorconfig,pyproject.toml, and.github/ISSUE_TEMPLATE/. - PR Template Standards: Mandatory sections for "Changes", "Testing Done", and "Documentation Updated".
| Feature | Technical Purpose | Standard |
|---|---|---|
| Environments | Context-specific secrets/rules | Production/Staging |
| Labels | Automated triage | Semantic (Bug, Enh.) |
| Discussions | Community Q&A | Enabled (Large Libs) |
| Workflows | Composite actions | Dry logic |
Objective: managing 5 Python libraries in a single GitHub repository.
- Workspaces: Utilizing
uvworkspaces for local dependency resolution. - Selective CI: Using
on.push.pathsto only run tests for the package that changed. - Cross-Library Versioning: Utilizing
semantic-releaseor similar tools to automatically bump versions and generate changelogs across all 5 packages. - Security Gating: Centralized Dependabot configuration for the entire mono-repo.
- Action: A custom application for the GitHub Actions platform that performs a complex but frequently repeated task.
- OIDC (OpenID Connect): An identity layer on top of the OAuth 2.0 protocol.
- Fork: A personal copy of another user's repository that lives on your account.
- Workflow: A configurable automated process that will run one or more jobs.
- Logic: Calculating the cost vs. coverage of a CI matrix.
-
Formula:
$\text{Total Cost} = \text{JobTime} \cdot \sum (\text{OS} \cdot \text{PythonVersion} \cdot \text{ParamCombination})$ . - Optimization: In 2025, Moltbot prunes redundant combinations (e.g., testing 3.12 on macOS if it already passed on Ubuntu) to minimize latency.
- Flaky CI: Tests failing inconsistently. Fix: Use "Retry" logic or isolate network dependencies via
pytest-mock. - Secret Leakage: Detecting plaintext secrets in workflow logs. Fix: Immediate token revocation and configuration of "Secret Scanning" in GitHub Settings.
- PR Auto-Fixing: Actions that automatically run
ruff formatand commit the changes back to the PR if the linting check fails.
- CI Execution Time: Target < 5m for standard test suites.
- Security Compliance: 100% resolution rate for "Critical" Dependabot alerts within 24 hours.
- Python Core Standards - CPython Internals, Memory Optimization, Security
- Python Containerization - Docker, Distroless Images, Security Hardening
- Pandas & Scikit-learn - Memory Optimization, Pipeline Orchestration
- PyTorch & Sklearn Integration - TorchDynamo, ONNX, Skorch