Skip to main content

A plugin to generate a summary of a ADR directory

Project description

mkdocs-macros-adr-summary

Static Badge Stable Version stability-beta

Python tests Maintainability Test Coverage

Checked with mypy Code style: black Ruff security: bandit

This is a macro plugin to generates summaries from a list of a ADR documents in a directory.

The single ADR documents file names have to respect this format: 0000-my-decision-title.md

  • start with 4 digits followed by the character -
  • the rest of the file name can contain only letters, numbers, dashes and underscores ([A-Za-z0-9_-] regex)
  • end with the .md extension

Examples and documentation can be found here

The package should be stable enough for daily use. I'll release 1.0.0, and switch to semantic version, as soon as support for MADR version 2 has been implemented. Until that breaking changes can be introduced and will be documented in the GitHub release description.

Quick start

Enable the plugin in mkdocs.yml

plugins:
  - macros:
      modules:
        - mkdocs_macros_adr_summary

Create a markdown page in your mkdocs website and use the adr_summary macro providing the path containing your ADR files relative to the mkdocs.yml file.

{{ adr_summary(adr_path="docs/adr", adr_style="nygard") }}

adr_style can be nygard or MADR3

More customization

The page output is generated using a jinja template, but you can provide a custom one. The file path must still be relative to the mkdocs.yml file.

{{ adr_summary(adr_path="docs/adr", adr_style="MADR3",m) }}

The default template is:

| ID | Date | Decision | Status |
|----|------|----------|--------|
{% for d in documents %}| {{ d.document_id }} | {{ d.date.strftime('%d-%m-%Y') if d.date else "-"}} | [{{ d.title }}]({{ d.file_path }}) | {{ d.status }}  |
{% endfor %}

The documents variable in the jinja template is a Sequence of ADRDocument models:

@dataclass
class ADRDocument:
    file_path: str
    document_id: Optional[int] = None
    title: Optional[str] = None
    date: Optional[date] = None
    status: Optional[str] = None
    statuses: Sequence[str] = tuple()
    deciders: Optional[str] = None
    consulted: Optional[str] = None
    informed: Optional[str] = None

There are some differences in what metadata is available when using different formats:

Nygard MADR3 MADR2
file_path ✅︎ ✅︎ ✅︎
title ✅︎ ✅︎ ✅︎
date ✅︎ ✅︎ ✅︎
status ✅︎ ✅︎
statuses ✅︎
deciders ✅︎ ✅︎
consulted ✅︎
informed ✅︎
  • Nygard format
    • status is the last item statuses. (I don't believe we should use multiple statuses, however adr-tools allows it)
    • deciders, consulted and informed are not supported by the format
  • MADR2 and MADR3
    • I wasn't able to find an automated tool supporting superseding documents. By looking at the template it looks like there's a single status. statuses will return a list with a single status.

Supported ADR formats

The supported ADR formats are:

Commands for development

All the common commands used during development can be run using make targets:

  • make dev-dependencies: Install dev requirements
  • make update-dependencies: Update dev requirements
  • make test: Run test suite
  • make check: Run tests, code style and lint checks
  • make fix: Run code style and lint automatic fixes (where possible)
  • make docs: Render the mkdocs website locally

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

mkdocs_macros_adr_summary-1.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_macros_adr_summary-1.1.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_macros_adr_summary-1.1.1.tar.gz.

File metadata

File hashes

Hashes for mkdocs_macros_adr_summary-1.1.1.tar.gz
Algorithm Hash digest
SHA256 411edda6084318abf1c784dad7efb268647bd1cad53b82999064b992d601e2d1
MD5 85bdbb00d44c3a5ca3178d9cdb17c00f
BLAKE2b-256 d52de8bcf15323ab2d2189b15b9d8eef21a58209ad55d40860874b06e09af928

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_macros_adr_summary-1.1.1.tar.gz:

Publisher: release.yml on febus982/mkdocs-macros-adr-summary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkdocs_macros_adr_summary-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_macros_adr_summary-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3061e998c1e1fa10e4086e68fe3e9ae6f69e07f8ac57337b6df1e0454bbf0b23
MD5 6972f3bd732cacedefe837e425d3ddee
BLAKE2b-256 e8df4c0f7a7baa3aa7ba2c6aa2fcc1bb6c356d0a46825d3f84d81795721c28e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_macros_adr_summary-1.1.1-py3-none-any.whl:

Publisher: release.yml on febus982/mkdocs-macros-adr-summary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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