Getting started

Installation

Python 3.7 or higher is required. lintquarto itself has only one required package: toml.

You can install lintquarto with pip (from PyPI) or conda (from conda-forge).

Install with pip

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

Install with conda

conda install conda-forge::lintquarto

With conda, only the main lintquarto tool is installed. If you want to use any linters or type checkers, you must install them separately (either with conda or pip, depending on availability).

Basic usage

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

  • -l –linters LINTER [LINTER …] - Linters to run.
  • -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).

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