Page MenuHomeSoftware Heritage

typing: type annotate swh.graph.pid
ClosedPublic

Authored by zack on Fri, Sep 20, 2:42 PM.

Details

Summary

Upping the ante from D2015 / D2016, this diff is a proof of concept of what it
takes to annotate an actual module, making types visible for all functions /
methods. I'm using as guinea pig swh-graph, as it is largely independent from
the rest and only requires swh-{core,model} which are already (minimally)
typed.

To avoid duplication of typing information, I'm removing here types from
docstring and moving them to proper type annotations. I'm not exactly sure yet
what Sphinx rendering (with Napoleon style) will do with type annotations...

Test Plan

tox

Diff Detail

Repository
rDGRPH Graph service
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

zack created this revision.Fri, Sep 20, 2:42 PM
vlorentz added inline comments.
swh/graph/pid.py
87–95 ↗(On Diff #6785)

did you check sphinx reads the new type annotations?

zack added inline comments.Fri, Sep 20, 2:56 PM
swh/graph/pid.py
87–95 ↗(On Diff #6785)

answer is in this diff's summary :-)

vlorentz accepted this revision.Fri, Sep 20, 3:33 PM

It does

This revision is now accepted and ready to land.Fri, Sep 20, 3:33 PM
zack added a comment.Fri, Sep 20, 3:55 PM

It does

thanks a lot for checking (and YAY !)

zack updated this revision to Diff 6787.Fri, Sep 20, 4:00 PM
  • MANIFEST.in: ship py.typed