Skip to content

Feature: Add concore doctor command for system readiness checks #495

@GaneshPatil7517

Description

@GaneshPatil7517

Summary

New users frequently struggle with setting up concore because there is no way to verify
whether their system has the required tools installed and properly configured. A concore doctor
command would diagnose the environment and report what's working, what's missing, and how to fix it.

Problem

Currently, users only discover missing tools (g++, iverilog, octave, python3, Docker, etc.)
when concore run fails at execution time, often with unclear error messages. The configuration
system spans four separate files (concore.tools, concore.octave, concore.mcr, concore.sudo),
and there is no single command to verify that everything is set up correctly.

This is a key usability barrier for new users across all platforms (Windows, macOS, Linux, Docker).

Proposed Solution

Add a new concore doctor CLI command that performs the following checks:

Core Checks

  • Python version - Verify Python >= 3.9
  • concore installation - Verify concore package is properly installed and importable
  • CONCOREPATH - Check if the concore config directory exists and is writable

Tool Detection

  • C++ compiler - Detect g++ (Linux/macOS) or MSVC/MinGW (Windows) using shutil.which()
  • Python executable - Verify python3 / python path used by generated scripts
  • Verilog - Detect iverilog if Verilog studies are intended
  • MATLAB/Octave - Detect matlab or octave, check if concore.octave flag matches
  • Docker -Detect Docker/Podman, check if daemon is running (docker info)

Configuration Checks

  • concore.tools - Parse and validate all tool paths listed in the config file
  • concore.sudo - Verify the Docker executable override is valid
  • concore.mcr - If present, verify the MCR path actually exists on disk
  • Environment variables - Check CONCORE_CPPEXE, CONCORE_PYTHONEXE, etc.

Dependency Checks

  • Python packages - Verify required packages (click, rich, beautifulsoup4, lxml, psutil, numpy, pyzmq) are installed
  • Optional packages - Check scipy, matplotlib for demo studies

Expected Output

$ concore doctor

concore Doctor - System Readiness Report

  • Python 3.11.5 (>= 3.9 required)
    -concore 1.0.0 installed
    -CONCOREPATH: /home/user/.concore (writable)

Tools:

  • g++ 12.2.0 → /usr/bin/g++
  • python3 3.11.5 → /usr/bin/python3
    ⚠️ iverilog → Not found (install: sudo apt install iverilog)
  • octave 8.4.0 → /usr/bin/octave
    ❌ matlab → Not found
  • Docker 24.0.7 → /usr/bin/docker (daemon running)

Configuration:

  • concore.tools → 3 tool paths configured
  • concore.sudo → docker (no sudo)
    ⚠️ concore.mcr → Not found (only needed for MATLAB Compiler Runtime)
  • concore.octave → Enabled (treating .m as Octave)

Dependencies:

  • click 8.1.7
  • rich 13.7.0
  • beautifulsoup4 4.12.2
  • numpy 1.26.2
  • pyzmq 25.1.1
    ⚠️ scipy → Not installed (needed for demo studies: pip install concore[demo])
    ⚠️ matplotlib → Not installed (needed for demo studies: pip install concore[demo])

Summary: 12 passed, 3 warnings, 1 error
❌ Fix: Install MATLAB or set concore.octave flag if using Octave only

Implementation Notes

  • New file: concore_cli/commands/doctor.py with a doctor_check(console) function
  • Register in cli.py following the existing Click command pattern
  • Use shutil.which() for cross-platform tool path detection
  • Use subprocess.run([tool, "--version"]) to extract version strings
  • Use Rich tables/panels for formatted terminal output
  • Provide platform-specific install hints:
  1. Ubuntu/Debian: sudo apt install ...
  2. macOS: brew install ...
  3. Windows: choco install ... / winget install ...
  • Return exit code 0 if all checks pass, 1 if any errors exist (useful for CI pipelines)

Why This Matters
This directly addresses the project's goal of reducing the learning curve for CONTROL-CORE. Instead of discovering problems one at a time during execution, users get a complete readiness report upfront with actionable fix instructions. This command also serves as the foundation for future installation automation (concore setup).

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