[openstack-dev] HACKING and new-style relative imports

Kieran Spear kispear at gmail.com
Wed Jul 10 04:34:01 UTC 2013


On 09/07/2013, at 9:57 PM, Sean Dague <sean at dague.net> wrote:

> On 07/09/2013 07:28 AM, Kieran Spear wrote:
>> Hi all,
>> 
>> There's a review up to make Horizon pass H304 (no relative imports):
>> 
>> https://review.openstack.org/#/c/35664/
>> 
>> Old-style relative imports are dangerous, but I can't think of a good enough reason to forbid new-style imports, e.g.:
>> 
>> from .views import IndexView
>> 
>> instead of
>> 
>> from openstack_dashboard.dashboards.project.images_and_snapshots.views \
>>       import IndexView
> 
> However, if you decide to address H302, most of the over 80 character issues in horizon are going to fit, as this would become:
> 
> from openstack_dashboard.dashboards.project.images_and_snapshots import views
> 
> (tacking in at 78 chars)
> 
> I'm sure there will still be a few which break the limit... but that will fix a lot of them (from what I see in the review).

Agreed, that would work. But I'd like to consider H304 on its merits before we go working around it. There has also been some discussion about whether we want to enforce H302 in Horizon, particularly for classes.

> 
> 	-Sean
> 
> -- 
> Sean Dague
> http://dague.net




More information about the OpenStack-dev mailing list