MINOR: Emoji library parameter being deprecated
Description
Since a few days ago, running terraform-compliance (docker image, have not tested other versions) shows these deprecation warnings on almost every line (where there used to be emojis before):
/usr/local/lib/python3.7/site-packages/terraform_compliance/common/defaults.py:52: DeprecationWarning: The parameter 'use_aliases' in emoji.emojize() is deprecated and will be removed in version 2.0.0. Use language='alias' instead.
To hide this warning, pin/downgrade the package to 'emoji~=1.6.3'
self.warning_icon = emojize(':exclamation:', use_aliases=True)
To Reproduce
Run terraform compliance.
Running via Docker: Yes
Error Output:
/usr/local/lib/python3.7/site-packages/terraform_compliance/common/defaults.py:52: DeprecationWarning: The parameter 'use_aliases' in emoji.emojize() is deprecated and will be removed in version 2.0.0. Use language='alias' instead.
To hide this warning, pin/downgrade the package to 'emoji~=1.6.3'
self.warning_icon = emojize(':exclamation:', use_aliases=True)
Expected Behavior: Some nice emoticons, no errors.
Tested Versions:
- terraform-compliance version: 1.3.32
Oh wow, thanks for the issue. Fixing this. :)
Weirdly, I couldn't reproduce this. What is the emoji version you have installed on your system ?
Could it be installed separately ?
I do not see the issue on my own (Ubuntu) machine. However, the issue happens in the Microsoft hosted Ubuntu 20.04 machines that we use for our CI/CD pipelines.
Here is the list of all software installed on those machines. We don't add anything additional to them, so that should give you a good idea of what's in there...
super weird. Will try to release a beta version for you
Thank you!
Released 1.3.33b1, give few minutes to be released automatically then lets have go :)
I can confirm that this new version works as expected :) no errors thrown in the pipeline run. Feel free to close this one when you move it out of beta :D thanks for the quick help @eerkunt !
When will 1.3.33b1 version be available on pypi?
Hi, not wanting to hijack this issue, but is 1.3.33b1 solving this issue as well as it is related to emoji?
$ terraform-compliance -f ../ --planfile planfile
Traceback (most recent call last):
File "/Users/wdijkerman/.venv3101/bin/terraform-compliance", line 5, in <module>
from terraform_compliance.main import cli
File "/Users/wdijkerman/.venv3101/lib/python3.10/site-packages/terraform_compliance/main.py", line 29, in <module>
print('{} v{} initiated\n'.format(__app_name__, Defaults().yellow(__version__)))
File "/Users/wdijkerman/.venv3101/lib/python3.10/site-packages/terraform_compliance/common/defaults.py", line 51, in __init__
self.info_icon = emojize(':bulb:', language='alias')
File "/Users/wdijkerman/.venv3101/lib/python3.10/site-packages/emoji/core.py", line 77, in emojize
EMOJI_UNICODE = unicode_codes.EMOJI_UNICODE[language]
KeyError: 'alias'
$ pip freeze | grep -i terraform-compliance
terraform-compliance==1.3.33
Thank you!
Hi,
I've solved a related bug and wanted to share: emoji.emojize(): kwarg use_aliases=True was removed in emoji>=2. It was replaced with language='alias' that is available since emoji>=1.7.
So if you are getting KeyError: 'alias' it is probably you are using emoji<1.7 and if you use use_aliases you would get an error if using emoji>=2.
https://github.com/carpedm20/emoji/issues/195#issuecomment-974106146 https://github.com/carpedm20/emoji/pull/200 https://github.com/carpedm20/emoji/pull/203 https://github.com/carpedm20/emoji/pull/205