Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

humanize raises DeprecationWarning upon import #242

Closed
jwodder opened this issue Nov 29, 2021 · 3 comments
Closed

humanize raises DeprecationWarning upon import #242

jwodder opened this issue Nov 29, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@jwodder
Copy link

jwodder commented Nov 29, 2021

As of humanize 3.13.0, simply doing import humanize causes a DeprecationWarning to be emitted about Unit. This is a problem for libraries that use humanize and whose tests are run with filterwarnings = error or equivalent in effect.

What did you do?

python3 -W error -c 'import humanize'

What did you expect to happen?

A lack of an error.

What actually happened?

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jwodder/.local/virtualenvwrapper/venvs/tmp-22afcaa7f55ab2/lib/python3.9/site-packages/humanize/__init__.py", line 17, in <module>
    from humanize.time import (
  File "/Users/jwodder/.local/virtualenvwrapper/venvs/tmp-22afcaa7f55ab2/lib/python3.9/site-packages/humanize/time.py", line 75, in <module>
    class Unit(Enum, metaclass=_UnitMeta):
  File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 215, in __new__
    enum_class._member_names_ = []               # names in definition order
  File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 470, in __setattr__
    member_map = cls.__dict__.get('_member_map_', {})
  File "/Users/jwodder/.local/virtualenvwrapper/venvs/tmp-22afcaa7f55ab2/lib/python3.9/site-packages/humanize/time.py", line 47, in __getattribute__
    warnings.warn(
DeprecationWarning: `Unit` has been deprecated. The enum is still available as the private member `_Unit`.

What versions are you using?

  • OS: macOS 11.6
  • Python: 3.9.9
  • Humanize: 3.13.0
@hugovk
Copy link
Collaborator

hugovk commented Nov 29, 2021

Ah, sorry about that, it's unintended from #234.

@samueljsb Please could you check it?

I don't have access to "yank" the release, but I can comment out this particular warning and put out a quick point release.

@hugovk
Copy link
Collaborator

hugovk commented Nov 29, 2021

Quick fix: #243

@hugovk
Copy link
Collaborator

hugovk commented Nov 29, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants