Opened 3 months ago

Last modified 12 days ago

#28905 new Cleanup/optimization

Overhaul extra_requires to include more optional dependencies

Reported by: Jaap Roes Owned by: nobody
Component: Packaging Version: master
Severity: Normal Keywords: setup optional dependencies packages requirements
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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 (initially only psycopg2 for postgresql, but after a comment from pope1ni I followed their suggestion to include more). It changes the set of extra_requires to:

    'admindocs': ['docutils'],
    'argon2': ['argon2_cffi>=16.1.0'],
    'bcrypt': ['bcrypt'],
    'gis': [
    'geoip': ['geoip2'],
    'jinja2': ['Jinja2>=2.9.2'],
    'memcached': ['python3-memcached'],
    'numpy': ['numpy'],
    'mysql': ['mysqlclient>=1.3.7'],
    'oracle': ['Oracle'],
    'images': ['Pillow'],
    'postgresql': ['psycopg2>=2.5.4'],
    'pylibmc': ['pylibmc; sys.platform != "win32"'],
    'sqlparse': ['sqlparse'],
    'selenium': ['selenium'],
    'test-parallel': ['tblib'],
    'yaml': ['PyYAML'],

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.

Besides adding this to, additional changes to the documentation, test instructions and scripts, code warnings etc. will probably be necessary.

Change History (5)

comment:1 Changed 3 months ago by Jaap Roes

Component: UncategorizedPackaging

comment:2 Changed 3 months ago by Sergey Fedoseev

Has patch: set
Triage Stage: UnreviewedAccepted

comment:3 Changed 3 months ago by Jaap Roes

I have no idea where to go from here. I assume posting this to the developer mailinglist is the best way to gather feedback on this and come to a consensus of which packages and groupings.


Last edited 2 months ago by Jaap Roes (previous) (diff)

comment:4 Changed 12 days ago by Carlton Gibson

Related #27682

comment:5 Changed 12 days ago by Carlton Gibson

Needs documentation: set
Note: See TracTickets for help on using tickets.
Back to Top