Page MenuHomeSoftware Heritage

typing: type annotate swh.graph.pid
ClosedPublic

Authored by zack on Sep 20 2019, 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 Compressed graph representation
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz added inline comments.
swh/graph/pid.py
87–95 ↗(On Diff #6785)

did you check sphinx reads the new type annotations?

swh/graph/pid.py
87–95 ↗(On Diff #6785)

answer is in this diff's summary :-)

This revision is now accepted and ready to land.Sep 20 2019, 3:33 PM

It does

thanks a lot for checking (and YAY !)

  • MANIFEST.in: ship py.typed