Skip to content

trading_agent.doctor.checks.python_version_check

Checks that the agent runs on Python 3.14 or later.

Typical usage example:

result = PythonVersionCheck().run()

PythonVersionCheck

Bases: DoctorCheck

Checks the version of the running Python interpreter.

run

run()

Compares the running version with the minimum.

Returns:

Type Description
CheckResult

OK on 3.14 or later, failed otherwise.

Source code in src/trading_agent/doctor/checks/python_version_check.py
def run(self) -> doctor_check.CheckResult:
    """Compares the running version with the minimum.

    Returns:
        doctor_check.CheckResult: OK on 3.14 or later, failed otherwise.
    """
    version_text = '.'.join(str(part) for part in sys.version_info[:3])
    if sys.version_info[:2] >= _MINIMUM_VERSION:
        return doctor_check.CheckResult(
            doctor_check.CheckStatus.OK,
            f'Python {version_text}.',
        )
    return doctor_check.CheckResult(
        doctor_check.CheckStatus.FAILED,
        f'Python {version_text} is too old; 3.14 or later is needed.',
    )