Getting started

Installation

Python 3.7 or higher is required. lintquarto itself has no dependencies.

Install lintquarto with:

pip install lintquarto

Linters are installed separately. For example, to use pylint and flake8, run:

pip install pylint flake8

If you want to install lintquarto along with all supported linters, use:

pip install lintquarto[all]

You can verify your installation with:

lintquarto --version


Basic usage

lintquarto -l LINTER [LINTER …] -p PATH [PATH …] [-e EXCLUDE [EXCLUDE …]] [-k]

  • -l –linters LINTER [LINTER …] - Linters to run. Valid options: pylint, flake8, pyflakes, ruff, vulture, radon, pycodestyle, mypy, pyright, pyrefly, or pytype.
  • -p –paths PATH [PATH …]- Quarto files and/or directories to lint.
  • -e –exclude EXCLUDE [EXCLUDE …] - Files and/or directories to exclude from linting.
  • -k, –keep-temp - Keep the temporary .py files created during linting (for debugging).

Only one linter can be specified per command. Passing extra arguments directly to linters is not supported. Only .qmd files are processed.


Examples

The linter used is interchangeable in these examples.

Lint all .qmd files in the current directory (using pylint):

lintquarto -l pylint -p .

Lint several specific files (using pylint and flake8):

lintquarto -l pylint flake8 -p file1.qmd file2.qmd

Keep temporary .py files after linting (with pylint)

lintquarto -l pylint -p . -k

Lint all files in current directory (using ruff):

  • Excluding folders examples/ and ignore/, or-
  • Excluding a specific file analysis/test.qmd.
lintquarto -l ruff -p . -e examples,ignore
lintquarto -l ruff -p . -e analysis/test.qmd