Skip to content

Commit

Permalink
use mkdocs footnotes for cli documentation and mention `failOnWarning…
Browse files Browse the repository at this point in the history
…s` in the footnote for the `--warnings` argument
  • Loading branch information
DetachHead committed Mar 1, 2025
1 parent 955d235 commit 47d499a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
32 changes: 17 additions & 15 deletions docs/configuration/command-line.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Command-Line

Usage: basedpyright [options] [files...] (1)
Usage: basedpyright [options] [files...] [^1]

basedpyright can be run as either a language server or as a command-line tool. The command-line version allows for the following options:

Expand All @@ -15,34 +15,36 @@ basedpyright can be run as either a language server or as a command-line tool. T
| --gitlabcodequality | Output results to a gitlab code quality report |
| --writebaseline | Write new errors to the baseline file |
| -p, --project `<FILE OR DIRECTORY>` | Use the configuration file at this location |
| --pythonpath `<FILE>` | Path to the Python interpreter (2) |
| --pythonpath `<FILE>` | Path to the Python interpreter [^2] |
| --pythonplatform `<PLATFORM>` | Analyze for platform (Darwin, Linux, Windows) |
| --pythonversion `<VERSION>` | Analyze for version (3.3, 3.4, etc.) |
| --skipunannotated | Skip type analysis of unannotated functions |
| --stats | Print detailed performance stats |
| -t, --typeshedpath `<DIRECTORY>` | Use typeshed type stubs at this location (3) |
| --threads <optional N> | Use up to N threads to parallelize type checking (4) |
| -v, --venvpath `<DIRECTORY>` | Directory that contains virtual environments (5) |
| -t, --typeshedpath `<DIRECTORY>` | Use typeshed type stubs at this location [^3] |
| --threads <optional N> | Use up to N threads to parallelize type checking [^4]|
| -v, --venvpath `<DIRECTORY>` | Directory that contains virtual environments [^5] |
| --verbose | Emit verbose diagnostics |
| --verifytypes `<IMPORT>` | Verify completeness of types in py.typed package |
| --version | Print pyright version and exit |
| --warnings | Use exit code of 1 if warnings are reported |
| -w, --watch | Continue to run and watch for changes (6) |
| --warnings | Use exit code of 1 if warnings are reported [^6] |
| -w, --watch | Continue to run and watch for changes [^7] |
| - | Read file or directory list from stdin |

(1) If specific files are specified on the command line, it overrides the files or directories specified in the pyrightconfig.json or pyproject.toml file.
[^1]: If specific files are specified on the command line, it overrides the files or directories specified in the pyrightconfig.json or pyproject.toml file.

(2) This option is the same as the language server setting `python.pythonPath`. It cannot be used with --venvpath. The --pythonpath options is recommended over --venvpath in most cases. For more details, refer to the [import resolution](../usage/import-resolution.md#configuring-your-python-environment) documentation.
[^2]: This option is the same as the language server setting `python.pythonPath`. It cannot be used with --venvpath. The --pythonpath options is recommended over --venvpath in most cases. For more details, refer to the [import resolution](../usage/import-resolution.md#configuring-your-python-environment) documentation.

(3) Pyright has built-in typeshed type stubs for Python stdlib functionality. To use a different version of typeshed type stubs, specify the directory with this option.
[^3]: Pyright has built-in typeshed type stubs for Python stdlib functionality. To use a different version of typeshed type stubs, specify the directory with this option.

(4) This feature is experimental. If thread count is > 1, multiple copies of pyright are executed in parallel to type check files in a project. If no thread count is specified, the thread count is based on the number of available logical processors (if at least 4) or 1 (if less than 4).
[^4]: This feature is experimental. If thread count is > 1, multiple copies of pyright are executed in parallel to type check files in a project. If no thread count is specified, the thread count is based on the number of available logical processors (if at least 4) or 1 (if less than 4).

(5) This option is the same as the language server setting `python.venvPath`. It used in conjunction with configuration file, which can refer to different virtual environments by name. For more details, refer to the [configuration](./config-files.md) and [import resolution](../usage/import-resolution.md#configuring-your-python-environment) documentation. This allows a common config file to be checked in to the project and shared by everyone on the development team without making assumptions about the local paths to the venv directory on each developer’s computer.
!!! note
`--venvpath` is discouraged in basedpyright. [more info](../benefits-over-pyright/better-defaults.md#default-value-for-pythonpath)
[^5]: `--venvpath` is discouraged in basedpyright. [see here](../benefits-over-pyright/better-defaults.md#default-value-for-pythonpath) for more info.

(6) When running in watch mode, pyright will reanalyze only those files that have been modified. These “deltas” are typically much faster than the initial analysis, which needs to analyze all files in the source tree.
This option is the same as the language server setting `python.venvPath`. It used in conjunction with configuration file, which can refer to different virtual environments by name. For more details, refer to the [configuration](./config-files.md) and [import resolution](../usage/import-resolution.md#configuring-your-python-environment) documentation. This allows a common config file to be checked in to the project and shared by everyone on the development team without making assumptions about the local paths to the venv directory on each developer’s computer.

[^6]: `--warnings` is equivalent to [`failOnWarnings`](./config-files.md#failOnWarnings), which is enabled by default in basedpyright, meaning this option is redundant unless you explicitly disable `failOnWarnings`. [see here](../benefits-over-pyright/better-defaults.md#typecheckingmode) for more information about this decision

[^7]: When running in watch mode, pyright will reanalyze only those files that have been modified. These “deltas” are typically much faster than the initial analysis, which needs to analyze all files in the source tree.


## Pyright Exit Codes
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ markdown_extensions:
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- footnotes
plugins:
- search
- awesome-pages
Expand Down

0 comments on commit 47d499a

Please sign in to comment.