canonical / observability-libs

A collection of charm libraries curated by the Observability team.
https://charmhub.io/observability-libs
Apache License 2.0
3 stars 8 forks source link

fix static-lib check #79

Closed Abuelodelanada closed 6 months ago

Abuelodelanada commented 6 months ago

Enhancement Proposal

Our tox -e static-lib check is failing, and that prevents us from merging simple PRs. We have to fix all these warnings:

$ tox -e static-lib 
static-lib installed: anyio==4.3.0,certifi==2024.2.2,exceptiongroup==1.2.0,h11==0.14.0,httpcore==1.0.3,httpx==0.26.0,idna==3.6,lightkube==0.15.2,lightkube-models==1.29.0.7,nodeenv==1.8.0,ops==2.10.0,pyright==1.1.351,PyYAML==6.0.1,sniffio==1.3.0,typing_extensions==4.9.0,websocket-client==1.7.0
static-lib run-test-pre: PYTHONHASHSEED='797004744'
static-lib run-test: commands[0] | pyright --pythonversion 3.8 /home/ubuntu/repos/observability-libs/lib/charms/observability_libs
/home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/kubernetes_compute_resources_patch.py
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/kubernetes_compute_resources_patch.py:367:16 - error: No overloads for "equals_canonically" match the provided arguments (reportCallIssue)
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/kubernetes_compute_resources_patch.py:367:35 - error: Argument of type "ResourceRequirements | None" cannot be assigned to parameter "first" of type "ResourceRequirements" in function "equals_canonically"
    Type "ResourceRequirements | None" cannot be assigned to type "ResourceRequirements"
      "None" is incompatible with "ResourceRequirements" (reportArgumentType)
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/kubernetes_compute_resources_patch.py:400:51 - error: No overloads for "equals_canonically" match the provided arguments (reportCallIssue)
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/kubernetes_compute_resources_patch.py:401:28 - error: Argument of type "ResourceRequirements | None" cannot be assigned to parameter "second" of type "ResourceRequirements" in function "equals_canonically"
    Type "ResourceRequirements | None" cannot be assigned to type "ResourceRequirements"
      "None" is incompatible with "ResourceRequirements" (reportArgumentType)
/home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/metrics_endpoint_discovery.py
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/metrics_endpoint_discovery.py:218:22 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
  /home/ubuntu/repos/observability-libs/lib/charms/observability_libs/v0/metrics_endpoint_discovery.py:218:60 - error: Argument of type "List[ContainerPort] | None" cannot be assigned to parameter "__iterable" of type "Iterable[_T@filter]" in function "__new__"
    Type "List[ContainerPort] | None" cannot be assigned to type "Iterable[ContainerPort]"
      "None" is incompatible with protocol "Iterable[ContainerPort]"
        "__iter__" is not present (reportArgumentType)
6 errors, 0 warnings, 0 informations 
ERROR: InvocationError for command /home/ubuntu/repos/observability-libs/.tox/static-lib/bin/pyright --pythonversion 3.8 lib/charms/observability_libs (exited with code 1)
__________________________________________________________________ summary ___________________________________________________________________
ERROR:   static-lib: commands failed