← Back to team overview

launchpad-dev team mailing list archive

Re: New coding standard for formatting imports

 

On 2010-08-19 20:10, Jonathan Lange wrote:

But does that have to be a joke?  Couldn't we generate imports (well, those
from other Launchpad modules) automatically during branch build?
...

I would much rather use editor tools than a preprocessor. Once we
introduce a mandatory preprocessing stage, we are no longer writing
Python code. Editor tools provide much the same convenience, but leave
us still writing standard Python.

I'm not thinking of a preprocessor, so much as a build step to produce separate files, much like GNU make files call gcc to map out dependencies for themselves. And ideally, much like how python writes its own pyc files.

As a very rough idea, every foo.py could import a foo-imports.py that contains all the Launchpad imports that foo.py needs. The build procedure would generate foo-imports.py.

The part I haven't thought about at all yet is how to avoid this being an extra step, or a noticeable delay, for the developer. But at any rate we may find a "make" before testing preferable over editing imports ourselves. I for one dislike that jump to the top of the file and back.


Jeroen



Follow ups

References