[Django] #18603: Adding support for PEP 302 importers

7 views
Skip to first unread message

Django

unread,
Jul 10, 2012, 1:35:45 AM7/10/12
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+--------------------
Reporter: bhuztez | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version:
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
Django makes assumptions about the filesystem layout of python packages
here and there, and will silently skip any app which does not meet
Django's assumptions without raise up any warnings.

Adding support for PEP 302 importers can solve all these problems,
including #582 #596 #8238 #8280 #12206 #13587 #16718 #17331. And I found
that there are three different kinds of problems.

1. find submodules before importing the package: finding management
commands
1. find submodules after importing the package: finding template
tags(already solved by #13334) and listing available database backends
1. find resource files after importing the package: template files, static
files, fixtures and translation files

I have been working on solve these problems in the past few months, code
is now available on Github:
https://github.com/bhuztez/django/compare/master...pep-302

There are still a few problems.

management command:: since we have to find management commands before
importing any app packages, we still need to make assumptions, see
https://code.djangoproject.com/ticket/14087#comment:13 . I think we have
to make a better assumption on `loader.get_filename`. And how to find
management commands in packages imported by `sys.meta_path`?

static files finder:: I changed static files finder API. now
`Finder.find` returns `[(storage, path)]` instead of `[path]`.

app package resource file regression tests:: templates, fixtures,
translation files and static files (except collect_static) relies on same
api to find resource files. Should I just add tests for the API, or I have
to add almost same tests for templates, fixtures, translation files and
static files?

template loader:: I changed template loader API. I think the
`template_dirs` parameter is confusing here in `loader(template_name,
template_dirs=None)`. if I set the `template_dirs` parameter,
`django.template.loaders.app_directories.Loader` works just like
`django.template.loaders.filesystem.Loader`, and
`django.template.loaders.eggs.Loader` does not respect my parameter.

fixture path:: how to `humanize(fixture_storage)`?


Any ideas?

--
Ticket URL: <https://code.djangoproject.com/ticket/18603>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 10, 2012, 8:57:57 AM7/10/12
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+------------------------------------
Reporter: bhuztez | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:1>

Django

unread,
Jul 31, 2012, 5:12:34 PM7/31/12
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+------------------------------------
Reporter: bhuztez | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by cberner):

* cc: cberner (added)


Comment:

Hey bhuztez,

I started work on part of this (the management command issue) because
we've run into it. My patch is
[https://github.com/cberner/django/tree/issue18685 here]. Let me know if I
can be of assistance with other parts of this issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:2>

Django

unread,
Jun 13, 2014, 2:51:57 PM6/13/14
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+------------------------------------

Reporter: bhuztez | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version:

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:4>

Django

unread,
Feb 2, 2026, 10:27:12 PM (2 days ago) Feb 2
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+------------------------------------
Reporter: bhuztez | Owner: Harsh007
Type: Cleanup/optimization | Status: assigned
Component: Core (Other) | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Harsh007):

* cc: Harsh007 (added)
* owner: nobody => Harsh007
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:5>

Django

unread,
Feb 2, 2026, 10:46:46 PM (2 days ago) Feb 2
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
--------------------------------------+------------------------------------
Reporter: bhuztez | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Harsh007):

* owner: Harsh007 => (none)
* status: assigned => new

--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:6>

Django

unread,
Feb 3, 2026, 5:57:04 PM (2 days ago) Feb 3
to django-...@googlegroups.com
#18603: Adding support for PEP 302 importers
-------------------------------------+-------------------------------------
Reporter: bhuztez | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Core (Other) | Version:
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 1 => 0
* needs_better_patch: 1 => 0
* resolution: => needsinfo
* status: new => closed

Comment:

I don't think this is actionable today. My best effort to identify any
remaining issues found nothing, see ticket:14087#comment:31.
--
Ticket URL: <https://code.djangoproject.com/ticket/18603#comment:7>
Reply all
Reply to author
Forward
0 new messages