jay3332 / pilmoji

Pilmoji is a fast and reliable emoji renderer for PIL.
MIT License
77 stars 28 forks source link

Add support for emoji 2.12 #44

Open martin-ueding opened 3 months ago

martin-ueding commented 3 months ago

I've tried to import this library, but that fails for the environment that I"m using:

❯ poetry run python
Python 3.9.19 (main, Apr 17 2024, 00:00:00) 
[GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pilmoji
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mu/.cache/pypoetry/virtualenvs/geo-activity-playground-cM-Vn1fX-py3.9/lib/python3.9/site-packages/pilmoji/__init__.py", line 1, in <module>
    from . import helpers, source
  File "/home/mu/.cache/pypoetry/virtualenvs/geo-activity-playground-cM-Vn1fX-py3.9/lib/python3.9/site-packages/pilmoji/helpers.py", line 18, in <module>
    language_pack: Dict[str, str] = unicode_codes.get_emoji_unicode_dict('en')
AttributeError: module 'emoji.unicode_codes' has no attribute 'get_emoji_unicode_dict'

These are the contents of my environment:

❯ poetry run pip list
Package                    Version           Editable project location
-------------------------- ----------------- -----------------------------------------
altair                     5.3.0
appdirs                    1.4.4
arrow                      1.3.0
asttokens                  2.4.1
attrs                      23.2.0
Babel                      2.15.0
black                      22.12.0
blinker                    1.8.2
certifi                    2024.6.2
cffi                       1.16.0
charset-normalizer         3.3.2
click                      8.1.7
colorama                   0.4.6
coloredlogs                15.0.1
comm                       0.2.2
contourpy                  1.2.1
cryptography               42.0.8
cycler                     0.12.1
debugpy                    1.8.2
decorator                  5.1.1
emoji                      2.12.1
exceptiongroup             1.2.1
executing                  2.0.1
fastkml                    0.12
fitdecode                  0.10.0
Flask                      3.0.3
Flask-Login                0.6.3
fonttools                  4.53.0
geo-activity-playground    0.23.0            /home/mu/Projekte/geo-activity-playground
geojson                    3.1.0
ghp-import                 2.1.0
gpxpy                      1.6.2
humanfriendly              10.0
idna                       3.7
importlib_metadata         7.1.0
importlib_resources        6.4.0
iniconfig                  2.0.0
ipykernel                  6.29.5
ipython                    8.18.1
itsdangerous               2.2.0
jedi                       0.19.1
Jinja2                     3.1.4
joblib                     1.3.2
jsonschema                 4.22.0
jsonschema-specifications  2023.12.1
jupyter_client             8.6.2
jupyter_core               5.7.2
kiwisolver                 1.4.5
lxml                       4.9.3
Markdown                   3.6
MarkupSafe                 2.1.5
matplotlib                 3.9.0
matplotlib-inline          0.1.7
mergedeep                  1.3.4
mkdocs                     1.6.0
mkdocs-get-deps            0.2.0
mkdocs-material            9.5.26
mkdocs-material-extensions 1.3.1
mypy                       1.10.0
mypy-extensions            1.0.0
nest-asyncio               1.6.0
nodeenv                    1.8.0
numpy                      1.26.4
packaging                  24.0
paginate                   0.5.6
pandas                     2.2.2
pandas-stubs               2.2.2.240603
parso                      0.8.4
pathspec                   0.12.1
pexpect                    4.9.0
pillow                     10.3.0
pilmoji                    2.0.4
Pint                       0.23
pip                        23.2.1
platformdirs               4.2.2
pluggy                     1.5.0
prompt_toolkit             3.0.47
protobuf                   5.27.1
psutil                     5.9.8
ptyprocess                 0.7.0
pure-eval                  0.2.2
py-spy                     0.3.14
pyarrow                    16.1.0
pycparser                  2.22
pydantic                   1.10.9
pygeoif                    0.7
Pygments                   2.18.0
pykml                      0.2.0
pymdown-extensions         10.8.1
pyparsing                  3.1.2
pyright                    1.1.343
pytest                     7.4.4
python-dateutil            2.9.0.post0
pytz                       2024.1
PyYAML                     6.0.1
pyyaml_env_tag             0.1
pyzmq                      26.0.3
referencing                0.35.1
regex                      2024.5.15
requests                   2.32.3
rpds-py                    0.18.1
scikit-learn               1.3.2
scipy                      1.13.1
setuptools                 69.0.3
shapely                    2.0.5
six                        1.16.0
stack-data                 0.6.3
stravalib                  1.6
tcxreader                  0.4.10
threadpoolctl              3.2.0
tomli                      2.0.1
toolz                      0.12.1
tornado                    6.4.1
tqdm                       4.66.4
traitlets                  5.14.3
types-decorator            5.1.8.20240310
types-paramiko             3.4.0.20240423
types-pycurl               7.45.3.20240421
types-python-dateutil      2.9.0.20240316
types-pytz                 2024.1.0.20240417
types-PyYAML               6.0.12.20240311
types-requests             2.32.0.20240602
types-tqdm                 4.66.0.20240417
types-typed-ast            1.5.8.7
types-xmltodict            0.13.0.3
typing_extensions          4.12.2
tzdata                     2024.1
urllib3                    2.2.1
vegafusion                 1.6.9
vegafusion-python-embed    1.6.9
vl-convert-python          1.4.0
watchdog                   4.0.1
wcwidth                    0.2.13
Werkzeug                   3.0.3
wheel                      0.40.0
xmltodict                  0.13.0
zipp                       3.19.2

So perhaps it is something about the emoji 2.12.1 library that isn't supported any more? The following versions work: 2.0, 2.10, 2.11. But 2.12 doesn't work any more. According to semantic versioning that shouldn't happen, but it seems that there was a breaking change between emoji 2.11 and 2.12 that isn't reflected in this project yet.

AmaseCocoa commented 3 months ago

Fixed in this commit, but has not been release on PyPI.