finesse.utilities.bug_report module
- class finesse.utilities.bug_report.SourceType(*values)[source]
Bases:
Enum- INTERACTIVE = 'Interactive'
- REPL = 'REPL'
- SCRIPT = 'Script'
- STDIN = 'stdin'
- finesse.utilities.bug_report.bug_report(title: str | None = None, file: str | Path | None = None, include_source: bool = False)[source]
Generate a markdown bug report, suitable for copy-pasting into chatrooms or GitLab issues. Contains the source code, the triggered exception (if any) and machine and python environment information.
Parameters
- titlestr | None, optional
Title to insert on top of markdown, by default None
- filestr | Path | None, optional
Whether to write the report to file. Will silently overwrite existing files, by default None
- include_sourcebool, optional
Wether to include the source code that caused the exception (the contents of the Jupyter notebook or Python script file) into the bug report. Be careful when including source with proprietary/confidential information source in bug reports shared in public spaces like Gitlab or the Matrix channel. Defaults to False
- finesse.utilities.bug_report.get_package_versions() str[source]
Report all currently imported package version by looping over
sys.modulesand looking for ‘__version__’ attributes. Explicitly avoids calling into conda/pip since there are too many package managers to accommodate for.Returns
- str
list of <package> == <version> for every package
- finesse.utilities.bug_report.get_source() str[source]
Get source of the ‘__main__’ module. Supports Ipython (Jupyter Notebook, VSCode), interactive interpreter and regular python modules.
Returns
- str
Source code
- finesse.utilities.bug_report.get_source_type() SourceType[source]
Type of source for the python code currently being executed.
Returns
- SourceType
Interactive environment (jupyter), terminal REPL or plain python script