Open wsot opened 7 months ago
My main question is whether there are downsides or footguns to django-extensions
that would make it problematic to use in dev
but not install in prod
. (Or maybe whether we would install it in prod too)
If not installing in prod, it would be important to ensure that when tests run in CI, they run in the absence of django-extensions
which probably means making sure our requirements files break out dev
, prod
and test
groups. (Side argument: if you have test tooling installed when running tests, how can you be sure prod will not fail in the absence of the test tooling!)
It looks like at least the auto-model import features of shell_plus
are likely to be added to Django relatively soon (🤞🏼). It is the current subject of a Google Summer of Code initiative:
https://forum.djangoproject.com/t/gsoc-2024-auto-importing-in-the-shell/30749
As such this issue might get solved for us.
🎯Aim
Have an easy way to start a shell with all the relevant models (and maybe other helpers) autoloaded.
📕Context
The django-extensions project provides a nice autoloading of models etc when using the
shell_plus
command. However,django-extensions
also includes a whole grab-bag of other stuff we don't necessarily want to include.There are potentially a couple of ways to do this.
One we have used previously is to include an
ipython_config.py
in the root of the project so a shell started there will autoload the models. The code (thanks @a-musing-moose ) is:We could potentially approximately duplicate the functionality of the
shell_plus
part ofdjango-extensions
(but rewritten in such a way as to ensure no licensing problems).Or we could just include
django-extensions
as a dev-only requirement (but we'd want to make sure we test without it!)📝Relevant resources/doc's/people
Slack thread where
django-extensions
came up (although it was talking more about generating a graph of the model relationships): https://ackama.slack.com/archives/CV0H0QML7/p1709941586747639 Django extensions itself: https://django-extensions.readthedocs.io/en/latest/✅Acceptance Criteria