-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[red-knot] Persistent configuration #15491
Comments
MichaReiser
added a commit
that referenced
this issue
Jan 15, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 15, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 15, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 15, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 16, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 16, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 16, 2025
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 take precedence over the options in the configuration file. For now, this PR only adds support for the `environment` and the `src.root` options. 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. It would be nice for diagnostics to know 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 #15491
MichaReiser
added a commit
that referenced
this issue
Jan 17, 2025
## 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 #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 #15491 ## Test Plan Existing tests, new file watching test demonstrating that changing the python version and platform is correctly reflected.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support configuring Red Knot in a persistent configuration:
pyproject.toml
orknot.toml
.rules
: enable and disable rulesenvironment
: (python version, platform, search paths)files
: Override a sub-set of settings on a path levelsrc
: Which files should be considered first-party and what's the src rootterminal
: Configure color output, etc.respect-ignore-files
)requires-python
(I'm leaning towards just making it a field onProjectMetadata
because we only respect therequires-python
constraint in the project's configuration file)knot.toml
in any ancestor directory)The text was updated successfully, but these errors were encountered: