Skip to content

Gate Every Repository's Python on Its Code, Not on Its Config #1800

Closed

Description

@ptr727

Problem

The hub defines how Python should be set up (the python-codestyle Skill's build and lint-only profiles), but every mechanism that enforces it switches on config presence rather than code presence, so a repository's Python is gated only if it happens to carry the right file in the right place.

Mechanism Trigger Blind to
python type, spec/project-types.json detect pyproject.toml or setup.py a repository with .py files and neither
validate-task.yml lint and type check a root pyproject.toml Python in a subdirectory, and a repository with no config
validate-task.yml unit test and coverage root pyproject.toml + root tests/ + uv.lock or requirements*.txt the lint-only profile, whose unittest suite sits in <scripts-dir>/tests/ with no lockfile
audit registry types untyped repositories carrying Python

Measured on each repository's default branch, 2026-09-24:

  • Python nothing gates: Blog and KiCadLibrary each carry .py files and test_*.py files, with no pyproject.toml and no python type.
  • Nested Python the root-keyed steps miss: HomeAutomation-Config (a build-shaped CloudInit/ and a lint-only Notify/, and no python type), PlexCleaner (RegressionTests/ only), and ESPHome-Config (a uv workspace root whose project sits under easystart/python/).
  • Partially gated: homeassistant-purpleair keeps its tool config outside pyproject.toml, has no lockfile, and uploads no coverage.

Proposed contract

  1. Tracked .py files make a repository Python. Detect from **/*.py rather than from config, and have the audit report Python present without the python type.
  2. Every Python repository owes the same gates, whatever it ships: ruff lint and format, a type check, a test suite, and a coverage report to Codecov.
  3. The profile is only the dependency shape. build (third-party dependencies, uv.lock) versus lint-only (stdlib-only, runs under bare python3). The shape decides how the tools are installed, not what is owed.
  4. The shared validate task serves both shapes. The unit-test job runs a lint-only unittest suite under coverage as well, and finds Python projects in declared subdirectories rather than assuming the root.
  5. Where tool config lives stays repo-local. The audit checks that the gates run, not which file holds the settings.

The pyproject.toml row in spec/divergences.json stays accepted under this contract, since it records whether a repository carries a copy of the hub's own file, which this does not change.

Open decisions

  • How a subdirectory project is declared, a registry field or a spec convention.
  • Whether a repository with only a handful of helper scripts owes a test suite, or only lint and a type check.
  • The adoption order for the five repositories above.

Activity

  1. ptr727 commented on Sep 26, 2026

    @ptr727
    OwnerAuthor

    Two of the three open decisions are settled. The maintainer answered them on 2026-09-25, from #1134.

    1. How a subdirectory project is declared: by a caller input to validate-task.yml, for example python-directories, mirrored in the registry so the audit can catch a caller that fails to pass it. Auto-discovery was rejected because a stray or vendored .py file would silently change what gets gated. An input with no registry mirror was rejected because the audit could not see a missing declaration.
    2. A repository with only helper scripts: owes the full gates, meaning lint, format, a type check, a test suite, and coverage. No size threshold, since no line can be drawn mechanically.
    3. Adoption order: still open.

    This issue now also owns #1134's gap 2 (root-anchored hashFiles in both the lint and unit-test jobs). #1848 ships #1134's other two gaps on their own.

    Known adoption cost, reported by PlexCleaner's session: RegressionTests/ holds a lint-only, stdlib-only pyproject.toml (ruff and mypy config) and 9 .py files, with no tests/, lockfile, or requirements file. Under decision 2 it will need a test suite with coverage. PlexCleaner is holding its adoption of the hub validator until this issue is promoted.

  2. ptr727 commented on Sep 27, 2026

    @ptr727
    OwnerAuthor

    The third decision is settled. The maintainer answered it on 2026-09-26.

    1. Adoption order, waiting first: PlexCleaner first, since it is already holding its adoption for this issue. Then homeassistant-purpleair (a root project, partially gated), then the nested ones (HomeAutomation-Config, ESPHome-Config), and last Blog and KiCadLibrary, which need test suites written from nothing. Shipping the smallest change first also proves the subdirectory input on a real caller before the larger adoptions.

    All three open decisions are now settled.

  3. added a commit that references this issue on Sep 27, 2026
    437a20d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions