Skip to content

bugreport ¤

BugReport package.

Maintainers store configuration in their repository, users call the tool to generate high quality bug reports easily.

Classes:

Functions:

  • discover –

    Clone a Git repository and return the contents of its first bug-template YAML file.

  • evaluate_section_condition –

    Check an input's truth value or compare it with a quoted string.

  • get_parser –

    Return the CLI argument parser.

  • main –

    Run the main program.

  • render_output_template –

    Render a metadata output template with current inputs and previously rendered outputs.

  • yield_bugreport_forms –

    Extract bugreport forms from markdown HTML comments.

Attributes:

TypeBugreportInput module-attribute ¤

Supported bugreport input types.

TypeGitHubElement module-attribute ¤

Supported GitHub issue-form element types.

BugreportElement ¤

Bases: BaseModel

Base class for bugreport elements.

Attributes:

  • id (str) –

    Identifier used to reference the element in templates and widgets.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

BugreportForm ¤

Bases: BaseModel

A bugreport form defined in issue-template metadata.

Methods:

  • from_github –

    Convert a GitHub form to a Bugreport form.

Attributes:

body class-attribute instance-attribute ¤

body: list[BugreportStep | BugreportMarkdown] = Field(
    default_factory=list
)

Steps and Markdown instructions in display order.

subtitle class-attribute instance-attribute ¤

subtitle: str | None = None

Additional text below the title.

title class-attribute instance-attribute ¤

title: str | None = None

Title of the form.

from_github classmethod ¤

from_github(form: GitHubForm) -> BugreportForm

Convert a GitHub form to a Bugreport form.

Source code in src/bugreport/_internal/models/bugreport.py
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
@classmethod
def from_github(cls, form: GitHubForm) -> BugreportForm:
    """Convert a GitHub form to a Bugreport form."""
    body: list[BugreportStep | BugreportMarkdown] = []
    for element in form.body:
        if isinstance(element, GitHubElementMarkdown):
            body.append(BugreportMarkdown(id=element.id or "", value=element.value))
        elif isinstance(element, GitHubElementInput):
            input_element = BugreportInputString(
                id=element.id or "",
                label=element.label,
                description=element.description,
                placeholder=element.placeholder,
                required=element.required,
            )
            body.append(BugreportStep(body=[input_element]))
        elif isinstance(element, GitHubElementDropdown):
            input_element = BugreportInputChoice(
                id=element.id or "",
                label=element.label,
                description=element.description,
                options={option: option for option in element.options},
                required=element.required,
            )
            body.append(BugreportStep(body=[input_element]))
        elif isinstance(element, GitHubElementCheckboxes):
            input_element = BugreportInputChoices(
                id=element.id or "",
                label=element.label,
                description=element.description,
                options={option.id or option.label: option.label for option in element.options},
                required=element.required,
            )
            body.append(BugreportStep(body=[input_element]))
    return cls(body=body)

BugreportInput ¤

Bases: BugreportElement

Common settings for a bugreport input.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

BugreportInputBoolean ¤

Bases: BugreportInput

A checkbox in a bugreport form.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (bool | None) –

    Initial checkbox state.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: bool | None = None

Initial checkbox state.

BugreportInputChoice ¤

Bases: BugreportInput

An input for selecting one option.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • options (dict[str, str] | None) –

    Option values mapped to their displayed labels.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initially selected option value.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

options class-attribute instance-attribute ¤

options: dict[str, str] | None = None

Option values mapped to their displayed labels.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = None

Initially selected option value.

BugreportInputChoices ¤

Bases: BugreportInput

An input for selecting several options.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • options (dict[str, str] | None) –

    Option values mapped to their displayed labels.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initially selected option values, separated by commas.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

options class-attribute instance-attribute ¤

options: dict[str, str] | None = None

Option values mapped to their displayed labels.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = None

Initially selected option values, separated by commas.

BugreportInputPath ¤

Bases: BugreportInput

An input for a filesystem path.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initial path value.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = None

Initial path value.

BugreportInputString ¤

Bases: BugreportInput

A single line of text in a bugreport form.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • highlight (str | None) –

    Requested syntax highlighting language.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initial input value.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

highlight class-attribute instance-attribute ¤

highlight: str | None = None

Requested syntax highlighting language.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = None

Initial input value.

BugreportInputText ¤

Bases: BugreportInput

Several lines of text in a bugreport form.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • highlight (str | None) –

    Syntax highlighting language for the text editor.

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • label (str | None) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initial text content.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions displayed below the label.

highlight class-attribute instance-attribute ¤

highlight: str | None = None

Syntax highlighting language for the text editor.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

label class-attribute instance-attribute ¤

label: str | None = None

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = None

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = None

Initial text content.

BugreportMarkdown ¤

Bases: BugreportElement

Markdown instructions displayed in a bugreport form.

Attributes:

  • id (str) –

    Identifier used to reference the element in templates and widgets.

  • value (str) –

    Markdown content to display.

id instance-attribute ¤

id: str

Identifier used to reference the element in templates and widgets.

value instance-attribute ¤

value: str

Markdown content to display.

BugreportStep ¤

Bases: BaseModel

A group of inputs with an optional condition and output templates.

Attributes:

body class-attribute instance-attribute ¤

body: list[TypeBugreportInput | BugreportMarkdown] = Field(
    default_factory=list
)

Inputs and Markdown instructions in display order.

condition class-attribute instance-attribute ¤

condition: str | None = Field(default=None, alias='if')

Condition that controls whether the step is displayed.

description class-attribute instance-attribute ¤

description: str | None = None

Markdown instructions for the step.

outputs class-attribute instance-attribute ¤

outputs: dict[str, str] = Field(default_factory=dict)

Output names mapped to Jinja templates for their values.

slug class-attribute instance-attribute ¤

slug: str | None = None

Identifier for the step.

title class-attribute instance-attribute ¤

title: str | None = None

Title displayed above the step.

FormApp ¤

FormApp(
    issue_template: str = ".github/ISSUE_TEMPLATE/1-bug.yml",
    **kwargs: Any,
)

Bases: App[None]

Display a GitHub issue form and its bugreport metadata in a terminal.

Methods:

  • compose –

    Read the issue template and create its form widgets.

Attributes:

Source code in src/bugreport/_internal/forms.py
62
63
64
65
66
67
68
69
70
71
72
def __init__(self, issue_template: str = ".github/ISSUE_TEMPLATE/1-bug.yml", **kwargs: Any) -> None:
    """Set the issue-template path and pass other options to the Textual app."""
    super().__init__(**kwargs)
    self.issue_template = issue_template
    """Path to the GitHub issue-template YAML file."""
    self.form_inputs: dict[str, Any] = {}
    """Current input values, keyed by input identifier."""
    self.form_outputs: dict[str, str] = {}
    """Rendered output values, keyed by output name."""
    self._metadata_textareas: dict[str, TextArea] = {}
    self._section_containers: list[tuple[BugreportStep, Vertical]] = []

CSS_PATH class-attribute instance-attribute ¤

CSS_PATH = Path(__file__).parent / 'forms.tcss'

Stylesheet for the form widgets.

form_inputs instance-attribute ¤

form_inputs: dict[str, Any] = {}

Current input values, keyed by input identifier.

form_outputs instance-attribute ¤

form_outputs: dict[str, str] = {}

Rendered output values, keyed by output name.

issue_template instance-attribute ¤

issue_template = issue_template

Path to the GitHub issue-template YAML file.

compose ¤

compose() -> ComposeResult

Read the issue template and create its form widgets.

Source code in src/bugreport/_internal/forms.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
def compose(self) -> ComposeResult:
    """Read the issue template and create its form widgets."""
    with Path(self.issue_template).open(encoding="utf-8") as file:
        form_data = yaml.safe_load(file)

    github_form = GitHubForm.from_data(form_data)

    for element in github_form.body:
        yield from self._create_widgets(element)
        if isinstance(element, GitHubElementMarkdown):
            for form in yield_bugreport_forms(element.value):
                for section in form.body:
                    if isinstance(section, BugreportMarkdown):
                        yield Markdown(section.value)
                        continue
                    with Vertical(classes="metadata-section") as container:
                        self._section_containers.append((section, container))
                        yield from self._create_label(section.title)
                        yield from self._create_description(section.description)
                        for metadata_input in section.body:
                            if isinstance(metadata_input, BugreportMarkdown):
                                yield Markdown(metadata_input.value)
                            else:
                                yield from self._create_metadata_input_widgets(metadata_input)

GitHubCheckboxOption ¤

Bases: BaseModel

One checkbox option in a GitHub issue form.

Attributes:

  • id (str | None) –

    Optional identifier for the option.

  • label (str) –

    Label displayed beside the checkbox.

  • required (bool | None) –

    Whether the user must select the checkbox.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the option.

label instance-attribute ¤

label: str

Label displayed beside the checkbox.

required class-attribute instance-attribute ¤

required: bool | None = False

Whether the user must select the checkbox.

GitHubElementCheckboxes ¤

Bases: BaseModel

A group of checkbox options in a GitHub issue form.

Attributes:

description class-attribute instance-attribute ¤

description: str | None = ''

Markdown instructions displayed below the label.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the group.

label instance-attribute ¤

label: str

Label displayed above the checkboxes.

options instance-attribute ¤

Checkbox options in display order.

required class-attribute instance-attribute ¤

required: bool = False

Whether the group requires a selection.

GitHubElementDropdown ¤

Bases: BaseModel

A list of options to select in a GitHub issue form.

Attributes:

  • default (int | None) –

    Index of the initially selected option.

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str | None) –

    Optional identifier for the dropdown.

  • label (str) –

    Label displayed above the dropdown.

  • multiple (bool | None) –

    Whether the form allows several options to be selected.

  • options (list[str]) –

    Option labels in display order.

  • required (bool) –

    Whether the user must select an option.

default class-attribute instance-attribute ¤

default: int | None = None

Index of the initially selected option.

description class-attribute instance-attribute ¤

description: str | None = ''

Markdown instructions displayed below the label.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the dropdown.

label instance-attribute ¤

label: str

Label displayed above the dropdown.

multiple class-attribute instance-attribute ¤

multiple: bool | None = False

Whether the form allows several options to be selected.

options instance-attribute ¤

options: list[str]

Option labels in display order.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must select an option.

GitHubElementInput ¤

Bases: BaseModel

An input for a single line of text in a GitHub issue form.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str | None) –

    Optional identifier for the input.

  • label (str) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initial input value.

description class-attribute instance-attribute ¤

description: str | None = ''

Markdown instructions displayed below the label.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the input.

label instance-attribute ¤

label: str

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = ''

Hint displayed when the input is empty.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = ''

Initial input value.

GitHubElementMarkdown ¤

Bases: BaseModel

Markdown instructions in a GitHub issue form.

Attributes:

  • id (str | None) –

    Optional identifier for the element.

  • value (str) –

    Markdown content to display.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the element.

value instance-attribute ¤

value: str

Markdown content to display.

GitHubElementTextarea ¤

Bases: BaseModel

An input for several lines of text in a GitHub issue form.

Attributes:

  • description (str | None) –

    Markdown instructions displayed below the label.

  • id (str | None) –

    Optional identifier for the input.

  • label (str) –

    Label displayed above the input.

  • placeholder (str | None) –

    Hint displayed when the input is empty.

  • render (str | None) –

    Language used to render the submitted text as a code block.

  • required (bool) –

    Whether the user must provide a value.

  • value (str | None) –

    Initial text content.

description class-attribute instance-attribute ¤

description: str | None = ''

Markdown instructions displayed below the label.

id class-attribute instance-attribute ¤

id: str | None = None

Optional identifier for the input.

label instance-attribute ¤

label: str

Label displayed above the input.

placeholder class-attribute instance-attribute ¤

placeholder: str | None = ''

Hint displayed when the input is empty.

render class-attribute instance-attribute ¤

render: str | None = None

Language used to render the submitted text as a code block.

required class-attribute instance-attribute ¤

required: bool = False

Whether the user must provide a value.

value class-attribute instance-attribute ¤

value: str | None = ''

Initial text content.

GitHubForm ¤

Bases: BaseModel

The supported elements of a GitHub issue form.

Methods:

  • from_data –

    Parse an issue-template mapping, logging and skipping unsupported element types.

Attributes:

body instance-attribute ¤

Form elements in display order.

from_data classmethod ¤

from_data(data: dict) -> GitHubForm

Parse an issue-template mapping, logging and skipping unsupported element types.

Source code in src/bugreport/_internal/models/github.py
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@classmethod
def from_data(cls, data: dict) -> GitHubForm:
    """Parse an issue-template mapping, logging and skipping unsupported element types."""
    body = []
    for element_data in data.get("body", []):
        element_type = element_data.get("type")
        required = element_data.get("validations", {}).get("required", False)
        if element_type == "markdown":
            element = GitHubElementMarkdown(**element_data["attributes"])
        elif element_type == "textarea":
            element = GitHubElementTextarea(**element_data["attributes"], required=required)
        elif element_type == "input":
            element = GitHubElementInput(**element_data["attributes"], required=required)
        elif element_type == "dropdown":
            element = GitHubElementDropdown(**element_data["attributes"], required=required)
        elif element_type == "checkbox":
            options = [GitHubCheckboxOption(**option) for option in element_data["attributes"]["options"]]
            element_data["attributes"]["options"] = options
            element = GitHubElementCheckboxes(**element_data["attributes"], required=required)
        else:
            _logger.error(f"Unsupported element type: {element_type}")
            continue
        body.append(element)
    return cls(body=body)

discover ¤

discover(
    origin: str, path: str = ".github/ISSUE_TEMPLATE"
) -> str

Clone a Git repository and return the contents of its first bug-template YAML file.

Parameters:

  • origin ¤

    (str) –

    Git repository URL or local path.

  • path ¤

    (str, default: '.github/ISSUE_TEMPLATE' ) –

    Directory to check out and search for a .yml file with bug in its name.

Raises:

Source code in src/bugreport/_internal/discover.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def discover(origin: str, path: str = ".github/ISSUE_TEMPLATE") -> str:
    """Clone a Git repository and return the contents of its first bug-template YAML file.

    Parameters:
        origin: Git repository URL or local path.
        path: Directory to check out and search for a `.yml` file with `bug` in its name.

    Raises:
        FileNotFoundError: No matching file was found.
        subprocess.CalledProcessError: A Git command failed.
    """
    with tempfile.TemporaryDirectory() as tmpdir:
        _git(["clone", "--no-checkout", "--depth=1", "--filter=tree:0", origin, "."], cwd=tmpdir)
        _git(["sparse-checkout", "set", path], cwd=tmpdir)
        _git(["checkout"], cwd=tmpdir)
        for file in Path(tmpdir).rglob("*.yml"):
            if file.is_file() and "bug" in file.stem.lower():
                return file.read_text()
    raise FileNotFoundError(f"No bugreport file found in {origin} at path {path}.")

evaluate_section_condition ¤

evaluate_section_condition(
    condition: str | None, inputs: dict[str, Any]
) -> bool

Check an input's truth value or compare it with a quoted string.

Conditions support inputs.name and inputs.name == "value". Empty conditions return True; unsupported conditions return False.

Source code in src/bugreport/_internal/metadata.py
107
108
109
110
111
112
113
114
115
116
117
118
119
def evaluate_section_condition(condition: str | None, inputs: dict[str, Any]) -> bool:
    """Check an input's truth value or compare it with a quoted string.

    Conditions support `inputs.name` and `inputs.name == "value"`.
    Empty conditions return `True`; unsupported conditions return `False`.
    """
    if not condition:
        return True
    if (match := _TRUE_CONDITION.fullmatch(condition.strip())) is not None:
        return bool(inputs.get(match.group(1)))
    if (match := _EQUALS_CONDITION.fullmatch(condition.strip())) is not None:
        return str(inputs.get(match.group(1), "")) == match.group(3)
    return False

get_parser ¤

get_parser() -> ArgumentParser

Return the CLI argument parser.

Returns:

Source code in src/bugreport/_internal/cli.py
48
49
50
51
52
53
54
55
56
57
def get_parser() -> argparse.ArgumentParser:
    """Return the CLI argument parser.

    Returns:
        An argparse parser.
    """
    parser = argparse.ArgumentParser(prog="bugreport")
    parser.add_argument("-V", "--version", action="version", version=f"%(prog)s {debug._get_version()}")
    parser.add_argument("--debug-info", action=_DebugInfo, help="Print debug information.")
    return parser

main ¤

main(args: list[str] | None = None) -> int

Run the main program.

This function is executed when you type bugreport or python -m bugreport.

Parameters:

  • args ¤

    (list[str] | None, default: None ) –

    Arguments passed from the command line.

Returns:

  • int –

    An exit code.

Source code in src/bugreport/_internal/cli.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
def main(args: list[str] | None = None) -> int:
    """Run the main program.

    This function is executed when you type `bugreport` or `python -m bugreport`.

    Parameters:
        args: Arguments passed from the command line.

    Returns:
        An exit code.
    """
    parser = get_parser()
    opts = parser.parse_args(args=args)
    print(opts)
    return 0

render_output_template ¤

render_output_template(
    template: str,
    inputs: dict[str, Any],
    outputs: dict[str, str],
) -> str

Render a metadata output template with current inputs and previously rendered outputs.

Source code in src/bugreport/_internal/metadata.py
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
def render_output_template(template: str, inputs: dict[str, Any], outputs: dict[str, str]) -> str:
    """Render a metadata output template with current inputs and previously rendered outputs."""
    environment = Environment(autoescape=True, trim_blocks=True, lstrip_blocks=True)
    environment.filters.update(
        {
            "mre_path": _mre_path,
            "mre_url": _mre_url,
            "mre_code": _mre_code,
            "mre_commands": _mre_commands,
            "run_mre": _run_mre,
            "venv_info": _venv_info,
        },
    )
    rendered = environment.from_string(template).render(
        inputs=_to_namespace(inputs),
        outputs=_to_namespace(outputs),
    )
    return rendered.strip()

yield_bugreport_forms ¤

yield_bugreport_forms(
    markdown: str,
) -> Iterator[BugreportForm]

Extract bugreport forms from markdown HTML comments.

Source code in src/bugreport/_internal/metadata.py
100
101
102
103
104
def yield_bugreport_forms(markdown: str) -> Iterator[BugreportForm]:
    """Extract bugreport forms from markdown HTML comments."""
    for match in _BUGREPORT_HTML_COMMENT_RE.finditer(markdown):
        if block := _to_block(match.group("content")):
            yield block