mbi / django-simple-captcha

Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.
http://django-simple-captcha.readthedocs.io/en/latest/
MIT License
1.38k stars 319 forks source link

Latest release fails with Pillow 10 #219

Closed jannh closed 1 year ago

jannh commented 1 year ago

Yesterday, Pillow 10 was released. The latest django-simple-captcha release v0.5.17 fails with this release, see below.

File "[...]/.local/lib/python3.11/site-packages/captcha/views.py", line 74, in captcha_image size = getsize(font, text) ^^^^^^^^^^^^^^^^^^^ File "[...]/.local/lib/python3.11/site-packages/captcha/views.py", line 33, in getsize return font.getsize(text) ^^^^^^^^^^^^ I think this commit should fix the issue - maybe simply a new release could fix the issue? 17216e4ea35214873bfe80e86dffb59e693f064d

natarajan0007 commented 1 year ago

I downgraded to Pillow 9.5.0 its working for me. I also faced the similar issue i compared the version.

bash-5.1$ pipdeptree --package django-simple-captcha django-simple-captcha==0.5.17 ├── Django [required: >=2.2, installed: 4.2.2] │ ├── asgiref [required: >=3.6.0,<4, installed: 3.7.2] │ │ └── typing-extensions [required: >=4, installed: 4.6.3] │ └── sqlparse [required: >=0.3.1, installed: 0.4.4] ├── django-ranged-response [required: ==0.2.0, installed: 0.2.0] │ └── Django [required: Any, installed: 4.2.2] │ ├── asgiref [required: >=3.6.0,<4, installed: 3.7.2] │ │ └── typing-extensions [required: >=4, installed: 4.6.3] │ └── sqlparse [required: >=0.3.1, installed: 0.4.4] └── Pillow [required: >=6.2.0, installed: 9.5.0]

natarajan0007 commented 1 year ago

And also try to downgrade typing-extensions to 4.6.3. These two are latest releases.

mbi commented 1 year ago

Hello, thanks for the heads-up! I just pushed v0.5.18 to pypi. Would you please confirm it fixes this issue?

natarajan0007 commented 1 year ago

Thank you for the quick fix. Its working fine now with the latest version of Pillow 10.0.0 and typing Extensions too.

tijuca commented 1 year ago

Downgrading pillow <<10 might help for the moment, but to me this isn't really fixing the issue. Any plans to fix the real problem?

In Debian the CI is now failing with 5.1.18 together with pillow 10.0.0. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040627 https://ci.debian.net/data/autopkgtest/testing/amd64/d/django-simple-captcha/35498771/log.gz

jannh commented 1 year ago

This Bug Report was filed when testing with v0.5.17, thats also where the log is from. It is fixed in v0.5.18, which has already been uploaded to Debian and migrated to Testing. I guess the bug simply needs to be closed?

mbi commented 1 year ago

@tijuca I agree with @jannh: the Debian test is indeed failing with 0.5.17, but the 0.5.18 tag has a fix for this specific issue.

tijuca commented 1 year ago

Well, I don't think so. It's not so easy.

I'm the uploader of the last versions of django-simple-captcha within Debian. The version 0.5.18-1 was uploaded to unstable while pillow was still at version 9.5.0-1 and the autopkgtests where successful. Now version 10.0.0-1 was prepared and the CI is failing since then. Means 0.5.18-1 isn't working properly together with pillow 10.0.0.

The autopkgtests in Debian get started to do various runs, it starts with the depending packages and there versions in unstable, but is also testing if the tests will be successful with versions against the testing release. And if there are regressions the package won't migrate.

The log of the autopkgtest is quite clear to me about the reason, there are functions / classes that are not found. And as there is a major bump from 9.x to 10.x in pillow it's very likely that some breaking changes did happen in pillow.

https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html

E.g. FreeTypeFont.getsize() was replaced by FreeTypeFont.getbbox()

mbi commented 1 year ago

E.g. FreeTypeFont.getsize() was replaced by FreeTypeFont.getbbox()

0.5.18 specifically handles exactly this! Seems to me the CI is testing against 0.5.17 and not 0.5.18:

IMG_3060

tijuca commented 1 year ago

The wonderful world of tests and CI...

The DebCI infrastructure now indicates there are no regressions left and all checks are successful. Then sorry for the noise and possible confusion. I'll close the (Debian) RC bug report as there is nothing release critical to fix.