Open migueleliasweb opened 4 years ago
It takes a registry, as the name clearly indicates.
Thanks @brian-brazil, you couldn't have been more clear. Does that mean adding the type hints is a welcomed addition?
What would that involve?
@migueleliasweb that would break compatibility with all python versions < 3.5
That's not on the cards then.
Hey @brian-brazil , adding the type hints would be just adding the specific type notations to the python files. That's quite handy as it would improve the autocomplete and hints from IDEs.
Some of the examples: https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html
@beregon87 That might be true. Which versions are you guys supporting atm?
I'm not a maintainer, but looking at setup.py
:
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
That still looks to me like it'd break supported versions.
See #491 which tracks this issue - so I think this is duplicate. Note that as that task says, one can provide type hints without breaking backwards compatibility, by either using annotations in comments, or preferrably, by using type stubs( .pyi).
@paravoid I made a small PR illustrating that we can add types without breaking any compatibility. It passes all unit tests and adds enough type information so my code passes with running mypy with --strict
.
I hope that could help to allow adding types. Here are some benefits, for people wondering if it is worth it:
Browsing through the code I've found a function called
write_to_textfile
in theexposition
module. This function signature looks like this:If you read the implementation of the function, turns out the expectation is not really a registry but instead anything that implements (something like an interface) the
.collect()
method.Is that by design?
If so, would it be welcomed the addition of type hints throughout the code? I would be happy to add them and create a PR.