From 06d0356fdd0b8d16f61d1445ac02424cd6077cd8 Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Mon, 5 Aug 2024 15:15:47 -0700 Subject: [PATCH] Add Github action to run mypy --- .github/workflows/mypy.yaml | 45 +++++ mypy-baseline.txt | 324 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 4 + 3 files changed, 373 insertions(+) create mode 100644 .github/workflows/mypy.yaml create mode 100644 mypy-baseline.txt diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml new file mode 100644 index 000000000..3e434c23f --- /dev/null +++ b/.github/workflows/mypy.yaml @@ -0,0 +1,45 @@ +name: flake8 +on: + pull_request: + paths: + - 'src/rez/**.py' + - 'src/rezplugins/**.py' + - 'pyproject.toml' + - '!src/rez/utils/_version.py' + - '!src/rez/data/**' + - '!src/rez/vendor/**' + - '!src/rez/backport/**' + push: + paths: + - 'src/rez/**.py' + - 'src/rezplugins/**.py' + - 'pyproject.toml' + - '!src/rez/utils/_version.py' + - '!src/rez/data/**' + - '!src/rez/vendor/**' + - '!src/rez/backport/**' + +permissions: + contents: read + +jobs: + mypy: + name: Run mypy static type analysis + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up Python + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: 3.11 + + - name: Install Dependencies + run: | + pip install .[mypy] + + - name: Run mypy + run: >- + mypy | mypy-baseline filter diff --git a/mypy-baseline.txt b/mypy-baseline.txt new file mode 100644 index 000000000..7beac8838 --- /dev/null +++ b/mypy-baseline.txt @@ -0,0 +1,324 @@ +src/rez/deprecations.py:0: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], str]", variable has type "Callable[[Warning | str, type[Warning], str, int, str | None], str]") [assignment] +src/rez/version/_version.py:0: error: Unsupported left operand type for < ("_Comparable") [operator] +src/rez/version/_version.py:0: error: Unsupported left operand type for < ("_Comparable") [operator] +src/rez/version/_version.py:0: error: Unsupported left operand type for < ("_Comparable") [operator] +src/rez/version/_version.py:0: error: Argument 1 of "less_than" is incompatible with supertype "VersionToken"; supertype defines the argument type as "VersionToken" [override] +src/rez/version/_version.py:0: note: This violates the Liskov substitution principle +src/rez/version/_version.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides +src/rez/version/_version.py:0: error: Argument 1 to "AlphanumericVersionToken" has incompatible type "None"; expected "str" [arg-type] +src/rez/version/_version.py:0: error: Item "None" of "list[VersionToken] | None" has no attribute "pop" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "list[VersionToken] | None" has no attribute "append" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_UpperBound | None" has no attribute "version" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_UpperBound | None" has no attribute "version" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "upper" [union-attr] +src/rez/version/_version.py:0: error: Unsupported operand types for > ("int" and "None") [operator] +src/rez/version/_version.py:0: note: Left operand is of type "int | None" +src/rez/version/_version.py:0: error: Invalid index type "int | None" for "list[_Bound]"; expected type "SupportsIndex" [index] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "upper_bounded" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "version_containment" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "lower_bounded" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "version_containment" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "version_containment" [union-attr] +src/rez/version/_version.py:0: error: Item "None" of "_Bound | None" has no attribute "lower_bounded" [union-attr] +src/rez/utils/py_dist.py:0: error: Library stubs not installed for "pkg_resources" [import-untyped] +src/rez/version/_requirement.py:0: error: Incompatible return value type (got "VersionRange | None", expected "VersionRange") [return-value] +src/rez/version/_requirement.py:0: error: Item "None" of "VersionRange | None" has no attribute "issuperset" [union-attr] +src/rez/version/_requirement.py:0: error: Item "None" of "VersionRange | None" has no attribute "issuperset" [union-attr] +src/rez/version/_requirement.py:0: error: Item "None" of "VersionRange | None" has no attribute "intersects" [union-attr] +src/rez/version/_requirement.py:0: error: Argument 1 to "intersects" of "VersionRange" has incompatible type "VersionRange | None"; expected "VersionRange" [arg-type] +src/rez/version/_requirement.py:0: error: Unsupported right operand type for in ("VersionRange | None") [operator] +src/rez/version/_requirement.py:0: error: Unsupported right operand type for in ("VersionRange | None") [operator] +src/rez/version/_requirement.py:0: error: Unsupported left operand type for | ("None") [operator] +src/rez/version/_requirement.py:0: note: Both left and right operands are unions +src/rez/version/_requirement.py:0: error: Unsupported left operand type for - ("None") [operator] +src/rez/version/_requirement.py:0: note: Both left and right operands are unions +src/rez/version/_requirement.py:0: error: Unsupported left operand type for & ("None") [operator] +src/rez/version/_requirement.py:0: note: Both left and right operands are unions +src/rez/version/_requirement.py:0: error: Item "None" of "VersionRange | None" has no attribute "is_any" [union-attr] +src/rez/utils/formatting.py:0: error: Item "None" of "Match[str] | None" has no attribute "group" [union-attr] +src/rez/util.py:0: error: Argument 1 to "module_from_spec" has incompatible type "ModuleSpec | None"; expected "ModuleSpec" [arg-type] +src/rez/util.py:0: error: Item "None" of "ModuleSpec | None" has no attribute "loader" [union-attr] +src/rez/util.py:0: error: Item "None" of "Loader | Any | None" has no attribute "exec_module" [union-attr] +src/rez/utils/data_utils.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/utils/data_utils.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/utils/data_utils.py:0: error: Argument 1 to "update_wrapper" has incompatible type "cached_class_property"; expected "Callable[[VarArg(Never), KwArg(Never)], Never]" [arg-type] +src/rez/utils/data_utils.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "tuple[Any, ...]") [assignment] +src/rez/utils/data_utils.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "dict[str, Any]") [assignment] +src/rez/utils/data_utils.py:0: error: Unexpected keyword argument "name" for "property" [call-arg] +src/rez/utils/backcompat.py:0: error: Item "None" of "Match[str] | None" has no attribute "groupdict" [union-attr] +src/rez/utils/backcompat.py:0: error: Item "None" of "Match[str] | None" has no attribute "groupdict" [union-attr] +src/rez/utils/sourcecode.py:0: error: Item "None" of "FunctionType | MethodType | None" has no attribute "__name__" [union-attr] +src/rez/utils/sourcecode.py:0: error: Incompatible types in assignment (expression has type "str | Any", variable has type "None") [assignment] +src/rez/utils/sourcecode.py:0: error: Argument 1 to "getsourcelines" has incompatible type "FunctionType | MethodType | None"; expected Module | type[Any] | MethodType | FunctionType | TracebackType | FrameType | CodeType | Callable[..., Any] [arg-type] +src/rez/utils/yaml.py:0: error: Skipping analyzing "rez.vendor.yaml.dumper": module is installed, but missing library stubs or py.typed marker [import-untyped] +src/rez/utils/yaml.py:0: error: Module has no attribute "dump" [attr-defined] +src/rez/utils/yaml.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/utils/yaml.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/utils/platform_.py:0: error: Module has no attribute "windll" [attr-defined] +src/rez/utils/platform_.py:0: error: Module has no attribute "WinError" [attr-defined] +src/rez/utils/platform_.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "Platform") [assignment] +src/rez/system.py:0: error: "str" has no attribute "decode"; maybe "encode"? [attr-defined] +src/rez/utils/filesystem.py:0: error: Module has no attribute "WindowsError" [attr-defined] +src/rez/utils/filesystem.py:0: error: Argument 1 to "extend" of "list" has incompatible type "tuple[Any, Any, str]"; expected "Iterable[tuple[Any, Any, str]]" [arg-type] +src/rez/utils/filesystem.py:0: error: Name "unicode" is not defined [name-defined] +src/rez/utils/filesystem.py:0: error: Name "unicode" is not defined [name-defined] +src/rez/utils/filesystem.py:0: error: Name "xrange" is not defined [name-defined] +src/rez/config.py:0: error: Skipping analyzing "rez.vendor.yaml.error": module is installed, but missing library stubs or py.typed marker [import-untyped] +src/rez/config.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/config.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/rex.py:0: error: "ActionInterpreter" has no attribute "get_key_token" [attr-defined] +src/rez/rex.py:0: error: Item "None" of "ActionManager | None" has no attribute "environ" [union-attr] +src/rez/rex.py:0: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc] +src/rez/rex.py:0: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc] +src/rez/utils/resources.py:0: error: Module "typing" has no attribute "Self" [attr-defined] +src/rez/utils/resources.py:0: note: Use `from typing_extensions import Self` instead +src/rez/utils/resources.py:0: note: See https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module +src/rez/utils/resources.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rez/utils/resources.py:0: error: "Resource" has no attribute "validated_data" [attr-defined] +src/rez/utils/resources.py:0: error: "Resource" has no attribute "validate_data" [attr-defined] +src/rez/utils/memcached.py:0: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "forget" [attr-defined] +src/rez/utils/memcached.py:0: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "__wrapped__" [attr-defined] +src/rez/utils/amqp.py:0: error: Incompatible types in assignment (expression has type "PlainCredentials", target has type "dict[str, str]") [assignment] +src/rez/shells.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rez/shells.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rez/shells.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rez/shells.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rez/shells.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "list[str]") [assignment] +src/rez/plugin_managers.py:0: error: "type[property]" has no attribute "uncache" [attr-defined] +src/rez/plugin_managers.py:0: error: List item 0 has incompatible type "MutableSequence[str]"; expected "str" [list-item] +src/rez/plugin_managers.py:0: error: Missing positional argument "path" in call to "find_module" of "MetaPathFinder" [call-arg] +src/rez/plugin_managers.py:0: error: Item "None" of "Loader | None" has no attribute "load_module" [union-attr] +src/rez/plugin_managers.py:0: error: Value of type variable "AnyOrLiteralStr" of "dirname" cannot be "str | None" [type-var] +src/rez/plugin_managers.py:0: error: Item "MetaPathFinder" of "MetaPathFinder | PathEntryFinder" has no attribute "path" [union-attr] +src/rez/plugin_managers.py:0: error: Item "PathEntryFinder" of "MetaPathFinder | PathEntryFinder" has no attribute "path" [union-attr] +src/rez/plugin_managers.py:0: error: Argument 1 to "append" of "list" has incompatible type "tuple[str, str, Any | str, str]"; expected "list[str]" [arg-type] +src/rez/plugin_managers.py:0: error: Argument 1 to "append" of "list" has incompatible type "tuple[str, str, str, str]"; expected "list[str]" [arg-type] +src/rez/package_resources.py:0: error: Incompatible types in assignment (expression has type "type[PackageMetadataError]", base class "Resource" defined the type as "type[Exception]") [assignment] +src/rez/package_resources.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "VariantResourceHelper") [misc] +src/rez/package_resources.py:0: error: "PackageRepositoryResource" has no attribute "hashed_variants" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: "VariantResourceHelper" has no attribute "base" [attr-defined] +src/rez/package_resources.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/package_resources.py:0: error: "PackageRepositoryResource" has no attribute "variants" [attr-defined] +src/rez/serialise.py:0: error: Incompatible types in assignment (expression has type "list[FrameSummary]", variable has type "StackSummary") [assignment] +src/rez/serialise.py:0: error: Unsupported right operand type for in (Module) [operator] +src/rez/serialise.py:0: error: Value of type Module is not indexable [index] +src/rez/serialise.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/serialise.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/serialise.py:0: error: Dict entry 0 has incompatible type "FileFormat": "Callable[[Any, Any], Any]"; expected "FileFormat": "Callable[[Any, KwArg(Any)], Any]" [dict-item] +src/rezplugins/package_repository/memory.py:0: error: "PackageRepository" has no attribute "data" [attr-defined] +src/rezplugins/package_repository/memory.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "MemoryPackageResource") [misc] +src/rezplugins/package_repository/memory.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "MemoryPackageResource") [misc] +src/rezplugins/package_repository/memory.py:0: error: Argument 1 to "construct" of "VersionedObject" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/memory.py:0: error: Incompatible return value type (got "Resource", expected "PackageRepositoryResource") [return-value] +src/rezplugins/package_repository/memory.py:0: error: "PackageRepository" has no attribute "data" [attr-defined] +src/rezplugins/package_repository/memory.py:0: error: Incompatible return value type (got "Resource", expected "PackageRepositoryResource") [return-value] +src/rezplugins/package_repository/memory.py:0: error: Incompatible return value type (got "Resource", expected "MemoryPackageFamilyResource | None") [return-value] +src/rezplugins/package_repository/memory.py:0: error: Return type "Iterator[MemoryPackageFamilyResource | None]" of "iter_package_families" incompatible with return type "Iterator[PackageFamilyResource]" in supertype "PackageRepository" [override] +src/rezplugins/package_repository/memory.py:0: error: Argument 1 of "iter_variants" is incompatible with supertype "PackageRepository"; supertype defines the argument type as "PackageResource" [override] +src/rezplugins/package_repository/memory.py:0: note: This violates the Liskov substitution principle +src/rezplugins/package_repository/memory.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides +src/rezplugins/package_repository/memory.py:0: error: Incompatible return value type (got "PackageRepositoryResource", expected "PackageFamilyResource") [return-value] +src/rez/packages.py:0: error: "Resource" has no attribute "uri" [attr-defined] +src/rez/packages.py:0: error: "Resource" has no attribute "config" [attr-defined] +src/rez/packages.py:0: error: "PackageBaseResourceWrapper" has no attribute "parent" [attr-defined] +src/rez/packages.py:0: error: Argument 1 to "get_parent_package_family" of "PackageRepository" has incompatible type "Resource"; expected "PackageResourceHelper" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "iter_variants" of "PackageRepository" has incompatible type "Resource"; expected "PackageResource" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "get_parent_package" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "Package" has incompatible type "PackageRepositoryResource"; expected "PackageResource" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "install_variant" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/packages.py:0: error: "Resource" has no attribute "_subpath" [attr-defined] +src/rez/packages.py:0: error: Argument 1 to "Package" has incompatible type "Resource"; expected "PackageResource" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "get_resource_from_handle" of "PackageRepositoryManager" has incompatible type "ResourceHandle | dict[Any, Any]"; expected "ResourceHandle" [arg-type] +src/rez/packages.py:0: error: Argument 1 to "Variant" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/solver.py:0: error: Argument 1 to "set_context" of "PackageBaseResourceWrapper" has incompatible type "ResolvedContext | None"; expected "ResolvedContext" [arg-type] +src/rez/package_order.py:0: error: Module "typing" has no attribute "Self" [attr-defined] +src/rez/package_order.py:0: note: Use `from typing_extensions import Self` instead +src/rez/package_order.py:0: note: See https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module +src/rez/package_order.py:0: error: Incompatible types in assignment (expression has type "Iterable[str] | None", variable has type "list[str]") [assignment] +src/rez/package_order.py:0: error: Argument 1 to "sort_key" of "PackageOrder" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/package_filter.py:0: error: "type[property]" has no attribute "uncache" [attr-defined] +src/rez/package_filter.py:0: error: Too many arguments for "RegexRuleBase" [call-arg] +src/rez/package_cache.py:0: error: Module has no attribute "CREATE_NEW_PROCESS_GROUP" [attr-defined] +src/rez/resolver.py:0: error: Argument 1 to "get_variant_state_handle" of "PackageRepository" has incompatible type "Resource"; expected "PackageResource" [arg-type] +src/rez/resolver.py:0: error: Argument 1 to "get_variant_state_handle" of "PackageRepository" has incompatible type "Resource"; expected "PackageResource" [arg-type] +src/rez/resolved_context.py:0: error: Incompatible return value type (got "_Wrapped[[VarArg(Any), KwArg(Any)], Any, [Any, VarArg(Any), KwArg(Any)], Any]", expected "CallableT") [return-value] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Argument 1 to "get_equivalent_variant" of "PackageRepository" has incompatible type "Resource | Any"; expected "VariantResource" [arg-type] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "list[Requirement]", variable has type "list[PackageRequest]") [assignment] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Argument 1 to "__iadd__" of "list" has incompatible type "list[str]"; expected "Iterable[PackageRequest]" [arg-type] +src/rez/resolved_context.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[Any], Any] | None"; expected "None" [arg-type] +src/rez/resolved_context.py:0: error: Item "None" of "list[Requirement] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "list[PackageOrder]", variable has type "PackageOrderList") [assignment] +src/rez/resolved_context.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "PackageOrderList") [assignment] +src/rez/resolved_context.py:0: error: Argument 1 to "update" of "MutableMapping" has incompatible type "dict[str, Any] | None"; expected "SupportsKeysAndGetItem[str, Any]" [arg-type] +src/rez/resolved_context.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/resolved_context.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/resolved_context.py:0: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc] +src/rez/wrapper.py:0: error: Skipping analyzing "rez.vendor.yaml.error": module is installed, but missing library stubs or py.typed marker [import-untyped] +src/rez/wrapper.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/wrapper.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/wrapper.py:0: error: Incompatible types in assignment (expression has type "Callable[[Any], Any] | None", variable has type "Callable[[Any], Any]") [assignment] +src/rez/suite.py:0: error: Skipping analyzing "rez.vendor.yaml.error": module is installed, but missing library stubs or py.typed marker [import-untyped] +src/rez/suite.py:0: error: Missing keys ("loaded", "prefix", "suffix") for TypedDict "Context" [typeddict-item] +src/rez/suite.py:0: error: Incompatible types in assignment (expression has type "Context", variable has type "dict[str, Any]") [assignment] +src/rez/suite.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/suite.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/suite.py:0: error: Argument 1 to "append" of "list" has incompatible type "tuple[Any, str, Any | str]"; expected "list[str]" [arg-type] +src/rez/suite.py:0: error: Item "None" of "list[Tool] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/suite.py:0: error: Item "None" of "defaultdict[str, list[Tool]] | None" has no attribute "values" [union-attr] +src/rez/suite.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[Any], Any]"; expected "None" [arg-type] +src/rez/suite.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[Any], Any]"; expected "None" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "_get_file" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "FileSystemPackageResource") [misc] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "_get_version_dirs" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "check_package_definition_files" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "_get_file" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "FileSystemPackageResource") [misc] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "FileSystemPackageFamilyResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "_get_file" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "disable_memcache" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "FileSystemPackageResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: "FileSystemCombinedPackageFamilyResource" has no attribute "versions" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: "FileSystemCombinedPackageFamilyResource" has no attribute "versions" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepository" has no attribute "disable_memcache" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "FileSystemCombinedPackageFamilyResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in "yield" (actual type "Resource", expected type "FileSystemCombinedVariantResource") [misc] +src/rezplugins/package_repository/filesystem.py:0: error: "FileSystemCombinedPackageFamilyResource" has no attribute "version_overrides" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "PackageRepositoryResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Cannot assign to a method [method-assign] +src/rezplugins/package_repository/filesystem.py:0: error: Cannot assign to a method [method-assign] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "append" of "list" has incompatible type "int"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "PackageFamilyResource | None", expected "PackageFamilyResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 of "iter_variants" is incompatible with supertype "PackageRepository"; supertype defines the argument type as "PackageResource" [override] +src/rezplugins/package_repository/filesystem.py:0: note: This violates the Liskov substitution principle +src/rezplugins/package_repository/filesystem.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides +src/rezplugins/package_repository/filesystem.py:0: error: Return type "PackageRepositoryResource" of "get_parent_package_family" incompatible with return type "PackageFamilyResource" in supertype "PackageRepository" [override] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 of "get_variant_state_handle" is incompatible with supertype "PackageRepository"; supertype defines the argument type as "PackageResource" [override] +src/rezplugins/package_repository/filesystem.py:0: note: This violates the Liskov substitution principle +src/rezplugins/package_repository/filesystem.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides +src/rezplugins/package_repository/filesystem.py:0: error: "PackageRepositoryResource" has no attribute "state_handle" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: "PackageFamilyResource" has no attribute "get_last_release_time" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Return type "Variant | None" of "get_variant_from_uri" incompatible with return type "VariantResource | None" in supertype "PackageRepository" [override] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in assignment (expression has type "str", variable has type "int | None") [assignment] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "remove_package" of "FileSystemPackageRepository" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_dir" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 of "pre_variant_install" is incompatible with supertype "PackageRepository"; supertype defines the argument type as "VariantResource" [override] +src/rezplugins/package_repository/filesystem.py:0: note: This violates the Liskov substitution principle +src/rezplugins/package_repository/filesystem.py:0: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides +src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "VariantResource | None", expected "VariantResource") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_type" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_type" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible import of "LockFile" (imported name has type "type[MkdirLockFile]", local name has type "type[LinkLockFile]") [assignment] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_type" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_type" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible import of "LockFile" (imported name has type "type[SymlinkLockFile]", local name has type "type[LinkLockFile]") [assignment] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "file_lock_timeout" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: "Callable[[], Any]" has no attribute "forget" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: "Callable[[Any], Any]" has no attribute "forget" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "append" of "list" has incompatible type "tuple[str, str]"; expected "tuple[str, None]" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "check_package_definition_files" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible types in assignment (expression has type "set[Never]", variable has type "list[Any]") [assignment] +src/rezplugins/package_repository/filesystem.py:0: error: "list[Any]" has no attribute "add"; maybe "append" or "extend"? [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "list[Resource]", expected "list[PackageFamilyResource]") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "PackageFamilyResource | None") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Incompatible return value type (got "Resource", expected "PackageFamilyResource | None") [return-value] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "FileFormat | None" has no attribute "extension" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: List comprehension has incompatible type List[PackageResourceHelper]; expected List[Package] [misc] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "package_filenames" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "get_package_family" of "FileSystemPackageRepository" has incompatible type "Any | str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "_create_family" of "FileSystemPackageRepository" has incompatible type "Any | str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: "VariantResource" has no attribute "uuid" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "_get_package_data" has incompatible type "PackageRepositoryResource"; expected "PackageRepositoryResourceWrapper" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "iter_variants" of "FileSystemPackageRepository" has incompatible type "Package"; expected "PackageResourceHelper" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: "VariantResource" has no attribute "variant_requires" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "iter_variants" of "FileSystemPackageRepository" has incompatible type "Package"; expected "PackageResourceHelper" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "get" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: Item "None" of "Any | None" has no attribute "package_filenames" [union-attr] +src/rezplugins/package_repository/filesystem.py:0: error: "VariantResource" has no attribute "variant_requires" [attr-defined] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 2 to "join" has incompatible type "Any | str | None"; expected "str" [arg-type] +src/rezplugins/package_repository/filesystem.py:0: error: Argument 1 to "_on_changed" of "FileSystemPackageRepository" has incompatible type "Any | str | None"; expected "str" [arg-type] +src/rez/package_help.py:0: error: Item "None" of "Variant | None" has no attribute "base" [union-attr] +src/rez/package_help.py:0: error: Item "None" of "Variant | None" has no attribute "root" [union-attr] +src/rez/package_copy.py:0: error: Argument 1 to "install_variant" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/package_copy.py:0: error: Argument 1 to "pre_variant_install" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/package_copy.py:0: error: Argument "variant_resource" to "install_variant" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rez/package_copy.py:0: error: Item "None" of "Variant | None" has no attribute "uri" [union-attr] +src/rez/package_bind.py:0: error: Incompatible types in assignment (expression has type "type[RezBindError]", variable has type "type[_NeverError]") [assignment] +src/rez/utils/pip.py:0: error: Library stubs not installed for "pkg_resources" [import-untyped] +src/rez/utils/pip.py:0: note: Hint: "python3 -m pip install types-setuptools" +src/rez/utils/pip.py:0: note: (or run "mypy --install-types" to install all missing stub packages) +src/rez/utils/pip.py:0: error: Incompatible types in assignment (expression has type "VersionRange | None", variable has type "VersionRange") [assignment] +src/rez/utils/installer.py:0: error: Name "env" is not defined [name-defined] +src/rez/utils/diff_packages.py:0: error: "type" has no attribute "export" [attr-defined] +src/rez/cli/pkg-cache.py:0: error: Argument 1 to "append" of "list" has incompatible type "Callable[[Any], Any]"; expected "str" [arg-type] +src/rez/cli/memcache.py:0: error: Argument 1 to "append" of "list" has incompatible type "tuple[Any, Any, str, str, str, Any, str]"; expected "list[str]" [arg-type] +src/rez/cli/forward.py:0: error: Skipping analyzing "rez.vendor.yaml.error": module is installed, but missing library stubs or py.typed marker [import-untyped] +src/rez/cli/forward.py:0: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports +src/rez/cli/forward.py:0: error: Module has no attribute "load" [attr-defined] +src/rez/cli/forward.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rez/cli/benchmark.py:0: error: Name "_opts" is not defined [name-defined] +src/rez/cli/benchmark.py:0: error: List item 0 has incompatible type "str | None"; expected "str" [list-item] +src/rez/cli/benchmark.py:0: error: Name "_opts" is not defined [name-defined] +src/rez/cli/benchmark.py:0: error: Item "None" of "list[Variant] | None" has no attribute "__iter__" (not iterable) [union-attr] +src/rez/cli/benchmark.py:0: error: Incompatible types in assignment (expression has type "IO[Any]", variable has type "TextIOWrapper") [assignment] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/benchmark.py:0: error: Incompatible types in assignment (expression has type "IO[Any]", variable has type "TextIOWrapper") [assignment] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/benchmark.py:0: error: Argument 1 to "exists" has incompatible type "str | None"; expected "int | str | bytes | PathLike[str] | PathLike[bytes]" [arg-type] +src/rez/cli/benchmark.py:0: error: Argument 1 to "mkdir" has incompatible type "str | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]" [arg-type] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/benchmark.py:0: error: Name "_opts" is not defined [name-defined] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/benchmark.py:0: error: Name "_opts" is not defined [name-defined] +src/rez/cli/benchmark.py:0: error: Argument 1 to "join" has incompatible type "str | None"; expected "str" [arg-type] +src/rez/cli/_util.py:0: error: Module has no attribute "CTRL_C_EVENT" [attr-defined] +src/rezplugins/release_vcs/stub.py:0: error: Module has no attribute "load" [attr-defined] +src/rezplugins/release_vcs/stub.py:0: error: Module has no attribute "FullLoader" [attr-defined] +src/rezplugins/release_vcs/hg.py:0: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment] +src/rezplugins/release_vcs/git.py:0: error: Name "retain_cwd" is not defined [name-defined] +src/rezplugins/release_vcs/git.py:0: error: Name "git" is not defined [name-defined] +src/rezplugins/release_vcs/git.py:0: error: Name "git" is not defined [name-defined] +src/rezplugins/release_hook/command.py:0: error: Argument 1 to "append" of "list" has incompatible type "dict[Any, Any]"; expected "int" [arg-type] +src/rez/pip.py:0: error: Item "None" of "Variant | None" has no attribute "parent" [union-attr] +src/rez/build_system.py:0: error: Unsupported operand types for - ("set[type[BuildSystem]]" and "set[str | None]") [operator] +src/rez/cli/selftest.py:0: error: Argument 1 to "getfile" has incompatible type "FrameType | None"; expected Module | type[Any] | MethodType | FunctionType | TracebackType | FrameType | CodeType | Callable[..., Any] [arg-type] +src/rez/cli/selftest.py:0: error: Missing positional argument "path" in call to "find_module" of "MetaPathFinder" [call-arg] +src/rez/cli/selftest.py:0: error: Item "None" of "Loader | None" has no attribute "load_module" [union-attr] +src/rez/cli/interpret.py:0: error: Incompatible types in assignment (expression has type "Python", variable has type "Shell") [assignment] +src/rez/cli/help.py:0: error: Item "None" of "Package | None" has no attribute "uri" [union-attr] +src/rez/cli/help.py:0: error: Item "None" of "Package | None" has no attribute "description" [union-attr] +src/rez/cli/help.py:0: error: Item "None" of "Package | None" has no attribute "description" [union-attr] +src/rez/cli/cp.py:0: error: Incompatible types in assignment (expression has type "Any | None", variable has type "list[Any]") [assignment] +src/rez/cli/context.py:0: error: Cannot call function of unknown type [operator] +src/rez/cli/_main.py:0: error: Unexpected keyword argument "setup_subparser" for "add_parser" of "_SubParsersAction" [call-arg] +src/rez/bind/python.py:0: error: Name "this" is not defined [name-defined] +src/rez/bind/_pymodule.py:0: error: Name "env" is not defined [name-defined] +src/rez/bind/_pymodule.py:0: error: Name "env" is not defined [name-defined] +src/rez/bind/_pymodule.py:0: error: Name "env" is not defined [name-defined] +src/rezplugins/build_process/local.py:0: error: Argument 1 to "join" of "str" has incompatible type "list[str | None]"; expected "Iterable[str]" [arg-type] +src/rezplugins/build_process/local.py:0: error: Argument 1 to "pre_variant_install" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rezplugins/build_process/local.py:0: error: Unexpected TypedDict keys ("package_install_path", "variant_install_path") [misc] +src/rezplugins/build_process/local.py:0: error: Argument 1 to "get_repository" of "PackageRepositoryManager" has incompatible type "str | None"; expected "str" [arg-type] +src/rezplugins/build_process/local.py:0: error: Argument 1 to "on_variant_install_cancelled" of "PackageRepository" has incompatible type "Resource"; expected "VariantResource" [arg-type] +src/rezplugins/build_process/local.py:0: error: TypedDict "BuildResult" has no key "package_install_path" [typeddict-item] +src/rezplugins/build_process/local.py:0: error: TypedDict "BuildResult" has no key "variant_install_path" [typeddict-item] +src/rez/cli/pip.py:0: error: "Config" has no attribute "debug_package_release" [attr-defined] +src/rez/cli/release.py:0: error: Name "raw_input" is not defined [name-defined] diff --git a/pyproject.toml b/pyproject.toml index 2b5a32a12..1aeb6ab39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,9 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" +[project.optional-dependencies] +mypy = ["mypy==1.11.1", "mypy_baseline==0.7.1"] + [tool.mypy] files = ["src/rez/", "src/rezplugins/"] exclude = [ @@ -18,3 +21,4 @@ allow_redefinition = true [[tool.mypy.overrides]] module = 'rez.utils.lint_helper' follow_imports = "skip" +