convert_qmd_to_py
converter.convert_qmd_to_py(
qmd_path,
linter,
output_path=None,
*,
verbose=False,
lint_non_exec=False,
)
Convert Quarto file to Python file, preserving line alignment.
Parameters
| qmd_path |
str | Path |
Path to the input .qmd file. |
required |
| linter |
str |
Name of the linter that will be used. |
required |
| output_path |
str | Path | None |
Path for the output .py file. If None, uses qmd_path with .py suffix. |
None |
| verbose |
bool |
If True, print detailed progress information. |
False |
| lint_non_exec |
bool |
If True, also lint non-executable Python code chunks. |
False |
Returns
| output_path |
Path | None |
Path for the output .py file, or None if there was an error. |
Examples
>>> convert_qmd_to_py("input.qmd", "output.py", True)
# To use from the command line:
# $ python converter.py input.qmd [output.py] [-v]