Skip to main content

A simple Azure Pipeline documentation generator

Project description

AZDocGen: Azure Pipelines Documentation Generator 📜🚀

Python publish workflow PyPI version License: MIT

AZDocGen is a Python-based tool to automatically generate detailed documentation for Azure Pipelines YAML files. It extracts key details, such as triggers, variables, resources, stages, jobs, steps, and conditions, and outputs structured Markdown documentation, including Mermaid diagrams for visual representation.

Installation

You can install AZDocGen via pip or poetry.

Using pip

pip install azdocgen

Using Poetry

poetry add azdocgen

Usage

CLI Usage

You can use AZDocGen directly from the command line to generate documentation for an Azure Pipelines YAML file.

azdocgen <pipeline_yaml_path> <output_md_path>

Example

azdocgen azure-pipelines.yml docs/azure-pipelines-docs.md

This will parse the azure-pipelines.yml file and generate the documentation in the docs/azure-pipelines-docs.md file.

Programmatic Usage

You can also use AZDocGen as a Python library to generate documentation programmatically.

Example

import yaml
from azdocgen.generate_doc import generate_markdown
from azdocgen.triggers import parse_triggers
from azdocgen.variables import parse_variables
from azdocgen.resources import parse_resources
from azdocgen.stages import parse_stages

# Load the Azure Pipelines YAML file
pipeline_file = "azure-pipelines.yml"
output_file = "docs/azure-pipelines-docs.md"

with open(pipeline_file, "r") as f:
    yaml_content = yaml.safe_load(f)

# Parse the sections
triggers = parse_triggers(yaml_content)
variables = parse_variables(yaml_content)
resources = parse_resources(yaml_content)
stages = parse_stages(yaml_content)

# Generate Markdown documentation
generate_markdown(
    triggers=triggers,
    variables=variables,
    stages=stages,
    resources=resources,
    output_file=output_file,
    pipeline_file=pipeline_file,
)

print(f"Documentation written to {output_file}")

Features

  • Triggers: Extracts branch and tag triggers.
  • Variables: Documents variables defined in the pipeline.
  • Resources: Lists repositories, containers, and pipeline dependencies.
  • Stages, Jobs, and Steps: Provides a hierarchical breakdown of the pipeline.
  • Conditions: Includes all conditions at stage, job, and step levels.
  • Mermaid Diagrams: Generates visual workflows.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork this repository.
  2. Create a feature branch: git checkout -b feature/my-feature.
  3. Commit your changes: git commit -m 'Add my feature'.
  4. Push to the branch: git push origin feature/my-feature.
  5. Submit a pull request.

License

AZDocGen is licensed under the MIT License. See LICENSE for more details.

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

azdocgen-0.1.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

azdocgen-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file azdocgen-0.1.1.tar.gz.

File metadata

  • Download URL: azdocgen-0.1.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for azdocgen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5035c9b70c486be61da3dd5e3695aa8126e3c74aa0ecd15736727f0fcb395d1
MD5 4f317565f8f4dd7841eefc400551d4ca
BLAKE2b-256 79a99d87838ce0414c16f136d2ce41029daacd2736526e79ba9539dafa09f9a5

See more details on using hashes here.

File details

Details for the file azdocgen-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: azdocgen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for azdocgen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb1bf27a5c41ce16de9d6e8c6ebece3a8fed45d62a9748afb073ea0d35691511
MD5 6a6b43c9408667fe2efd015243614f30
BLAKE2b-256 7fe74fc2b59aaa1ed3fd9455c475e7a815cf548b8c976b0137f43c3954f02752

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