How terrible would something like this be:

class AppConfig:
    """Class representing a Django application and its configuration."""

    .....

   @cached_property
    def is_squashable(self):
        if hasattr(self, 'squashable'):
            return self.squashable
        .... code from isort

in your local apps.py you can chose to do:

class MyAppConfig(AppConfig):
    squashable = False  # or omit it, if you want django to figure it out

This plays back into a requirement i had, where we have apps just for testing 
inside our application that we don't want squashed. We would also need to have 
a little more binding power from Migration to the AppConfig, since we would 
need to pick this value up. From my naive research, doesn't seem like an issue 
since Apps should always exist in order to make the migration anyway, i dont 
see a big risk in coupling the two.

What does everyone think?

Buzzi


> On Apr 28, 2020, at 8:33 PM, charettes <charett...@gmail.com> wrote:
> 
> You don't have to explicitly configure them as long as you run isort within a 
> Python environment that has all dependency installed properly. If you want to 
> run isort without installing all of the deps of your package you have to 
> explicitly specify which module is first or third party.
> 
> Here's the routine I was referring to 
> https://github.com/timothycrosley/isort/blob/0ee43b6a4f3c40876c3c7714846ecf8e584dc314/isort/finders.py#L165-L191
>  
> <https://github.com/timothycrosley/isort/blob/0ee43b6a4f3c40876c3c7714846ecf8e584dc314/isort/finders.py#L165-L191>
> 
> Simon
> 
> Le mardi 28 avril 2020 16:04:14 UTC-4, Markus Holtermann a écrit :
> But for isort one specifies the `known_first_party` and `known_third_party` 
> packages. https://github.com/timothycrosley/isort#configuring-isort 
> <https://github.com/timothycrosley/isort#configuring-isort> 
> 
> At least I was under the impression that that's the only way how it decides 
> where to place imports. 
> 
> Cheers, 
> 
> Markus 
> 
> On Tue, Apr 28, 2020, at 9:41 PM, charettes wrote: 
> > It's notoriously hard to distinguish between first-party and 
> > third-party apps but I know some package manage to do it relatively 
> > well (e.g. isort). 
> > 
> > Le mardi 28 avril 2020 14:32:13 UTC-4, Javier Buzzi a écrit : 
> > > To be kind to the user, absolutely! .. any idea on how to implement it 
> > > O:) 
> > > 
> > >> On Apr 28, 2020, at 2:29 PM, charettes <char...@gmail.com <>> wrote: 
> > >> 
> > >> Don't we need to prevent that from happening anyway? I guess we'd want 
> > >> to prevent --crossapp=auth from working as well. 
> > >> 
> > >> Le mardi 28 avril 2020 13:50:54 UTC-4, Javier Buzzi a écrit : 
> > >>> To do that we need to know which apps are part of your project, and 
> > >>> which are not. Otherwise you'll be squashing "django.contrib.auth" as 
> > >>> an example, and you're not going to have a fun time at that.. 
> > >> 
> > >>  -- 
> > >>  You received this message because you are subscribed to the Google 
> > >> Groups "Django developers (Contributions to Django itself)" group. 
> > >>  To unsubscribe from this group and stop receiving emails from it, send 
> > >> an email to django-d...@googlegroups.com <>. 
> > >>  To view this discussion on the web visit 
> > >> https://groups.google.com/d/msgid/django-developers/ca814e82-9258-40eb-afed-82edb0bc29c8%40googlegroups.com
> > >>  
> > >> <https://groups.google.com/d/msgid/django-developers/ca814e82-9258-40eb-afed-82edb0bc29c8%40googlegroups.com><https://groups.google.com/d/msgid/django-developers/ca814e82-9258-40eb-afed-82edb0bc29c8%40googlegroups.com?utm_medium=email&utm_source=footer
> > >>  
> > >> <https://groups.google.com/d/msgid/django-developers/ca814e82-9258-40eb-afed-82edb0bc29c8%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> > >>  
> > > 
> > 
> >  -- 
> >  You received this message because you are subscribed to the Google 
> > Groups "Django developers (Contributions to Django itself)" group. 
> >  To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-d...@ <>googlegroups.com <http://googlegroups.com/>. 
> >  To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-developers/8af08a8f-4f4d-4fef-8daa-e3743a1f8468%40googlegroups.com
> >  
> > <https://groups.google.com/d/msgid/django-developers/8af08a8f-4f4d-4fef-8daa-e3743a1f8468%40googlegroups.com>
> >  
> > <https://groups.google.com/d/msgid/django-developers/8af08a8f-4f4d-4fef-8daa-e3743a1f8468%40googlegroups.com?utm_medium=email&utm_source=footer
> >  
> > <https://groups.google.com/d/msgid/django-developers/8af08a8f-4f4d-4fef-8daa-e3743a1f8468%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> >  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com 
> <mailto:django-developers+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/2a1d8093-8447-4a1d-a434-53d03cc6680d%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-developers/2a1d8093-8447-4a1d-a434-53d03cc6680d%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/A54F3056-FD01-495B-AE8D-655B56A16CC7%40gmail.com.

Reply via email to