debrouwere / python-ballpark

Better human-readable numbers
ISC License
40 stars 14 forks source link

Systematic fails due to collections.Iterable deprecation #14

Open dmoklaf opened 2 years ago

dmoklaf commented 2 years ago

The following call now fails systematically with Python 3.10:

ballpark.business(123)

with the error:

File /usr/local/Caskroom/miniconda/base/envs/myenv/lib/python3.10/site-packages/ballpark/utils.py:85, in unwrap.<locals>.unwrapped_function(values, *vargs, **kwargs)
     83 @functools.wraps(fn)
     84 def unwrapped_function(values, *vargs, **kwargs):
---> 85     scalar = not isinstance(values, collections.Iterable)
     87     if scalar:
     88         values = [values]

AttributeError: module 'collections' has no attribute 'Iterable'

This may impact several or all other ballpark functions (I didn't test the other ones).

This is due to Python 3.10 (or earlier, I don't know) deprecating collections.Iterable in favor of collections.abc.Iterable.

The fix is to update this accordingly.

dmoklaf commented 2 years ago

This fork has exactly the right fixes, rsolving this issue as well as 2 other pending issues:

https://github.com/Mee6/python-ballpark

db0 commented 2 years ago

Looks like this project has been abandoned