#1 lint all: adjust type hints
Closed by gotmax23. Opened by gotmax23.
michel-slm/ gotmax23/pkg-depgraph misc-fixes-from-gotmax  into  main

Download 1.patch

This should fix the issues you were having with type checking.

  • Use the PackageCompat ABC from fedrq instead of defining own Protocol
  • Always convert "reldep" objects to strings instead of returning
    Package.requires directly.
    See https://lists.sr.ht/~gotmax23/fedrq/patches/54309.

Thanks! Definitely keep the conversion of reldep to string. I would rather the return type is still Collection[str] and not list[str] though, so we are not committed to using a list unnecessarily.

Ditto with the Package protocol. This will support non RPM back ends soon-ish and I want to make sure they all have a consistent interface so it has the minimum needed. Need to figure out subtyping, I'm not opposed to the dnf.py implementation returning PackageCompat as long as the implemented interface still says Package and mypy is happy

rebased onto 513c3a05ecec4435604c49628e4274586e93a991

Here is my second draft. I'm not a huge fan of the type ignore here. mypy doesn't think that the PackageCompat abstract base class is compatible with the Package Protocol, so it complains about incompatible return types.

I just added a contribution guide, can you sign the commit with -s for DCO ? Wanted to avoid problems with provenance down the road :)

https://pagure.io/michel-slm/pkg-depgraph/blob/main/f/CONTRIBUTING.md

Thanks!

Pull-Request has been closed by gotmax23

Metadata