Opened 8 years ago

Closed 21 months ago

#8280 closed Bug (fixed)

Commands framework doesn't support alternate import methods

Reported by: jdetaeye Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords: command zip
Cc: bhuztez@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

From this thread on the developer mailing list
http://groups.google.com/group/django-developers/browse_thread/thread/78975372cdfb7d1a#
I understand that the Django team is keen on supporting alternate ways of packaging django: in a zip-file, in a jar-file(Jython) or other "frozen" formats.

One place that'll need fixing to achieve this is to update the command framework.
The find available commands, the current Django code is browsing the command subdirectories and looking for files that end with a .py extension
To support alternate packaging, the code should use the proper Python APIs to iterate over the available modules in a package.

A patch along these lines was already included with #5825. (The patch would need updating to the SVN version however - Once this ticket is accepted I can take care of it.)

Attachments (3)

usercommands.patch (4.1 KB) - added by jdetaeye 8 years ago.
patch included with #5825
ticket8280.patch (5.4 KB) - added by jdetaeye 6 years ago.
patch updated to v1.3
zip_egg_fixed.diff (10.1 KB) - added by bhuztez 4 years ago.
zip_egg_fixed from #14087, namespace_package_pth.5.diff should be applied before this patch

Download all attachments as: .zip

Change History (15)

Changed 8 years ago by jdetaeye

Attachment: usercommands.patch added

patch included with #5825

comment:1 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Given that this will be useful in more than just the management app (for example, finding the available db backends, as in #8238), it's probably worth putting a compat module in django.utils that provides the necessary functionality for all the Python versions we support (2.3 and up).

The idea seems necessary for our "Python on VMs" goal for 1.0.

comment:2 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0post-1.0

After discussion with Jacob, we think this isn't really a showstopper for 1.0. It's certainly possible to do without it (as Jython have managed) for now. After 1.0 it will certainly be a nice idea to implement, though.

The patch needs changing as mentioned in the above comment in order to keep things cleaner. Then it needs a bunch of testing on differently-backed Pythons (CPython, IronPython, PyPy and Jython) to make sure it works. Right now that requires time and could destabilise things.

comment:3 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

Changed 6 years ago by jdetaeye

Attachment: ticket8280.patch added

patch updated to v1.3

comment:4 Changed 5 years ago by Luke Plant

Easy pickings: unset
Patch needs improvement: set
Severity: Normal
Type: Bug

We no longer need to support anything less than Python 2.5, so this patch can be simplified. It then just confirmation that is works CPython/Jython/IronPython/PyPy.

comment:5 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 Changed 5 years ago by bhuztez

I guess zip_egg_fixed patch for #14087 should also fix this.

Changed 4 years ago by bhuztez

Attachment: zip_egg_fixed.diff added

zip_egg_fixed from #14087, namespace_package_pth.5.diff should be applied before this patch

comment:7 Changed 4 years ago by bhuztez

Cc: bhuztez@… added

take zip_egg_fixed from #14087, namespace_package_pth.5.diff should be applied before this patch.

comment:8 Changed 4 years ago by Claude Paroz

#19048 was a duplicate with a proposed patch

comment:9 Changed 4 years ago by Aymeric Augustin

Component: Core (Other)Core (Management commands)

comment:10 Changed 21 months ago by Claude Paroz

Patch needs improvement: unset

comment:11 Changed 21 months ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:12 Changed 21 months ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 6e1c9c6568c405bfa481dda4249abe2960173547:

Fixed #8280 -- Allowed management command discovery for eggs

Thanks jdetaeye for the report, bhuztez and jdetaeye for the
initial patches, Tim Graham and Berker Peksag for the reviews.

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