crate-operator icon indicating copy to clipboard operation
crate-operator copied to clipboard

Maintenance: Update to mypy 1.11.2

Open amotl opened this issue 1 year ago • 1 comments

Problem

Updating to Python 3.11 makes mypy croak.

fatal error: code.h: No such file or directory

-- https://github.com/crate/crate-operator/actions/runs/10957798573/job/30426680335?pr=549#step:6:91

Solution

Let's update mypy first.

References

  • https://github.com/crate/crate-operator/pull/549

amotl avatar Sep 20 '24 10:09 amotl

Hi. This patch needs a few adjustments to satisfy the type checker. Resolving them probably needs better insights into the code base than what I can provide.

/cc @goat-ssh, @Taliik, @tomach

https://github.com/crate/crate-operator/actions/runs/10958103493/job/30427634720?pr=654

amotl avatar Sep 20 '24 11:09 amotl

Hi there. Resolving this would unlock a whole bunch of patches stacked upon this one. However, this particular patch needs a few dedicated cycles by authors more accustomed with the code base.

Maybe you can afford to spend a few minutes on this, @tomach? 🙏

amotl avatar Feb 12 '25 16:02 amotl

Hi @amotl! Thanks for the reminder. I’ll be taking a look at this today. Thanks for your effort and patience! 🙏

tomach avatar Feb 13 '25 07:02 tomach

I tried to fix all mypy errors in crate/operator/prometheus.py and tests/test_metrics.py. And changed one fix in crate/operator/handlers/handle_create_cratedb.py where I think raising an error if status.get(CLUSTER_CREATE_ID) is undefined could cause issues, because it might be the case in the first run of a create-operation (but not 100% sure about that).

There is still one issue with sphinx now... :see_no_evil:

tomach avatar Feb 13 '25 14:02 tomach

Thank you very much. I am sure you can also tame the Sphinx, otherwise please ping me about it anytime [^1].

[^1]: Single possible winter day with snow outside in Berlin, so I am going sledging with the dwarf now, and will join later again.

amotl avatar Feb 13 '25 14:02 amotl

You made it, thanks a stack! 💯

Unfortunately, I can't approve the PR because I created it, so we need to ask @juanpardo, @Taliik, or @plaharanne, or fall back to @surister or @kneth. Feel free to squash commits and merge at your disposal.

amotl avatar Feb 13 '25 14:02 amotl

Yes, thank you! I added it to the nitpick_ignore list. Since it is just an interface and there is no official docs for prometheus_client on readthedocs, this should be fine I think.

tomach avatar Feb 13 '25 14:02 tomach

I think it's fine. The same thing happens in a future patch about another library that doesn't employ docs yet.

amotl avatar Feb 13 '25 14:02 amotl