Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit e8429d7

Browse files
committed
feat: support Python 3.7+
Fix #292
1 parent 289e02b commit e8429d7

File tree

7 files changed

+142
-17
lines changed

7 files changed

+142
-17
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
nodejs 18.14.2
2-
python 3.10.9
2+
python 3.7.16

python/.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ persistent=yes
8282

8383
# Minimum Python version to use for version dependent checks. Will default to
8484
# the version used to run pylint.
85-
py-version=3.10
85+
py-version=3.7
8686

8787
# Discover python modules and packages in the file system subtree.
8888
recursive=no

python/.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python 3.10.9
1+
python 3.7.16

python/poetry.lock

Lines changed: 126 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ description = "Scripts to communicate between the extension and Qt for Python li
55
authors = ["Shuang Wu <seanwu1105@gmail.com>"]
66

77
[tool.poetry.dependencies]
8-
python = "~3.10"
8+
python = "~3.7.2"
99
pyside6 = "^6.4.2"
1010
pyqt6 = "^6.4.0"
1111
pyside2 = { version = "^5.15.2.1", markers = "sys_platform != 'darwin' or platform_machine != 'arm64'" }
1212
pyqt5 = { version = "^5.15.7", markers = "sys_platform != 'darwin' or platform_machine != 'arm64'" }
13+
typing-extensions = "^4.5.0"
1314

1415
[tool.poetry.group.dev.dependencies]
1516
pylint = "^2.14.5"

python/scripts/utils/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
import sys
44
import typing
55

6+
import typing_extensions # Remove after dropping Python 3.7
7+
68
QT_DEPENDENCY_ARG = "vscode_extension_qt_dependency"
79

810
SupportedQtDependencies = typing.Optional[
9-
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
11+
typing_extensions.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
1012
]
1113

1214

@@ -21,7 +23,8 @@ def parse_qt_dependency() -> SupportedQtDependencies:
2123
required=False,
2224
)
2325

24-
if dep := vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]:
26+
dep = vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]
27+
if dep is not None:
2528
sys.argv.remove(f"--{QT_DEPENDENCY_ARG}")
2629
sys.argv.remove(dep)
2730

python/tests/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import subprocess
44
import typing
55

6+
import typing_extensions
7+
68
from scripts.utils import QT_DEPENDENCY_ARG, SupportedQtDependencies
79

810
TESTS_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -11,22 +13,22 @@
1113

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

14-
SupportedScripts = typing.Literal[
16+
SupportedScripts = typing_extensions.Literal[
1517
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
1618
]
1719

1820

1921
def filter_available_qt_dependencies(
20-
deps: list[SupportedQtDependencies],
21-
) -> list[SupportedQtDependencies]:
22+
deps: typing.List[SupportedQtDependencies],
23+
) -> typing.List[SupportedQtDependencies]:
2224
if platform.system() == "Darwin" and platform.machine() == "arm64":
2325
return [None] + list(filter(lambda d: d not in ("PySide2", "PyQt5"), deps))
2426
return [None] + deps
2527

2628

2729
def invoke_script(
2830
name: SupportedScripts,
29-
args: list[str],
31+
args: typing.List[str],
3032
qt_dependency: SupportedQtDependencies,
3133
):
3234
if qt_dependency is not None:

0 commit comments

Comments
 (0)