ruff/crates
Micha Reiser eb47a6634d
Add support for configuring knot in pyproject.toml files (#15493)
## Summary

This PR adds support for configuring Red Knot in the `tool.knot` section
of the project's
`pyproject.toml` section. Options specified on the CLI precede the
options in the configuration file.

This PR only supports the `environment` and the `src.root` options for
now.
Other options will be added as separate PRs.

There are also a few concerns that I intentionally ignored as part of
this PR:

* Handling of relative paths: We need to anchor paths relative to the
current working directory (CLI), or the project (`pyproject.toml` or
`knot.toml`)
* Tracking the source of a value. Diagnostics would benefit from knowing
from which configuration a value comes so that we can point the user to
the right configuration file (or CLI) if the configuration is invalid.
* Schema generation and there's a lot more; see
https://github.com/astral-sh/ruff/issues/15491

This PR changes the default for first party codes: Our existing default
was to only add the project root. Now, Red Knot adds the project root
and `src` (if such a directory exists).

Theoretically, we'd have to add a file watcher event that changes the
first-party search paths if a user later creates a `src` directory. I
think this is pretty uncommon, which is why I ignored the complexity for
now but I can be persuaded to handle it if it's considered important.

Part of https://github.com/astral-sh/ruff/issues/15491

## Test Plan

Existing tests, new file watching test demonstrating that changing the
python version and platform is correctly reflected.
2025-01-17 09:41:06 +01:00
..
red_knot Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
red_knot_python_semantic Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
red_knot_server Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
red_knot_test Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
red_knot_vendored [red-knot] Migrate bool/str/repr unit tests to Markdown tests (#15534) 2025-01-16 11:21:56 -08:00
red_knot_wasm Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
red_knot_workspace Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_annotate_snippets ruff_annotate_snippets: support overriding the "cut indicator" 2025-01-15 13:37:52 -05:00
ruff_benchmark Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_cache
ruff_db Remove workspace support (#15472) 2025-01-15 09:03:38 +01:00
ruff_dev
ruff_diagnostics Show errors for attempted fixes only when passed --verbose (#15237) 2025-01-03 08:50:13 -06:00
ruff_formatter Upgrade Rust toolchain to 1.84.0 (#15408) 2025-01-11 09:51:58 +01:00
ruff_graph Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_index
ruff_linter [flake8-simplify] Do not emit diagnostics for expressions inside string type annotations (SIM222, SIM223) (#15405) 2025-01-17 12:18:35 +05:30
ruff_macros Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_notebook
ruff_python_ast [ruff] itertools.starmap(..., zip(...)) (RUF058) (#15483) 2025-01-16 15:18:12 +01:00
ruff_python_ast_integration_tests
ruff_python_codegen ruff_python_ast: Make Singleton Copy (#14943) 2024-12-12 20:49:54 +01:00
ruff_python_formatter Fix bracket spacing for single-element tuples in f-string expressions (#15537) 2025-01-17 08:02:34 +00:00
ruff_python_index
ruff_python_literal Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
ruff_python_parser Parse triple quoted string annotations as if parenthesized (#15387) 2025-01-16 11:38:15 +05:30
ruff_python_resolver
ruff_python_semantic [unconventional-import-alias] Fix infinite loop between ICN001 and I002 (ICN001) (#15480) 2025-01-16 10:45:24 -05:00
ruff_python_stdlib Revert "Add all PEP-585 names to UP006 rule" (#15250) 2025-01-04 12:23:53 +01:00
ruff_python_trivia type: ignore[codes] and knot: ignore (#15078) 2024-12-23 10:52:43 +01:00
ruff_python_trivia_integration_tests
ruff_server Avoid indexing the same workspace multiple times (#15495) 2025-01-15 18:58:28 +05:30
ruff_source_file [pyupgrade] Do not report when a UTF-8 comment is followed by a non-UTF-8 one (UP009) (#14728) 2024-12-11 10:30:41 +00:00
ruff_text_size [ruff] itertools.starmap(..., zip(...)) (RUF058) (#15483) 2025-01-16 15:18:12 +01:00
ruff_wasm Bump version to 0.9.2 (#15529) 2025-01-16 13:07:26 +00:00
ruff_workspace [pydoclint] Allow ignoring one line docstrings for DOC rules (#13302) 2025-01-16 16:05:10 -06:00