mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-25 22:29:02 +00:00
[ty] Change environment.root to accept multiple paths (#18913)
This commit is contained in:
parent
0194452928
commit
833be2e66a
4 changed files with 39 additions and 28 deletions
11
crates/ty/docs/configuration.md
generated
11
crates/ty/docs/configuration.md
generated
|
|
@ -134,9 +134,11 @@ python-version = "3.12"
|
|||
|
||||
#### `root`
|
||||
|
||||
The root of the project, used for finding first-party modules.
|
||||
The root paths of the project, used for finding first-party modules.
|
||||
|
||||
If left unspecified, ty will try to detect common project layouts and initialize `src.root` accordingly:
|
||||
Accepts a list of directory paths searched in priority order (first has highest priority).
|
||||
|
||||
If left unspecified, ty will try to detect common project layouts and initialize `root` accordingly:
|
||||
|
||||
* if a `./src` directory exists, include `.` and `./src` in the first party search path (src layout or flat)
|
||||
* if a `./<project-name>/<project-name>` directory exists, include `.` and `./<project-name>` in the first party search path
|
||||
|
|
@ -147,13 +149,14 @@ it will also be included in the first party search path.
|
|||
|
||||
**Default value**: `null`
|
||||
|
||||
**Type**: `str`
|
||||
**Type**: `list[str]`
|
||||
|
||||
**Example usage** (`pyproject.toml`):
|
||||
|
||||
```toml
|
||||
[tool.ty.environment]
|
||||
root = "./app"
|
||||
# Multiple directories (priority order)
|
||||
root = ["./src", "./lib", "./vendor"]
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue