Re: [Zope-dev] [Checkins] SVN: zope.annotation/trunk/setup.py Whitespace fixes
Hi Baiju If this whitespace fix is based on the current style guide, I think the guide needs to be fixed. I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think? - Jacob Baiju M wrote:
Log message for revision 98773: Whitespace fixes
Changed: U zope.annotation/trunk/setup.py
-=- Modified: zope.annotation/trunk/setup.py =================================================================== --- zope.annotation/trunk/setup.py 2009-04-01 21:02:33 UTC (rev 98772) +++ zope.annotation/trunk/setup.py 2009-04-01 21:13:34 UTC (rev 98773) @@ -23,14 +23,14 @@ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup( - name = 'zope.annotation', - version = '3.5.0dev', - url = 'http://pypi.python.org/pypi/zope.annotation', - license = 'ZPL 2.1', - description = 'Object annotation mechanism', - author = 'Zope Corporation and Contributors', - author_email = 'zope-dev@zope.org', - classifiers = [ + name='zope.annotation', + version='3.5.0dev', + url='http://pypi.python.org/pypi/zope.annotation', + license='ZPL 2.1', + description='Object annotation mechanism', + author='Zope Corporation and Contributors', + author_email='zope-dev@zope.org', + classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', @@ -40,23 +40,23 @@ 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development', ], - long_description = \ + long_description= \ read('src', 'zope', 'annotation', 'README.txt') + '\n\n' + read('CHANGES.txt'), - packages = find_packages('src'), - package_dir = {'': 'src'}, - namespace_packages = ['zope',], - install_requires = ['setuptools', - 'zope.interface', - 'zope.component', - 'zope.location', - 'zope.proxy', - ], - extras_require = dict( - test = ['zope.testing', - 'ZODB3'], + packages=find_packages('src'), + package_dir={'': 'src'}, + namespace_packages=['zope',], + install_requires=['setuptools', + 'zope.interface', + 'zope.component', + 'zope.location', + 'zope.proxy', + ], + extras_require=dict( + test=['zope.testing', + 'ZODB3'], ), - include_package_data = True, - zip_safe = False, + include_package_data=True, + zip_safe=False, )
_______________________________________________ Checkins mailing list Checkins@zope.org http://mail.zope.org/mailman/listinfo/checkins
Am 01.04.2009 um 23:44 schrieb Jacob Holm:
Hi Baiju
If this whitespace fix is based on the current style guide, I think the guide needs to be fixed. I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think?
What about defining the version number in front of the setup call as a variable and using it in the call like: version = '3.5.0dev' setup( name='zope.annotation', version=version, ... ) This way no exception from the rule is necessary. Yours sincerely, -- Michael Howitz · mh@gocept.com · software developer gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development
Michael Howitz wrote:
Am 01.04.2009 um 23:44 schrieb Jacob Holm:
Hi Baiju
If this whitespace fix is based on the current style guide, I think the guide needs to be fixed. I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think?
What about defining the version number in front of the setup call as a variable and using it in the call like:
version = '3.5.0dev'
setup( name='zope.annotation', version=version, ... )
This way no exception from the rule is necessary.
I like the idea of putting the version string up front like that, but that was not what I meant. I was not complaining about the "version" keyword argument specifically, but about the removal of whitespace for *all* the keyword arguments to setup. Cheers - Jacob
On Apr 1, 2009, at 5:44 PM, Jacob Holm wrote:
If this whitespace fix is based on the current style guide, I think the guide needs to be fixed. I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think?
-1 The PEP-8 and Zope style for keyword arguments work here just fine. Readability is improved by putting arguments on separate lines, not by adding space around equal sign. Additionally, we could do without fancy spacing. For example, the lists don't have a consistent style in this patch. One avoids fancy spacing ...
+ classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', @@ -40,23 +40,23 @@ 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development', ],
The other two use fancy spacing, are not alphabetically sorted, and do not have consistent rule on commas after the last element ...
+ install_requires=['setuptools', + 'zope.interface', + 'zope.component', + 'zope.location', + 'zope.proxy', + ], + extras_require=dict( + test=['zope.testing', + 'ZODB3'], ),
This would be more consistent, is sorted, and ensures easy addition/ removal of each line including the first, and the last line in the lists. install_requires=[ 'setuptools', 'zope.component', 'zope.interface', 'zope.location', 'zope.proxy', ], extras_require=dict( test=[ 'ZODB3', 'zope.testing', ], ),
On Thu, Apr 2, 2009 at 9:37 AM, Zvezdan Petkovic <zvezdan@zope.com> wrote:
This would be more consistent, is sorted, and ensures easy addition/ removal of each line including the first, and the last line in the lists.
install_requires=[ 'setuptools', 'zope.component', 'zope.interface', 'zope.location', 'zope.proxy', ], extras_require=dict( test=[ 'ZODB3', 'zope.testing', ], ),
+1 -- Benji York Senior Software Engineer Zope Corporation
On Apr 1, 2009, at 5:44 PM, Jacob Holm wrote:
If this whitespace fix is based on the current style guide,
I think so.
I think the guide needs to be fixed.
Me too, but I don't think it will happen. :(
I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think?
I agree, but the style guide says differently. In a previous thread, however, there seems to have been agreement that discussions of style were religious and meaningless, so I suggest ignoring the style guide. <0.32 wink> I would rather people not change things like this when making unrelated changes. Jim -- Jim Fulton Zope Corporation
On Wed, Apr 01, 2009 at 11:44:03PM +0200, Jacob Holm wrote:
If this whitespace fix is based on the current style guide, I think the guide needs to be fixed. I find the fixed version much less readable. A function that takes this many arguments should have an exception to the PEP 8 rule of no whitespace around the equals sign used for keyword arguments. I *think* a reasonable rule is that if you split the call over multiple lines with one argument per line, you should add single spaces before and after the equals sign. What does anyone else think?
I don't want to argue about what's right for Zope, but you asked my (well, everone's) opinion about this, so: -1 I think PEP-8 is right, and keyword arguments should not have spaces around the equals sign *especially* if the argument list is long and is split into multiple lines. setup( <many lines> foo = bar, <many more lines> ) looks like a mistaken assignment of a tuple to a name, while setup( <many lines> foo=bar, <many more lines> ) looks like a function call. Marius Gedminas -- http://pov.lt/ -- Zope 3 consulting and development
2009/4/2 Marius Gedminas <marius@gedmin.as>:
looks like a mistaken assignment of a tuple to a name, while
setup( <many lines> foo=bar, <many more lines> )
looks like a function call.
Agreed; the common use of spaces around the equal signs in setup.py is a holdover from Greg Ward's coding style (Greg being the original author of distutils). AFAICT, they remain prevalent in setup.py because most new setup.py files are generated by copying an existing setup.py from another project. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
participants (7)
-
Benji York -
Fred Drake -
Jacob Holm -
Jim Fulton -
Marius Gedminas -
Michael Howitz -
Zvezdan Petkovic