I like Markus' suggestion and I think that's in line with how Django 
handles other optional dependencies such as the db bindings 
(psycopg2, MySQLdb, etc). Those raise an ImproperlyConfigured exception 
when there is an import error. The memcache cache backend on the other hand 
raises an import error if python-memcached isn't installed.

On Wednesday, May 4, 2016 at 1:09:40 PM UTC-4, Andrew Godwin wrote:
>
>
>
> On Wed, May 4, 2016 at 10:06 AM, Markus Holtermann <
> in...@markusholtermann.eu <javascript:>> wrote:
>
>> What about having asgiref and daphne as optional dependencies instead of
>> hard once and raising a proper exception "please install ..." when the
>> import fails?
>>
>> ```
>> try:
>>    from asgiref import ...
>> except ImportError:
>>    raise ImportError(
>>        "Please ensure you installed asgiref to use this feature. Do so "
>>         "with `pip install Django[channels]"
>>    )
>> ```
>>
>> i.e. `pip install "Django[channels]"` ?
>>
>
> That is the other option, but it seems to run contrary to Django's 
> traditional batteries-included philosophy (and would result in some ugly, 
> ugly import code in the channels modules). I'm curious to hear more 
> opinions though, if there's support for it I'm happy to change it.
>
> Andrew 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c696555b-4d08-40e6-b1b5-f3e492b60249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to