[Django] #29065: Don't load Pillow unless needed

13 views
Skip to first unread message

Django

unread,
Jan 25, 2018, 3:09:34 PM1/25/18
to django-...@googlegroups.com
#29065: Don't load Pillow unless needed
------------------------------------------------+------------------------
Reporter: Collin Anderson | Owner: nobody
Type: Uncategorized | Status: new
Component: File uploads/storage | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Before #21548, Pillow was only loaded if needed. It would be nice if this
were still true.

--
Ticket URL: <https://code.djangoproject.com/ticket/29065>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 25, 2018, 3:11:59 PM1/25/18
to django-...@googlegroups.com
#29065: Only load Pillow if needed
-------------------------------------+-------------------------------------

Reporter: Collin Anderson | Owner: nobody
Type: Uncategorized | Status: new
Component: File | Version: 2.0
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Collin Anderson):

* cc: Collin Anderson (added)
* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/9619

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:1>

Django

unread,
Jan 26, 2018, 2:37:06 PM1/26/18
to django-...@googlegroups.com
#29065: Only load Pillow if needed
-------------------------------------+-------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* type: Uncategorized => Cleanup/optimization
* component: File uploads/storage => Core (Other)


Comment:

I don't see the motivation behind the idea.

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:2>

Django

unread,
Jan 27, 2018, 6:53:38 AM1/27/18
to django-...@googlegroups.com
#29065: Only load Pillow if needed
-------------------------------------+-------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Akshesh Doshi):

* cc: Akshesh Doshi (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:3>

Django

unread,
Jan 27, 2018, 5:03:42 PM1/27/18
to django-...@googlegroups.com
#29065: Only load Pillow if needed
-------------------------------------+-------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Collin Anderson):

A few advantages:
If for some reason you can't or have trouble installing pillow, everything
else will work fine. It makes django a bit more "lightweight" to have the
dependency be optional.

Loading Pillow increases memory usage by 5% (2mb) (in my quick testing)
for a runserver on an empty project:
37608kb without loading pillow
39768kb with loading pillow

Also, doesn't matter quite as much, but running "check" also takes about
5% longer (25ms) on an empty project for me when including pillow:
360-400ms without loading pillow
393-424ms with loading pillow

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:4>

Django

unread,
Jan 27, 2018, 5:13:28 PM1/27/18
to django-...@googlegroups.com
#29065: Only load Pillow if needed
--------------------------------------+------------------------------------

Reporter: Collin Anderson | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Loic Bistuer):

* stage: Unreviewed => Accepted


Comment:

+1 to making Pillow truly optional.

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:5>

Django

unread,
Jan 27, 2018, 5:54:28 PM1/27/18
to django-...@googlegroups.com
#29065: Make django.core.validators only load Pillow if needed
--------------------------------------+------------------------------------

Reporter: Collin Anderson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham):

Isn't it already "optional" with the `try/except ImportError`? I think the
idea you're proposing is to import it lazily (which could help if it's
installed but unused) which makes sense to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:6>

Django

unread,
Jan 28, 2018, 4:39:26 PM1/28/18
to django-...@googlegroups.com
#29065: Make django.core.validators only load Pillow if needed
--------------------------------------+------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Collin Anderson):

Good point. The installed but unused case is what I'm running into.

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:7>

Django

unread,
Jan 30, 2018, 9:42:52 AM1/30/18
to django-...@googlegroups.com
#29065: Make django.core.validators only load Pillow if needed
--------------------------------------+------------------------------------
Reporter: Collin Anderson | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Core (Other) | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"46b3e3ffdc25b5a42762df20e536401fc512c5f3" 46b3e3f]:
{{{
#!CommitTicketReference repository=""
revision="46b3e3ffdc25b5a42762df20e536401fc512c5f3"
Fixed #29065 -- Made django.core.validators only load Pillow if needed.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29065#comment:8>

Reply all
Reply to author
Forward
0 new messages