Skip to main content

A diagnostic tool for Python Azure Functions

Project description

Azure Functions Doctor Logo

Test Status Release Status PyPI Version License Codecov Coverage Python Versions


Azure Functions Doctor for Python

A fast and extensible diagnostic CLI for Python-based Azure Functions projects. Supports both Programming Model v1 (function.json-based) and Programming Model v2 (decorator-based) projects.


Why Azure Functions Doctor?

  • Getting random 500 errors and suspect misconfiguration?
  • Need to verify your dev environment before CI/CD deployment?
  • Want a quick health check without digging through docs?

Azure Functions Doctor helps save time by automating common environment diagnostics.


Key Features

  • Multi-Model Support: Works with both v1 (function.json) and v2 (decorator) projects
  • Automatic Detection: Automatically detects your project's programming model
  • Model-Specific Checks: Different requirements for v1 vs v2 (Python version, packages, etc.)
  • Rich Diagnostics: Python version, venv, required packages, project files
  • Extensible Rules: Customizable rules system for both programming models
  • Rich Console Output: Clear formatting with hints and suggestions
  • CI/CD Ready: JSON output for automated environments

Architecture

Azure Functions Doctor uses a modular, rule-based architecture for extensibility and maintainability:

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   CLI Interface │    │  Core Diagnostic │    │   Rule System   │
│    (cli.py)     │───▶│    Engine        │───▶│  (assets/rules/v2.json or v1.json)   │
│                 │    │   (doctor.py)    │    │                 │
└─────────────────┘    └──────────────────┘    └─────────────────┘
         │                        │                       │
         │                        ▼                       ▼
         │               ┌──────────────────┐    ┌─────────────────┐
         │               │     Handler      │    │  Target/Version │
         │               │    Dispatcher    │    │    Resolver     │
         │               │  (handlers.py)   │    │ (target_resolver │
         │               └──────────────────┘    │      .py)       │
         │                        │              └─────────────────┘
         │                        ▼
         │               ┌──────────────────┐
         │               │   Individual     │
         │               │    Handlers      │
         │               │ • file_exists    │
         │               │ • compare_version│
         │               │ • check_package  │
         │               │ • validate_json  │
         │               └──────────────────┘
         │                        │
         ▼                        ▼
┌─────────────────┐    ┌──────────────────┐
│ Output Formatter│    │     Results      │
│   JSON / CLI    │◀───│   Aggregator     │
│                 │    │                  │
└─────────────────┘    └──────────────────┘

Key Components

  • CLI Interface: Entry point handling commands, flags, and output formatting
  • Diagnostic Engine: Core orchestration logic loading rules and coordinating execution
  • Rule System: Declarative JSON-based rule definitions for extensibility
  • Handler Dispatcher: Routes rule types to appropriate handler functions
  • Individual Handlers: Specific diagnostic implementations (file checks, version validation, etc.)
    • New adapter-style checks: executable_exists, any_of_exists, file_glob_check, host_json_property, and lightweight validators binding_validation and cron_validation (see docs/rules.md).
  • Results Aggregator: Collects and structures all diagnostic outcomes
  • Output Formatter: Renders results as colorized CLI output or machine-readable JSON

This design allows easy extension by adding new rules to src/azure_functions_doctor/assets/rules/v2.json (and v1.json for v1 projects) and implementing corresponding handlers, without modifying core engine logic.


Requirements

  • Python 3.9+
  • Git
  • (Optional) Azure Functions Core Tools v4+ (npm i -g azure-functions-core-tools@4)
  • (Recommended) Unix-like shell or PowerShell for Makefile support

Installation

From PyPI:

pip install azure-functions-doctor

Or from source:

git clone https://github.com/yeongseon/azure-functions-doctor-for-python.git
cd azure-functions-doctor-for-python
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

Usage

Run the Doctor

azure-functions doctor
Sample output

Show Help

azure-functions --help

Sample: examples/basic-hello/diagnose-output.md


Example

See examples/basic-hello for:

  • Minimal Azure Functions structure setup
  • Running the CLI and inspecting results

Documentation


Contributing

We welcome issues and PRs!

Please see CONTRIBUTING.md for contribution guidelines.

If you find this useful, please star the repo!


License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_functions_doctor-0.11.0.tar.gz (4.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azure_functions_doctor-0.11.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file azure_functions_doctor-0.11.0.tar.gz.

File metadata

  • Download URL: azure_functions_doctor-0.11.0.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for azure_functions_doctor-0.11.0.tar.gz
Algorithm Hash digest
SHA256 530a88d09eaae71a703933d27f2f8227304a4fc99382c7813e492d170c5d6a5b
MD5 5773845752599821144e40f4e4ddabfc
BLAKE2b-256 bd88b1db2c0ca11e5676e6327c0d00da847f1302bddf830cea5003cfb31e085a

See more details on using hashes here.

File details

Details for the file azure_functions_doctor-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_functions_doctor-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 880c32e31b25a417af482fb77c1566b04a8a9035486e07fb389d3957335e866e
MD5 a53a5a36bb48e5c275782e5cd5f95e6c
BLAKE2b-256 dd3ce797f4f1bd713ccb219852953bae7b32f80de458de3c935657db2ad9c2ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page