For reference:
In the newest python templates, it is very clear how to configure Code intelligence.
So create a new python repl and open the pyproject.toml
file.
Most code intelligence is controlled by ruff.
The list of enabled categories of rules is in the select
variable: add or remove rulesets here.
You can disable individual rules in the ignore
variable.
The categories and specific rules are found at Rules - Ruff.
More settings such as line length can be configured by putting more variables in the file, sometimes in separate sections.
Details are found at Settings - Ruff.
Example pyproject.toml
file:
[tool.poetry]
name = "python-template"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = ">=3.10.0"
[tool.pyright]
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md
useLibraryCodeForTypes = true
exclude = [".cache"]
[tool.ruff]
# https://beta.ruff.rs/docs/configuration/
select = ['E', 'W', 'F', 'I', 'B', 'C4', 'ARG', 'SIM', 'PIE']
ignore = ['W292', 'W293', 'SIM105']
line-length = 90
[tool.ruff.isort]
combine-as-imports = true
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
NOTE:
Invalid configuration such as putting a nonexistent ruleset or specific rule, or a typo in a variable name may break code intelligence, disabling it. Be sure that code intelligence is working when modifying configuration (it takes a few seconds for changes to take effect).
Also, code intelligence cannot be configured with the CLI (shell).