astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

A way to run `rye fmt` with the `--preview` flag #1089

Open Vulwsztyn opened 4 months ago

Vulwsztyn commented 4 months ago

I'd like to run rye fmt with the --preview flag, but can see no such option in help

> rye fmt --help 
Run the code formatter on the project.

This invokes ruff in format mode.

Usage: rye fmt [OPTIONS] [PATHS]... [-- <EXTRA_ARGS>...]

Arguments:
  [PATHS]...
          List of files or directories to limit the operation to

  [EXTRA_ARGS]...
          Extra arguments to ruff

Options:
  -a, --all
          Perform the operation on all packages

  -p, --package <PACKAGE>
          Perform the operation on a specific package

      --pyproject <PYPROJECT_TOML>
          Use this pyproject.toml file

  -v, --verbose
          Enables verbose diagnostics

  -q, --quiet
          Turns off all output

      --check
          Run format in check mode

  -h, --help
          Print help (see a summary with '-h')
bluss commented 4 months ago

It should work if you put it where it says EXTRA_ARGS in the docs. Note that rye's bundled ruff is trailing the ruff project by some versions, currently.