Open TomFryers opened 2 years ago
Hi Tom,
We have already started adding basic type hints to the public facing APIs in the master (v2.0) branch. It's really just a matter of someone taking on the job. Pull requests would of course be welcome here.
From my personal viewpoint, there is one concern. We do try to support all non-EOL Python versions, and as you probably know some of the earlier typing syntax is really... messy. In the effort to keep things readable and approachable for contributors, it might be better to delay some of the gnarly cases for a later date (when we can take advantage of the cleaner syntax). This is just my personal opinion.
Great! I realise it's a lot of work and may take some time, but it's nice to know there's progress being made.
Re early typing syntax, from __future__ import annotations
might help. It's supported since 3.7 and converts all type annotations to strings, so nice typing features that don't exist yet (e.g. PEPs 585 and 604) don't raise errors. The future of these stringified annotations is uncertain, but I expect them to last long enough not to be a problem here.
I've started on this for fonts & font loading locally, but sidetracked by #810 as a trial run for improving loader code legibility.
Type hints (for use with Mypy among others) can help for writing sound code. There are some tools, such as MonkeyType which may make adding these easier.