Skip to content
Snippets Groups Projects
Commit c21182ec authored by Xuefeng Ding's avatar Xuefeng Ding
Browse files

python typing

parent d4da3c04
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,6 @@ repos:
rev: v0.7.4 # Use the latest version
hooks:
- id: ruff
# args: ["--fix", "--exit-non-zero-on-fix", "--show-fixes"]
args: ["--fix", "--show-fixes"]
- id: ruff-format
......
......@@ -267,28 +267,36 @@ Publisher: Astral Software
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff
```
#### pylint: nox + vscode extensions
#### pyright: pre-commit + vscode
## vscode extensions to install
- "isort", which sort python import
- install pre-commit
```
Name: isort
Id: ms-python.isort
Description: Import organization support for Python files using isort.
Version: 2023.10.1
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.isort
```yaml
repos:
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.389
hooks:
- id: pyright
```
- "pylint", for complrehensive code analysis
- vscode: included in pylance automatically
```json
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.analysis.autoFormatStrings": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.completeFunctionParens": true,
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.inlayHints.variableTypes": true,
"python.analysis.typeCheckingMode": "strict",
"python.analysis.extraPaths": ["${workspaceFolder}/python"]
}
```
Name: Pylint
Id: ms-python.pylint
Description: Linting support for Python files using Pylint.
Version: 2024.0.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
```
#### not used
- pylint, replaced by ruff-lint
- black, replaced by ruff-format
- mypy, replaced by pyright
import os
from ._csrc._hello import add, complexf
def div(a: float, b: float) -> float:
print(os.path)
return a / b + 1
return a / b
def complex2(a: float, b: float) -> float:
def complex2(a, b: float) -> float:
return complexf(a, b) + add(a, b)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment