Drop Pyright in favor of just mypy.

Pyright has been more trouble than it's worth.

Update vscode config accordingly (including for devcontainer).
This commit is contained in:
Joshua Bronson 2022-12-29 11:15:17 -05:00
parent 84b1bdc5b0
commit e5849e210b
7 changed files with 27 additions and 33 deletions

View File

@ -9,14 +9,11 @@
// ARGS set in ./Dockerfile can be overridden here: // ARGS set in ./Dockerfile can be overridden here:
"args": {} "args": {}
}, },
// Set *default* container specific settings.json values on container create. // Default, container-specific settings here are set on container create.
// Note: The project's .vscode/settings.json is still the right place
// for non-container-specific settings.
"settings": { "settings": {
// Enable pylance's pyright integration (disabled by default):
"python.analysis.typeCheckingMode": "strict",
"python.defaultInterpreterPath": "/usr/local/bin/python", "python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.pylintEnabled": false,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black", "python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
@ -26,10 +23,9 @@
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestEnabled": true,
"esbonio.sphinx.confDir": "${workspaceFolder}/docs", "esbonio.sphinx.confDir": "${workspaceFolder}/docs",
"restructuredtext.pythonRecommendation.disabled": true, "restructuredtext.pythonRecommendation.disabled": true,
"terminal.integrated.defaultProfile.linux": "fish", "terminal.integrated.defaultProfile.linux": "fish"
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
@ -43,7 +39,7 @@
"ms-python.vscode-pylance", "ms-python.vscode-pylance",
"mutantdino.resource-monitor", "mutantdino.resource-monitor",
"tamasfe.even-better-toml", "tamasfe.even-better-toml",
"trond-snekvik.simple-rst", "trond-snekvik.simple-rst"
], ],
// Use 'forwardPorts' to make a list of ports inside the container available locally by default. // Use 'forwardPorts' to make a list of ports inside the container available locally by default.
// (Even without this, by default VS Code will notice when a process starts listening on an // (Even without this, by default VS Code will notice when a process starts listening on an

View File

@ -27,11 +27,6 @@ repos:
- id: codespell - id: codespell
args: ["--uri-ignore-words-list", "*"] # https://github.com/codespell-project/codespell/issues/2473 args: ["--uri-ignore-words-list", "*"] # https://github.com/codespell-project/codespell/issues/2473
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.285
hooks:
- id: pyright
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991 rev: v0.991
hooks: hooks:

11
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,11 @@
// vim: set ft=json5
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
"recommendations": [
"charliermarsh.ruff",
// "tamasfe.even-better-toml",
// "lextudio.restructuredtext",
// "trond-snekvik.simple-rst",
],
"unwantedRecommendations": [],
}

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
// vim: set ft=json5
{
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
// Prefer mypy over Pyright:
"python.analysis.typeCheckingMode": "off",
"python.linting.mypyEnabled": true,
"python.testing.pytestEnabled": true,
}

View File

@ -16,7 +16,7 @@ from ._typing import KT, VT, IterItems, MapOrIterItems
def iteritems_mapping_or_iterable(arg: MapOrIterItems[KT, VT]) -> IterItems[KT, VT]: def iteritems_mapping_or_iterable(arg: MapOrIterItems[KT, VT]) -> IterItems[KT, VT]:
"""Yield the items in *arg* based on whether it's a mapping.""" """Yield the items in *arg* based on whether it's a mapping."""
yield from arg.items() if isinstance(arg, t.Mapping) else arg # pyright: ignore yield from arg.items() if isinstance(arg, t.Mapping) else arg
def iteritems(__arg: MapOrIterItems[KT, VT], **kw: VT) -> IterItems[KT, VT]: def iteritems(__arg: MapOrIterItems[KT, VT], **kw: VT) -> IterItems[KT, VT]:

View File

@ -53,7 +53,6 @@ Projects
- `Sphinx <https://www.sphinx-doc.org>`__ - `Sphinx <https://www.sphinx-doc.org>`__
- `Readthedocs <https://readthedocs.org>`__ - `Readthedocs <https://readthedocs.org>`__
- `mypy <https://mypy.readthedocs.io>`__ - `mypy <https://mypy.readthedocs.io>`__
- `pyright <https://github.com/microsoft/pyright>`__
- `ruff <https://github.com/charliermarsh/ruff>`__ - `ruff <https://github.com/charliermarsh/ruff>`__
- `Flake8 <https://flake8.pycqa.org>`__ - `Flake8 <https://flake8.pycqa.org>`__
- `Pylint <https://www.pylint.org>`__ - `Pylint <https://www.pylint.org>`__

View File

@ -1,17 +0,0 @@
// vim: set ft=json5:
{
"exclude": [
"docs",
"tests",
"run_tests.py",
],
"typeCheckingMode": "strict",
// https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-rule-defaults
"reportGeneralTypeIssues": "warning",
"reportPrivateUsage": "warning",
"reportUnknownArgumentType": "warning",
"reportUnknownMemberType": "warning",
"reportUnknownVariableType": "warning",
"reportUnnecessaryIsInstance": "warning",
"reportUnnecessaryTypeIgnoreComment": "warning",
}