Skip to content

Commit e4a2278

Browse files
committed
Update Python profile documentation and refine Ruff settings
1 parent 2934b8d commit e4a2278

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

profiles/python/python.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,20 @@ A python profile with useful settings and a full theme already configured. The t
1212

1313
Ligatures are disabled by default. To enable them, search for "ligature" in the settings then change the `editor.fontLigatures` setting to `true`.
1414

15-
### Ruff / black settings
16-
17-
It is not recommended putting any settings for black and ruff (or any other formatter/linter/type checker) in a `settings.json` file, because it will always override settings that are put in a `pyproject.toml` file in the workspace (which is the recommended way to configure those tools for any project, even without vscode).
18-
19-
Instead, you should put the settings in a `pyproject.toml` file at the root of your project / workspace. Here is an example of a `pyproject.toml` template file:
15+
### Ruff settings
2016

17+
Default settings (rules) are set in the `settings.json` file.
18+
To override them, use a `pyproject.toml` file at the root of your project / workspace. This is the recommended way to configure those tools for any project, even without vscode. Here is an example of a `pyproject.toml` file for the Ruff linter:
2119
<details>
2220
<summary>pyproject.toml</summary>
2321
<p>
2422

2523
```toml
26-
[tool.black]
27-
# should be same as ruff
28-
line-length = 88
29-
3024
[tool.ruff]
31-
# should be same as black
3225
line-length = 88
26+
fix=true
3327

28+
[tool.ruff.lint]
3429
# https://beta.ruff.rs/docs/rules/
3530
select = [
3631
"E", # pycodestyle
@@ -87,10 +82,10 @@ exclude = [
8782
"venv",
8883
]
8984

90-
[tool.ruff.extend-per-file-ignores]
85+
[tool.ruff.lint.extend-per-file-ignores]
9186
"__init__.py" = ["F401"] # disable unused import rule in __init__.py files
9287

93-
[tool.ruff.pydocstyle]
88+
[tool.ruff.lint.pydocstyle]
9489
# https://beta.ruff.rs/docs/settings/#pydocstyle-convention
9590
convention = "google"
9691

@@ -100,10 +95,10 @@ multiline-quotes = "double"
10095
docstring-quotes = "double"
10196

10297

103-
[tool.ruff.pylint]
98+
[tool.ruff.lint.pylint]
10499
max-args = 5
105100

106-
[tool.pyright]
101+
[tool.lint.pyright]
107102
# deactivate pyright features that are already covered by ruff
108103
# actually only enables type checking
109104
# https://microsoft.github.io/pyright/#/configuration?id=diagnostic-rule-defaults for more info
@@ -123,8 +118,7 @@ reportUnusedFunction = false
123118
- `Python` - Python extension for Visual Studio Code.
124119
- `Pylance` - Fast, feature-rich language support for Python, including the pyright static type checker.
125120
- `Python environment manager` - Browse and manage all of your Python environments & packages from a single place.
126-
- `Black formatter` - Support for the [Black](https://github.com/psf/black) formatter.
127-
- `Ruff` - Support for the [Ruff](https://beta.ruff.rs/docs/) linter.
121+
- `Ruff` - Support for the [Ruff](https://beta.ruff.rs/docs/) linter and code formatter.
128122
- `Python indent` - Correct python indentation in VS Code.
129123
- `autoDocstring` - Automatically generates docstrings.
130124
- `Even Better TOML` - TOML file support, for project config setup files like `pyproject.toml`.

scripts/build_profile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def dump_snippets(self) -> str | None:
9696
not_dumped = {
9797
"snippets": {
9898
snippet.name: snippet.read_text(encoding="utf8") for snippet in snippets
99-
}
99+
},
100100
}
101101
return json.dumps(not_dumped)
102102

@@ -180,5 +180,6 @@ def main():
180180
path = DIRECTORY / name.lower().replace(" ", "_")
181181
Profile(path).write_code_profile(name)
182182

183+
183184
if __name__ == "__main__":
184185
main()

0 commit comments

Comments
 (0)