'Ello.

I'm gauging support for a tiny new feature, or at least a refactoring of an 
internal API that will allow the feature to be developed without code 
duplication. I'd like to stop typing import statements for all of my models 
and other common stuff into my django shell. In fact, I'd love for all of 
us to stop typing those import statements! I tossed up the following pull 
requests as an example for how this might look:

https://github.com/django/django/pull/303

This is effectively a subset of the functionality that shell_plus [1] 
appears to provide. The problem that I have with building my own, or with 
using shell_plus is that the shell command doesn't allow this change to be 
built without effectively copying the entire internal implementation of the 
shell command. New features added to, or issues fixed in shell will have to 
be copied over to shell_plus, or our homegrown solutions which is 
unfortunate. So at the very least it seems reasonable to provide something 
like the get_initial_shell_locals method I added in my pull request, which 
makes this feature easy enough to add without duplication.

In fact, that's where my thinking started but I also don't see a downside 
to providing this functionality in core either. I don't think it's 
usefulness is particularly questionable or niche, as the existence of 
shell_plus seems evidence of.

I haven't opened a ticket because the contribution docs suggest gauging 
consensus, first. So I think these are the two potential (not mutually 
exclusive) changes worth gauging support for:

1. An overridable method (or some other internal API change?) to make it 
possible to implement this functionality without copying the entire shell 
implementation.
2. A default implementation for said method that supports auto-importing 
useful objects into the shell scope.


Curious to hear what people think. Of course, please let me know if I'm 
going about this the wrong way.

Thanks!
Phill

[1]: 
https://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/gcpo73Sk5aMJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to