Hi, One thing that I still feel would be better to add is the SHELL_IMPORTS settings. I see the the shell customization on 2 levels.
At level 1, users would just want to import extra modules, submodules, methods etc. And I think this will be the most common use case.
At level 2, users would want to perform some kind of manipulation or do some pre-processing on their data. This one would be comparatively uncommon.
At this point, to achieve both levels, overriding get_namespace
is the only option. But with SHELL_IMPORTS
settings, we can super simplify things for atleast users at level 1(where most of the users lie?). As a developer, I would not want to create a bunch of files and folders, subclass a command and override a method just to import few methods/submodules/modules for testing. Rather I would prefer to write 3-4 lines in the settings.py and expect django to handle the complications of importing them.
Yes, If I had some complex operations to perform before launching the shell or want to use some other python runner, then I would definitely have no problem to subclass the shell command and override a method.
Would be happy to know the opinions of the community on this.