Overhaul extra_requires to include more optional dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Overhaul extra_requires to include more optional dependencies

jroes

Django has a number of optional features that require the installation of additional Python packages.


Right now it's possible to $ pip install Django[bcrypt,argon2] to install Django and the optional packages (at the correct minimum version) required for bcrypt/argon2 support.


However this is not possible for other optional features, like database/cache backend, gis, certain image related features etc.


I've created a pull request adding the optional dependencies found in the test requirements: https://github.com/django/django/pull/9440 / https://code.djangoproject.com/ticket/28905

So end users can do things like:


$ pip install Django[mysql,sqlparse,images,memcached]
$ pip install Django[postgresql,gis]
$ pip install Django[selenium,test-parallel]
 

Not only would this make it much easier to install a particular combination of Django and optional dependencies correctly, it also makes some of the optional features/dependencies a little bit more discoverable.

This might not the full set of optional dependencies, or the right grouping/naming, so a review is more than welcome (i.e. should sqlparse be added to the mysql/oracle extra requirements? Should a sqlite extra be added that only includes sqlparse?).
 
Besides adding this to setup.py, additional changes to the documentation, test instructions and scripts, code warnings etc. will probably be necessary.

If anyone objects to adding these extra requirements I'd also like to hear about it.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/5a5cad2c-7b40-4800-b264-7c1ad34a284b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Overhaul extra_requires to include more optional dependencies

Reinout van Rees
Op 11-12-17 om 11:26 schreef [hidden email]:
> Django has a number of optional features that require the installation
> of additional Python packages.
 >
 > ... snip ...

>
> I've created a pull request adding the optional dependencies found in
> the test requirements: https://github.com/django/django/pull/9440 /
> https://code.djangoproject.com/ticket/28905
>
> So end users can do things like:
>
>
> $ pip install Django[mysql,sqlparse,images,memcached]
> $ pip install Django[postgresql,gis]
> $ pip install Django[selenium,test-parallel]

Good idea! I have two comments:


First, in the ticket, I see psycopg2 as requirement for the "postgresql"
extra. Fine. That's totally required.
For the "gis" extra it is numpy and geoip2. Numpy isn't strictly
required: according to the readme it is 'highly recommended'.

=> What is the meaning of such an 'extra'? Does it contain 'highly
recommended' and higher? Or also optional packages?

You *do* mention 'optional' in the ticket. So if I do 'Django[gis]' I
ought to get every package that's mentioned as "hey, that's handy" in
the documentation, right?



Second, I wonder whether the one-item extras are really needed. If you
want to use numpy, you'll install numpy yourself. You don't really need
'Django[numpy]' to tell you to install numpy.

admindocs->docutils: yes, that's handy
numpy->numpy: seems less useful
gis->numpy and geoip2: yes, useful




Reinout

--
Reinout van Rees                          http://reinout.vanrees.org/
[hidden email]                   http://www.nelen-schuurmans.nl/
"Learning history by destroying artifacts is a time-honored atrocity"

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/p25ncd%24pj2%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Overhaul extra_requires to include more optional dependencies

emorley
In reply to this post by jroes
Thank you for looking into this!

Another benefit alongside ease of install and discoverability, is that it makes the requirements files of projects using Django more self-documenting (in that it avoids stray dependency entries that appear to be unused, but actually aren't - and so need a comment to explain what uses them). See also the related open ticket https://code.djangoproject.com/ticket/27682.

Re the single package entries, I think there is still value in having them, so long as they are named by feature rather than by package name. eg `Django[crypto]` vs `Django[bcrypt]`. This allows the particular choice of library to be a Django implementation detail that can be adjusted without needing requirements file changes.

Ed

On Monday, 11 December 2017 10:26:11 UTC, [hidden email] wrote:

Django has a number of optional features that require the installation of additional Python packages.


Right now it's possible to $ pip install Django[bcrypt,argon2] to install Django and the optional packages (at the correct minimum version) required for bcrypt/argon2 support.


However this is not possible for other optional features, like database/cache backend, gis, certain image related features etc.


I've created a pull request adding the optional dependencies found in the test requirements: <a href="https://github.com/django/django/pull/9440" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F9440\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGwnvMcsOQmZu5tvbc4VYvC-D2B4Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F9440\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGwnvMcsOQmZu5tvbc4VYvC-D2B4Q&#39;;return true;">https://github.com/django/django/pull/9440 / <a href="https://code.djangoproject.com/ticket/28905" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28905\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlOkR4MdQTRDdQPfIOGKDLBlZXLQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F28905\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHlOkR4MdQTRDdQPfIOGKDLBlZXLQ&#39;;return true;">https://code.djangoproject.com/ticket/28905

So end users can do things like:


$ pip install Django[mysql,sqlparse,images,memcached]
$ pip install Django[postgresql,gis]
$ pip install Django[selenium,test-parallel]
 

Not only would this make it much easier to install a particular combination of Django and optional dependencies correctly, it also makes some of the optional features/dependencies a little bit more discoverable.

This might not the full set of optional dependencies, or the right grouping/naming, so a review is more than welcome (i.e. should sqlparse be added to the mysql/oracle extra requirements? Should a sqlite extra be added that only includes sqlparse?).
 
Besides adding this to setup.py, additional changes to the documentation, test instructions and scripts, code warnings etc. will probably be necessary.

If anyone objects to adding these extra requirements I'd also like to hear about it.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/8cb27037-757b-4d19-893f-0e4cd83700c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.