From 983707cfec8752b5cb5c591709b7b42b47ce20f6 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 25 Jul 2026 23:51:19 +1000 Subject: [PATCH] Reconcile ty config with v0.8.0: adopt all=error rules, pin ty 0.0.63 During the v0.8.0->wgpu port replay, ty config changes in pyproject.toml were deferred (wgpu's whitelist all=ignore kept, v0.8.0's code fixes applied). Now adopt v0.8.0's stricter blacklist config (all=error with curated ignores) and pin ty to 0.0.63 to match. The pyproject diff was ty-only, so no wgpu-specific config is lost. Co-Authored-By: Claude Opus 4.8 --- pyproject.toml | 106 ++++++++++------------------------------- requirements-tools.txt | 2 +- 2 files changed, 25 insertions(+), 83 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a880dcf506..fca2913fb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,92 +79,36 @@ ignore = [ ] [tool.ty.rules] -all = "ignore" +all = "error" # Structural rules (no deep type inference needed, easier to adapt). -abstract-method-in-final-class = "error" -ambiguous-protocol-member = "error" -conflicting-declarations = "error" -conflicting-metaclass = "error" -cyclic-class-definition = "error" -cyclic-type-alias-definition = "error" -dataclass-field-order = "error" -duplicate-base = "error" -duplicate-kw-only = "error" -empty-body = "error" -escape-character-in-forward-annotation = "error" -final-on-non-method = "error" -final-without-value = "error" -ignore-comment-unknown-rule = "error" -implicit-concatenated-string-type-annotation = "error" -inconsistent-mro = "error" -ineffective-final = "error" -instance-layout-conflict = "error" -invalid-dataclass = "error" -invalid-dataclass-override = "error" -invalid-enum-member-annotation = "error" -invalid-explicit-override = "error" -invalid-frozen-dataclass-subclass = "error" -invalid-generic-class = "error" -invalid-generic-enum = "error" -invalid-ignore-comment = "error" -invalid-legacy-positional-parameter = "error" -invalid-legacy-type-variable = "error" -invalid-named-tuple = "error" -invalid-newtype = "error" -invalid-overload = "error" -invalid-paramspec = "error" -invalid-protocol = "error" -invalid-syntax-in-forward-annotation = "error" -invalid-total-ordering = "error" -invalid-type-alias-type = "error" -invalid-type-checking-constant = "error" -invalid-type-guard-definition = "error" -invalid-type-variable-bound = "error" -invalid-type-variable-constraints = "error" -invalid-typed-dict-header = "error" -invalid-typed-dict-statement = "error" -override-of-final-method = "error" -override-of-final-variable = "error" -possibly-missing-import = "error" -possibly-missing-submodule = "error" -# Has false positives due to ty walrus operator bug. -# possibly-unresolved-reference = "error" -raw-string-type-annotation = "error" -redundant-final-classvar = "error" -shadowed-type-variable = "error" -subclass-of-final-class = "error" -super-call-in-named-tuple-method = "error" -unavailable-implicit-super-arguments = "error" -unbound-type-variable = "error" -undefined-reveal = "error" -unresolved-global = "error" -unresolved-import = "error" -unresolved-reference = "error" -unused-ignore-comment = "error" -unused-type-ignore-comment = "error" -useless-overload-body = "error" +# Maybe later, requires to specify element types for all generics. +missing-type-argument = "ignore" +# Conflicts with `bpy` props defined using annotations. +invalid-type-form = "ignore" # Non-structural rules: -deprecated = "error" -zero-stepsize-in-slice = "error" -possibly-missing-implicit-call = "error" -unused-awaitable = "error" - -# Function argument rules: # Conflicts with `ifcopenshell.api.geometry.add_representation` type of callables we have, confusing them with a module. -# call-non-callable = "error" -conflicting-argument-forms = "error" +call-non-callable = "ignore" +# bpy is missing some context manager implementations. +invalid-context-manager = "ignore" +# Doesn't go well with `bpy.ops.xxx.yyy`. +unresolved-attribute = "ignore" # Too many false positives. -# invalid-argument-type = "error" -missing-argument = "error" -parameter-already-assigned = "error" -positional-only-parameter-as-kwarg = "error" -too-many-positional-arguments = "error" -unknown-argument = "error" -# Has a lot of warnings due to current ty walrus operator issues. -# index-out-of-bounds = "error" -# unresolved-attribute = "error" +invalid-argument-type = "ignore" +invalid-method-override = "ignore" +invalid-assignment = "ignore" +invalid-parameter-default = "ignore" +missing-override-decorator = "ignore" +invalid-yield = "ignore" +invalid-return-type = "ignore" +non-callable-init-subclass = "ignore" +not-iterable = "ignore" +possibly-missing-attribute = "ignore" +no-matching-overload = "ignore" +not-subscriptable = "ignore" +unsupported-dynamic-base = "ignore" +unsupported-operator = "ignore" [tool.ty.environment] extra-paths = [ @@ -249,7 +193,6 @@ format.sequence = ["black", "ruff"] cmake-format = "gersemi . --in-place" [tool.poe.tasks.ty-ios] -# --ignore unresolved-reference: walrus operator false positives in ty. cmd = """ ty check nix/ @@ -267,7 +210,6 @@ cmd = """ src/ifcpatch src/ifctester --python=src/ifcopenshell-python/.venv - --ignore unresolved-reference """ [tool.poe.tasks.bonsai-deps] diff --git a/requirements-tools.txt b/requirements-tools.txt index 379240cdd0..1388c7c518 100644 --- a/requirements-tools.txt +++ b/requirements-tools.txt @@ -1,5 +1,5 @@ black==26.3.1 ruff==0.16.0 poethepoet -ty==0.0.59 +ty==0.0.63 gersemi==0.28.0