From 653f156229e02b3aa77e999c1f02bf22358aa883 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Mon, 30 Jun 2025 14:54:20 -0400 Subject: [PATCH 1/7] Add Pyright CI workflow --- .github/workflows/pyright.yaml | 24 +++++++++++++++++++ .gitignore | 1 + package-lock.json | 44 ++++++++++++++++++++++++++++++++++ package.json | 5 ++++ pyproject.toml | 32 +++++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 .github/workflows/pyright.yaml create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/pyright.yaml b/.github/workflows/pyright.yaml new file mode 100644 index 0000000000..5bcea6d7cd --- /dev/null +++ b/.github/workflows/pyright.yaml @@ -0,0 +1,24 @@ +on: [ push, pull_request ] +name: Pyright type checking +jobs: + pyright: + runs-on: ubuntu-latest + container: + image: archlinux/archlinux:latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - name: Prepare arch + run: | + pacman-key --init + pacman --noconfirm -Sy archlinux-keyring + pacman --noconfirm -Syyu + pacman --noconfirm -Sy python-pip python-pyparted pkgconfig gcc nodejs npm + - run: pip install --break-system-packages --upgrade pip + - name: Install Python dependencies + run: pip install --break-system-packages .[dev] + - name: Install Node.js dependencies + run: npm install + - name: Display Pyright version + run: npx --no -- pyright --version + - name: Run Pyright + run: npx --no -- pyright diff --git a/.gitignore b/.gitignore index 9e30144f3b..376bdbd535 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ requirements.txt /.gitconfig /actions-runner /cmd_output.txt +node_modules/ uv.lock diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000..7b60b7ad4c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,44 @@ +{ + "name": "archinstall", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "pyright": "1.1.403" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/pyright": { + "version": "1.1.403", + "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.403.tgz", + "integrity": "sha512-OyslngwxftKgNfbiyR8WDadUoLHDoinwUfbd50P1VBfLWkR5cro9R52qMQMpVI/LiSVpWbzunToR2NX7SanwmA==", + "dev": true, + "license": "MIT", + "bin": { + "pyright": "index.js", + "pyright-langserver": "langserver.index.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000..26a3f73fa8 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "pyright": "1.1.403" + } +} diff --git a/pyproject.toml b/pyproject.toml index 40e6a3cb92..805526eb72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,6 +136,7 @@ testpaths = ["tests"] ignore-paths = [ "^build/", "^docs/", + "^node_modules/", ] load-plugins = ["pylint_pydantic"] persistent = false @@ -230,3 +231,34 @@ ignore = [ [tool.ruff.lint.mccabe] max-complexity = 40 + +[tool.pyright] +pythonVersion = "3.12" +typeCheckingMode = "strict" +exclude = [ + "**/node_modules", + "**/__pycache__", + "**/.*", + "build/", +] +reportArgumentType = false +reportAttributeAccessIssue = false +reportMatchNotExhaustive = false +reportMissingTypeStubs = false +reportPrivateUsage = false +reportTypedDictNotRequiredAccess = false +reportUnknownArgumentType = false +reportUnknownLambdaType = false +reportUnknownMemberType = false +reportUnknownVariableType = false +reportUnnecessaryComparison = false + +# Additional flags that are not included in strict mode +deprecateTypingAliases = true +reportImplicitOverride = true +reportImportCycles = false +reportPropertyTypeMismatch = true +reportShadowedImports = true +strictDictionaryInference = true +strictListInference = true +strictSetInference = true From 8a0c39a9d5fd6f49f98f226edb1a72568343ce31 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:57:24 -0400 Subject: [PATCH 2/7] Fix remaining Pyright warnings --- archinstall/lib/models/device.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/models/device.py b/archinstall/lib/models/device.py index 7dc940392e..fb056d0db6 100644 --- a/archinstall/lib/models/device.py +++ b/archinstall/lib/models/device.py @@ -317,10 +317,6 @@ class Size: unit: Unit sector_size: SectorSize - def __post_init__(self) -> None: - if not isinstance(self.sector_size, SectorSize): - raise ValueError('sector size must be of type SectorSize') - def json(self) -> _SizeSerialization: return { 'value': self.value, @@ -352,7 +348,9 @@ def convert( norm = self._normalize() return Size(norm, Unit.B, self.sector_size).convert(target_unit, sector_size) else: - if target_unit == Unit.sectors and sector_size is not None: + if target_unit == Unit.sectors: + assert sector_size is not None + norm = self._normalize() sectors = math.ceil(norm / sector_size.value) return Size(sectors, Unit.sectors, sector_size) From 046d5c372729c29f913ba6265d532c84529256e8 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:49:52 -0400 Subject: [PATCH 3/7] Update actions/checkout action to v5 --- .github/workflows/pyright.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pyright.yaml b/.github/workflows/pyright.yaml index 5bcea6d7cd..a717559ec5 100644 --- a/.github/workflows/pyright.yaml +++ b/.github/workflows/pyright.yaml @@ -6,7 +6,7 @@ jobs: container: image: archlinux/archlinux:latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - name: Prepare arch run: | pacman-key --init From 6ab9e046614a099fdf490892ff0f10f5ff89c21e Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:48:06 -0400 Subject: [PATCH 4/7] Remove strict inference settings that are enabled by default --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 805526eb72..81b33817ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -259,6 +259,3 @@ reportImplicitOverride = true reportImportCycles = false reportPropertyTypeMismatch = true reportShadowedImports = true -strictDictionaryInference = true -strictListInference = true -strictSetInference = true From 5bb366130e4bb5f343dab49bed03899e52e92c39 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:51:18 -0400 Subject: [PATCH 5/7] Update to Pyright 1.1.404 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7b60b7ad4c..bc94547c25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "devDependencies": { - "pyright": "1.1.403" + "pyright": "1.1.404" } }, "node_modules/fsevents": { @@ -24,9 +24,9 @@ } }, "node_modules/pyright": { - "version": "1.1.403", - "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.403.tgz", - "integrity": "sha512-OyslngwxftKgNfbiyR8WDadUoLHDoinwUfbd50P1VBfLWkR5cro9R52qMQMpVI/LiSVpWbzunToR2NX7SanwmA==", + "version": "1.1.404", + "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.404.tgz", + "integrity": "sha512-Gr48RLeyis8uMjx04vXGIdj3OFe/WGGBMg53XIh9GH30KRyuyKYNAjfUZqj3r51Xrv5BFKyDyguJu/BV3hi7QA==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index 26a3f73fa8..d432738134 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "1.1.403" + "pyright": "1.1.404" } } From bf62a8c9b4b4639cdd3bc193ac4a7f10cb1aa565 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:46:22 -0400 Subject: [PATCH 6/7] Update to Pyright 1.1.405 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc94547c25..23122e3f35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "devDependencies": { - "pyright": "1.1.404" + "pyright": "1.1.405" } }, "node_modules/fsevents": { @@ -24,9 +24,9 @@ } }, "node_modules/pyright": { - "version": "1.1.404", - "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.404.tgz", - "integrity": "sha512-Gr48RLeyis8uMjx04vXGIdj3OFe/WGGBMg53XIh9GH30KRyuyKYNAjfUZqj3r51Xrv5BFKyDyguJu/BV3hi7QA==", + "version": "1.1.405", + "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.405.tgz", + "integrity": "sha512-hgy12kLZ1oAMtl9LTsByHftg3AD6Pouwu5rBsQlqYQqCCdGBgaQm9XDAPDap7ayWe9W+NWrUwO7Zy1K7uXoE2A==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index d432738134..5b45d5b650 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "1.1.404" + "pyright": "1.1.405" } } From e28505e3b2d818f157a5495f69df71f990cab8bc Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:48:34 -0400 Subject: [PATCH 7/7] Remove reportShadowedImports option that has been removed upstream --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 81b33817ed..dc8d45f977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -258,4 +258,3 @@ deprecateTypingAliases = true reportImplicitOverride = true reportImportCycles = false reportPropertyTypeMismatch = true -reportShadowedImports = true