Skip to content

feat: add pythonlings doctor diagnostics #46

Description

@abhiksark

Motivation

A read-only diagnostic command can turn opaque setup problems into actionable checks for learners and maintainers without changing user workspaces.

Current evidence

  • The existing product-hardening umbrella (Product-hardening umbrella #4) identifies pythonlings doctor as a desired diagnostic command.
  • Workspace validity currently spans CLI root resolution, info.toml, mirrored curriculum files, state, reset snapshots, solutions, and bundled docs.
  • Existing state loading can mutate corrupt files, so doctor needs its own non-mutating inspection path.

Exact scope

Add pythonlings [--root PATH] doctor, a read-only diagnostic command that reports runtime/package version, workspace structure, manifest, solutions, state, reset snapshots, and bundled docs. Warnings do not fail the command; required failures return 1.

Acceptance checklist

  • The command is discoverable in CLI help and respects global --root.
  • It prints clear status for Python runtime and installed package version.
  • It checks required workspace structure, manifest validity, solution availability, state readability, reset snapshots, and bundled docs.
  • It distinguishes warnings from required failures, uses actionable messages, and exits 0 when only warnings occur.
  • A required failure exits 1; malformed/missing manifest handling remains friendly and never prints a traceback.
  • The command does not create, repair, rename, or otherwise modify workspace files.
  • Unit and CLI integration tests cover healthy, warning-only, required-failure, malformed-state, and --root paths.

Explicit exclusions

Do not add automatic repair, network calls, telemetry, a TUI screen, or a release promise. Do not reuse a mutating load path in the read-only diagnostics command.

Likely files

  • pythonlings/cli.py
  • pythonlings/core/doctor.py (new)
  • pythonlings/core/manifest.py, state.py, reset.py, or docs helpers as needed
  • tests/unit/test_doctor.py (new)
  • tests/integration/test_cli_doctor.py (new)

Verification

python -m pytest tests/unit/test_doctor.py tests/integration/test_cli_doctor.py -q
python -m pytest -q
pythonlings --root tests/fixtures/passing_curriculum doctor

Compare workspace file hashes before and after doctor to demonstrate read-only behavior.

Sprint coordination

See the sprint Discussion. This issue is unassigned and is not a reservation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cliCommand-line interface behaviordev sprintPythonlings Community Dev Sprint August 2026enhancementNew feature or requesthelp wantedExtra attention is neededsize: MMedium, self-contained contribution

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions