bugreport
¤
BugReport package.
Maintainers store configuration in their repository, users call the tool to generate high quality bug reports easily.
Classes:
-
BugreportElement–Base class for bugreport elements.
-
BugreportForm–A bugreport form defined in issue-template metadata.
-
BugreportInput–Common settings for a bugreport input.
-
BugreportInputBoolean–A checkbox in a bugreport form.
-
BugreportInputChoice–An input for selecting one option.
-
BugreportInputChoices–An input for selecting several options.
-
BugreportInputPath–An input for a filesystem path.
-
BugreportInputString–A single line of text in a bugreport form.
-
BugreportInputText–Several lines of text in a bugreport form.
-
BugreportMarkdown–Markdown instructions displayed in a bugreport form.
-
BugreportStep–A group of inputs with an optional condition and output templates.
-
FormApp–Display a GitHub issue form and its bugreport metadata in a terminal.
-
GitHubCheckboxOption–One checkbox option in a GitHub issue form.
-
GitHubElementCheckboxes–A group of checkbox options in a GitHub issue form.
-
GitHubElementDropdown–A list of options to select in a GitHub issue form.
-
GitHubElementInput–An input for a single line of text in a GitHub issue form.
-
GitHubElementMarkdown–Markdown instructions in a GitHub issue form.
-
GitHubElementTextarea–An input for several lines of text in a GitHub issue form.
-
GitHubForm–The supported elements of a GitHub issue form.
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–Supported bugreport input types.
-
TypeGitHubElement–Supported GitHub issue-form element types.
TypeBugreportInput
module-attribute
¤
TypeBugreportInput = (
BugreportInputString
| BugreportInputChoice
| BugreportInputChoices
| BugreportInputText
| BugreportInputBoolean
| BugreportInputPath
)
Supported bugreport input types.
TypeGitHubElement
module-attribute
¤
TypeGitHubElement = (
GitHubElementMarkdown
| GitHubElementTextarea
| GitHubElementInput
| GitHubElementDropdown
| GitHubElementCheckboxes
)
Supported GitHub issue-form element types.
BugreportElement
¤
Bases: BaseModel
Base class for bugreport elements.
Attributes:
BugreportForm
¤
Bases: BaseModel
A bugreport form defined in issue-template metadata.
Methods:
-
from_github–Convert a GitHub form to a Bugreport form.
Attributes:
-
body(list[BugreportStep | BugreportMarkdown]) –Steps and Markdown instructions in display order.
-
subtitle(str | None) –Additional text below the title.
-
title(str | None) –Title of the form.
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.
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 | |
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.
label
class-attribute
instance-attribute
¤
label: str | None = None
Label displayed above the input.
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.
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.
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.
label
class-attribute
instance-attribute
¤
label: str | None = None
Label displayed above the input.
options
class-attribute
instance-attribute
¤
Option values mapped to their displayed labels.
placeholder
class-attribute
instance-attribute
¤
placeholder: str | None = None
Hint displayed when the input is empty.
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.
label
class-attribute
instance-attribute
¤
label: str | None = None
Label displayed above the input.
options
class-attribute
instance-attribute
¤
Option values mapped to their displayed labels.
placeholder
class-attribute
instance-attribute
¤
placeholder: str | None = None
Hint displayed when the input is empty.
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.
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.
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.
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.
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.
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.
BugreportMarkdown
¤
Bases: BugreportElement
Markdown instructions displayed in a bugreport form.
Attributes:
BugreportStep
¤
Bases: BaseModel
A group of inputs with an optional condition and output templates.
Attributes:
-
body(list[TypeBugreportInput | BugreportMarkdown]) –Inputs and Markdown instructions in display order.
-
condition(str | None) –Condition that controls whether the step is displayed.
-
description(str | None) –Markdown instructions for the step.
-
outputs(dict[str, str]) –Output names mapped to Jinja templates for their values.
-
slug(str | None) –Identifier for the step.
-
title(str | None) –Title displayed above the step.
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
¤
Output names mapped to Jinja templates for their values.
FormApp
¤
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:
-
CSS_PATH–Stylesheet for the form widgets.
-
form_inputs(dict[str, Any]) –Current input values, keyed by input identifier.
-
form_outputs(dict[str, str]) –Rendered output values, keyed by output name.
-
issue_template–Path to the GitHub issue-template YAML file.
Source code in src/bugreport/_internal/forms.py
62 63 64 65 66 67 68 69 70 71 72 | |
CSS_PATH
class-attribute
instance-attribute
¤
CSS_PATH = Path(__file__).parent / 'forms.tcss'
Stylesheet for the form widgets.
form_inputs
instance-attribute
¤
Current input values, keyed by input identifier.
form_outputs
instance-attribute
¤
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 | |
GitHubCheckboxOption
¤
Bases: BaseModel
One checkbox option in a GitHub issue form.
Attributes:
GitHubElementCheckboxes
¤
Bases: BaseModel
A group of checkbox options in a GitHub issue form.
Attributes:
-
description(str | None) –Markdown instructions displayed below the label.
-
id(str | None) –Optional identifier for the group.
-
label(str) –Label displayed above the checkboxes.
-
options(list[GitHubCheckboxOption]) –Checkbox options in display order.
-
required(bool) –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.
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.
placeholder
class-attribute
instance-attribute
¤
placeholder: str | None = ''
Hint displayed when the input is empty.
GitHubElementMarkdown
¤
Bases: BaseModel
Markdown instructions in a GitHub issue form.
Attributes:
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.
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.
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(list[TypeGitHubElement]) –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 | |
discover
¤
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
.ymlfile withbugin its name.
Raises:
-
FileNotFoundError–No matching file was found.
-
CalledProcessError–A Git command failed.
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 | |
evaluate_section_condition
¤
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 | |
get_parser
¤
get_parser() -> ArgumentParser
Return the CLI argument parser.
Returns:
-
ArgumentParser–An argparse parser.
Source code in src/bugreport/_internal/cli.py
48 49 50 51 52 53 54 55 56 57 | |
main
¤
Run the main program.
This function is executed when you type bugreport or python -m bugreport.
Parameters:
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 | |
render_output_template
¤
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 | |
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 | |