Open asmfreak opened 7 years ago
Could you suggest places to add them to expedite the process? I'm familiar with them, and love to see that people are beginning to use them. I'll take PRs (Especially easy for type hints, since they are simply new stub files). I use PyCharm, which also would benefit from type hints.
mypy complains about functions wrapped with plumbum.cli.Predicate
:
error: Invalid type "..."
Shoul I open another issue for this?
An example:
from plumbum import cli
@cli.Predicate
def GummyBear(n):
if not n.startswith('gummybear'):
raise ValueError('{} is not a gummybear!'.format(n))
return n
class GummyConsumer(cli.Application):
def main(self, bear: GummyBear):
print('MUNCH MUNCH MUNCH')
$ mypy gummy.py
gummy.py:1: error: Cannot find module named 'plumbum'
gummy.py:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
gummy.py:9: error: Invalid type "gummy.GummyBear"
Yes, that needs its own issue, it's caused by Plumbum optionally using type hints as part of the API, and that needs to be made compatible with mypy.
Hello, this issue is open since a lot of time... can I ask if there are updates on type hints for plumbum? I think that types would be very useful. Thank you a lot!
Happy to take a PR. Currently we still keep compatibility with Python 2 making it a little harder. I was planning to drop Python 2 Jan 1, 2022 unless @tomerfiliba needs it for some reason. Old plumbum will still work on Python 2 past that point, it just won't get any more updates. Tempted to just drop that much sooner, as the next two features that I don't have time to work on are pulling out at least plumbum.colorlib and plumbum.cli into separate packages, and that's easier in Python 3, and after that adding async support, also easier in Python 3.
Any updates now that Jan 1, 2022 is past?
I am happy to test things but sadly, do not have time to contribute. :(
Cool library! Bummer there are no types.
Please add type hints for your awesome library, so it can use with mypy checking. Here is some info on how to do this mainly painlessly