-
Notifications
You must be signed in to change notification settings - Fork 488
Description
I'm looking at adding typing to some parts of the code base (currently: pens) to make them nicer to work with in IDEs and mypy.
Example: looking at AbstractPointPen.addPoint
, the segmentType
can be one of a few strings or None
. Python's typing.Literal
covers that, but was added only in Python 3.8. For older Pythons, there's a backport package at https://pypi.org/project/typing-extensions/ that contains that type.
Another example is Protocol
, which can be used to declare that a class implements some interface, but without necessarily deriving from some common base class. I suppose pens fit that description, but I'm not sure if there is some isinstance
shenanigans going on somewhere outside fontTools?
Long story short, is it ok to add typing-extensions
as a conditional dependency for Python < 3.8?