Opened 7 years ago

Closed 8 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 7 years ago.
patch included with #5825
ticket8280.patch (5.4 KB) - added by jdetaeye 4 years ago.
patch updated to v1.3
zip_egg_fixed.diff (10.1 KB) - added by bhuztez 3 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 7 years ago by jdetaeye

patch included with #5825

comment:1 Changed 7 years ago by mtredinnick

  • milestone set to 1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 7 years ago by mtredinnick

  • milestone changed from 1.0 to post-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 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Changed 4 years ago by jdetaeye

patch updated to v1.3

comment:4 Changed 4 years ago by lukeplant

  • Easy pickings unset
  • Patch needs improvement set
  • Severity set to Normal
  • Type set to 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 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 3 years ago by bhuztez

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

Changed 3 years ago by bhuztez

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

comment:7 Changed 3 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 3 years ago by claudep

#19048 was a duplicate with a proposed patch

comment:9 Changed 2 years ago by aaugustin

  • Component changed from Core (Other) to Core (Management commands)

comment:10 Changed 8 months ago by claudep

  • Patch needs improvement unset

comment:11 Changed 8 months ago by timgraham

  • Triage Stage changed from Accepted to Ready for checkin

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

  • Resolution set to fixed
  • Status changed from new to closed

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