disable local imports
ClosedPublic

Authored by garretraziel on Jun 5 2014, 10:47 AM.

Details

Summary

Since removal of local python modules and moving them to global
scope can leave *.pyc files behind and cause confusion, I think that it's
reasonable to disable local imports by using from __future__ import absolute_import.
Because code is written without this bad practice of importing local packages,
there is no need to change how we import things, so only change is adding
futureimport at the beginning of each file.

I have searched and found out that there is no way how to disable it globally
(see https://stackoverflow.com/questions/13773861/how-can-we-make-future-imports-global),
so I have added it to each file in libtaskotron/ and libtaskotron/directives.

Test Plan

py.test as usual, then create file tap.py in libtaskotron/
containing sys.exit(1) and check that tap.py from bayeux gets imported,
instead of this local file.

Diff Detail

Repository
rLTRN libtaskotron
Lint
Lint Skipped
Unit
Unit Tests Skipped
garretraziel retitled this revision from to disable local imports.Jun 5 2014, 10:47 AM
garretraziel updated this object.
garretraziel edited the test plan for this revision. (Show Details)
garretraziel added reviewers: kparal, tflink.
garretraziel added a subscriber: jskladan.
garretraziel updated this object.
garretraziel edited the test plan for this revision. (Show Details)

@jskladan @tflink what do you think about disabling local imports?

jskladan accepted this revision.Jun 5 2014, 11:31 AM
jskladan added a reviewer: jskladan.

I have no strong objections. Given that we use the "right" way of importing anyway.

If there was a way to automagically check all files for the presence of from __future__ import absolute_import during git commit/push/whatever I'd be even happier.

This revision is now accepted and ready to land.Jun 5 2014, 11:31 AM

It's a bit unfortunate that it needs to be in every file, but I think it's beneficial to have this behavior.

garretraziel closed this revision.Jun 9 2014, 9:59 AM
garretraziel updated this revision to Diff 368.

Closed by commit rLTRNe3bdb0c622be (authored by Garret Raziel <boloomka@gmail.com>).