Re: Changing the discovery method for management commands

2020-12-20 Thread Ken Whitesell
On 12/18/2020 8:48 PM, Diptesh Choudhuri wrote: As of now, if you need to create a management command, it is necessary to create a file *app_name/management/commands/my_command.py, *and then add *app_name *to *INSTALLED_APPS *in *settings.py. *This prevents non-django packages from defining the

Re: Changing the discovery method for management commands

2020-12-19 Thread Diptesh Choudhuri
I admit I can't find a lot of use cases for this out there. It is just something I think django could benefit from. Please feel free to close this issue. On Sunday, December 20, 2020 at 12:26:45 AM UTC+5:30 Adam Johnson wrote: > The use case I mentioned applies to lot of packages (and new proje

Re: Changing the discovery method for management commands

2020-12-19 Thread Adam Johnson
> > The use case I mentioned applies to lot of packages (and new projects > could benefit from this change too). > Please bring more evidence than just blind assertion. Also I think it's a net negative, as it complicates the notion of what a management command is. It's against the Zen of Python (

Re: Changing the discovery method for management commands

2020-12-19 Thread Diptesh Choudhuri
There are no remaining use cases here. The use case I mentioned applies to lot of packages (and new projects could benefit from this change too). On Saturday, December 19, 2020 at 11:05:55 PM UTC+5:30 Ahmad A. Hussein wrote: > What are the remaining use cases here? Is the proposed change absolu

Re: Changing the discovery method for management commands

2020-12-19 Thread Ahmad A. Hussein
What are the remaining use cases here? Is the proposed change absolutely necessary for these use cases? On Sat, Dec 19, 2020 at 6:19 PM Diptesh Choudhuri < diptesh.choudh...@gmail.com> wrote: > Though its just one file and two directories, the use case is common > enough to be used by a lot of

Re: Changing the discovery method for management commands

2020-12-19 Thread Diptesh Choudhuri
Though its just one file and two directories, the use case is common enough to be used by a lot of packages and I think django should do something to support it officially. On Saturday, December 19, 2020 at 8:19:28 PM UTC+5:30 f.apo...@gmail.com wrote: > On Saturday, December 19, 2020 at 3:16:

Re: Changing the discovery method for management commands

2020-12-19 Thread Florian Apolloner
On Saturday, December 19, 2020 at 3:16:51 PM UTC+1 diptesh@gmail.com wrote: > and having to add a bunch of unnecessary files to the source code A bunch? You can literally get away with one file: ➜ testing git:(dc_message_signing) ✗ tree testabc testabc └── management └── commands

Re: Changing the discovery method for management commands

2020-12-19 Thread Adam Johnson
I also don’t see why you can’t add a pytest app to contain the management command. On Sat, 19 Dec 2020 at 13:48, Tom Forbes wrote: > I think it would be quite simple to add support for setuptools entrypoints > into the discovery code (using Poetry, or with equivalent > setup.py/setup.cfg stateme

Re: Changing the discovery method for management commands

2020-12-19 Thread Diptesh Choudhuri
I initially created a PR on the *pytest-django *package for this management command https://github.com/pytest-dev/pytest-django/issues/897. But after I dug into the source code, I realized it is impossible to add a management command without creating a django app (and having to add a bunch of u

Re: Changing the discovery method for management commands

2020-12-19 Thread Florian Apolloner
Nothing is stopping pytest-django to also ship a django app for those management commands though On Saturday, December 19, 2020 at 2:27:57 PM UTC+1 diptesh@gmail.com wrote: > As you said, most cases. The remaining cases have absolutely no way of > defining management commands. One example

Re: Changing the discovery method for management commands

2020-12-19 Thread Tom Forbes
I think it would be quite simple to add support for setuptools entrypoints into the discovery code (using Poetry, or with equivalent setup.py/setup.cfg statements): [tool.poetry.plugins.django] “setup_pytest" = “pytest_django.commands.setup_pytest” Despite it being easy I’m not sure there is a c

Re: Changing the discovery method for management commands

2020-12-19 Thread Diptesh Choudhuri
As you said, most cases. The remaining cases have absolutely no way of defining management commands. One example is *pytest-django *which doesn't provide a django app but could benefit with a mangement command *python manage.py setup_pytest*. On Saturday, December 19, 2020 at 2:11:32 PM UTC+5:3

Re: Changing the discovery method for management commands

2020-12-19 Thread Adam Johnson
Why? I don't see an impetus to avoid creating a Django app. In most use cases there are related models or other Django bits to go with a management command. On Sat, 19 Dec 2020 at 01:48, Diptesh Choudhuri wrote: > As of now, if you need to create a management command, it is necessary to > create