Re: Explicit relative imports

2014-11-13 Thread Tai Lee
I also don't see much benefit in using relative imports. Code is read many 
more times than it is written, and I find having the full path makes it 
much easier to sort and visually scan imports, and to easily see at a 
glance exactly where to find what you need.

If they are to be used, I would recommend against any relative imports from 
parent packages. It should be limited to siblings only.

Cheers.
Tai.


On Friday, 14 November 2014 00:57:15 UTC+11, Tom Christie wrote:
>
> Contrary voice here, but I don't dig explicit relative imports, it's just 
> adds an extra decision point for no real benefit.
>
> Personally I always recommend full absolute imports, ordered strictly 
> alphabetically - there's then never any room for confusion or decision 
> making around how the imports should be written, and it's always tidy and 
> consistent.
>
> Not looking to necessarily change the Django project's stance on that, but 
> that's the style I use throughout my projects and it's trivial to stick to. 
>
> Cheers,
>
>   Tom
>
> On Wednesday, 12 November 2014 21:59:42 UTC, Jannis Leidel wrote:
>>
>>
>> > On 11 Nov 2014, at 22:51, Aymeric Augustin <
>> aymeric@polytechnique.org> wrote: 
>> > 
>> > Hello, 
>> > 
>> > We’ve started using explicit relative imports in newer parts of the 
>> Django source tree. They’re short and readable. That’s good. 
>> > 
>> > I would like to add guidelines about imports in the coding style guide 
>> in order to improve consistency. 
>> > 
>> > My inclination would be to recommend relative imports within 
>> “components” but avoid them between “components”, where a component is: 
>> > 
>> > - a well-defined sub-framework (django.core.cache, django.db, 
>> django.forms, django.template, etc.) 
>> > - a contrib app 
>> > - an app in the tests/ directory 
>> > - etc. 
>> > 
>> > I would discourage going back into parent modules with relative imports 
>> because statements such as `from ...spam import eggs` are hard to parse. 
>> > 
>> > You can see an example of this style in django.apps which has only 
>> three files. 
>> > 
>> > What do you think? 
>>
>> Yup, the way to go. 
>>
>> Jannis
>
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/36767be0-78fd-40f0-afdc-c3d0c7c121e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Explicit relative imports

2014-11-13 Thread Marc Tamlyn
Whilst I think it's a bit nicer to be explicit in smaller projects, there
are a few places where django's structure can result in long import paths -
e.g. django.contrib.gis.db.backends where I think relative imports would
actually add clarity.

I tend to separate the relative section as the last block at the end of the
imports which further show what is "within" a component, rather than it
being buried within a large block.

In any case, explicit relative imports are greatly preferable to implicit
ones.

Marc
On 13 Nov 2014 13:57, "Tom Christie"  wrote:

> Contrary voice here, but I don't dig explicit relative imports, it's just
> adds an extra decision point for no real benefit.
>
> Personally I always recommend full absolute imports, ordered strictly
> alphabetically - there's then never any room for confusion or decision
> making around how the imports should be written, and it's always tidy and
> consistent.
>
> Not looking to necessarily change the Django project's stance on that, but
> that's the style I use throughout my projects and it's trivial to stick to.
>
> Cheers,
>
>   Tom
>
> On Wednesday, 12 November 2014 21:59:42 UTC, Jannis Leidel wrote:
>>
>>
>> > On 11 Nov 2014, at 22:51, Aymeric Augustin > polytechnique.org> wrote:
>> >
>> > Hello,
>> >
>> > We’ve started using explicit relative imports in newer parts of the
>> Django source tree. They’re short and readable. That’s good.
>> >
>> > I would like to add guidelines about imports in the coding style guide
>> in order to improve consistency.
>> >
>> > My inclination would be to recommend relative imports within
>> “components” but avoid them between “components”, where a component is:
>> >
>> > - a well-defined sub-framework (django.core.cache, django.db,
>> django.forms, django.template, etc.)
>> > - a contrib app
>> > - an app in the tests/ directory
>> > - etc.
>> >
>> > I would discourage going back into parent modules with relative imports
>> because statements such as `from ...spam import eggs` are hard to parse.
>> >
>> > You can see an example of this style in django.apps which has only
>> three files.
>> >
>> > What do you think?
>>
>> Yup, the way to go.
>>
>> Jannis
>
>  --
> 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 post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/7f1a5323-1efd-4891-bc02-eab5d67bc8b4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMwjO1GAyv%3DU939LQiKYJeM_z3EOzPXEYMOPteDoOuOUoefH%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Explicit relative imports

2014-11-13 Thread Tom Christie
Contrary voice here, but I don't dig explicit relative imports, it's just 
adds an extra decision point for no real benefit.

Personally I always recommend full absolute imports, ordered strictly 
alphabetically - there's then never any room for confusion or decision 
making around how the imports should be written, and it's always tidy and 
consistent.

Not looking to necessarily change the Django project's stance on that, but 
that's the style I use throughout my projects and it's trivial to stick to. 

Cheers,

  Tom

On Wednesday, 12 November 2014 21:59:42 UTC, Jannis Leidel wrote:
>
>
> > On 11 Nov 2014, at 22:51, Aymeric Augustin <
> aymeric@polytechnique.org > wrote: 
> > 
> > Hello, 
> > 
> > We’ve started using explicit relative imports in newer parts of the 
> Django source tree. They’re short and readable. That’s good. 
> > 
> > I would like to add guidelines about imports in the coding style guide 
> in order to improve consistency. 
> > 
> > My inclination would be to recommend relative imports within 
> “components” but avoid them between “components”, where a component is: 
> > 
> > - a well-defined sub-framework (django.core.cache, django.db, 
> django.forms, django.template, etc.) 
> > - a contrib app 
> > - an app in the tests/ directory 
> > - etc. 
> > 
> > I would discourage going back into parent modules with relative imports 
> because statements such as `from ...spam import eggs` are hard to parse. 
> > 
> > You can see an example of this style in django.apps which has only three 
> files. 
> > 
> > What do you think? 
>
> Yup, the way to go. 
>
> Jannis

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7f1a5323-1efd-4891-bc02-eab5d67bc8b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Adding checks for common URLpattern configuration errors

2014-11-13 Thread Julian Wachholz
Hi Django-Developers

I would like to add additional system checks to the existing bunch. In
particular, checks regarding common configuration errors around
URLpatterns.

An example check is described in the ticket here:
https://code.djangoproject.com/ticket/23813

Please suggest any other common issues you might have encountered that
would be great to have as a check in the Django core.
And feel free to propose any checks unrelated to URLpatterns, too.

Cheers
Julian

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALvBJz1k4joCj24Tp54uxBm_nrGETC14DYJkj%3D4hqxcQfPKTTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running flake8 on pull requests

2014-11-13 Thread Tim Graham
Yes, I think so. It's been on my list of things to look into for some time. 
Thanks for the nudge.

On Tuesday, November 11, 2014 10:41:02 PM UTC+1, Aymeric Augustin wrote:
>
> Hello, 
>
> Since we started using flake8, we made many small commits to fix glitches. 
>
> Would it be possible to run flake8 on Jenkins when testing pull requests? 
>
> I think that would help. 
>
> -- 
> Aymeric. 
>
>
>
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/5b18ea62-cc47-4add-9660-fe6f9632c1fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.