Skip to content

Commit

Permalink
chore: update Python extension settings
Browse files Browse the repository at this point in the history
  • Loading branch information
seanwu1105 committed Sep 4, 2023
1 parent 1123719 commit 2716f47
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 75 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ jobs:
run: poetry install --no-interaction --no-root

- name: Lint
run: |
poetry run pylint scripts
poetry run mypy scripts
run: poetry run pylint scripts

py-test:
strategy:
Expand Down
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-python.python"
"ms-python.python",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.isort"
]
}
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@
"source.fixAll": true,
"source.organizeImports": true
},
"typescript.preferences.importModuleSpecifier": "relative"
"typescript.preferences.importModuleSpecifier": "relative",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.analysis.autoImportCompletions": true,
"pylint.args": ["--rcfile=${workspaceFolder}/python/.pylintrc"],
"isort.args": ["--settings-file=${workspaceFolder}/python/.isort.cfg"]
}
2 changes: 1 addition & 1 deletion python/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ persistent=yes

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.7
py-version=3.8

# Discover python modules and packages in the file system subtree.
recursive=no
Expand Down
16 changes: 0 additions & 16 deletions python/.vscode/settings.json

This file was deleted.

54 changes: 6 additions & 48 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pyqt5 = { version = "^5.15.7", markers = "sys_platform != 'darwin' or platform_m

[tool.poetry.group.dev.dependencies]
pylint = "^2.14.5"
mypy = "^0.971"
black = "^22.6.0"
pytest = "^7.1.2"
pytest-cov = "^4.0.0"
Expand Down
7 changes: 4 additions & 3 deletions python/scripts/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

QT_DEPENDENCY_ARG = "vscode_extension_qt_dependency"

SupportedQtDependencies = typing.Optional[str]
SupportedQtDependencies = typing.Optional[
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
]


def is_installed(name: str) -> bool:
Expand All @@ -19,8 +21,7 @@ def parse_qt_dependency() -> SupportedQtDependencies:
required=False,
)

dep = vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]
if dep is not None:
if dep := vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]:
sys.argv.remove(f"--{QT_DEPENDENCY_ARG}")
sys.argv.remove(dep)

Expand Down
4 changes: 3 additions & 1 deletion python/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

ASSETS_DIR = os.path.join(TESTS_DIR, "assets")

SupportedScripts = typing.Type[str]
SupportedScripts = typing.Literal[
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
]


def filter_available_qt_dependencies(
Expand Down

0 comments on commit 2716f47

Please sign in to comment.