Re: [Cython] CmdLine.py refactoring

2011-08-08 Thread Stefano
Sunday 7th August 2011 16:21:06, Stefan Behnel wrote:
> argparse is new and not supported by anything but 2.7 and recent 3.x
> versions. Cython currently runs on Python 2.4, which rules out a dependency
> on argparse. I never tried it, so I can't tell what exactly the advantages
> over optparse are. They certainly can't be big enough to make up for a
> duplicate implementation of Cython's cmd line parser.

Work on commandline is almost over, then I'll expose my refactoring proposal 
:)

Working with argparse vs. optparse showed me that, indeed, the two things are 
much different (and, in this sense, argparse is more straightforward than 
optparse), moreover that the optparse (nor the old if: elif: approach) version 
cannot parse complicated commandlines (see Tests/TestCommandLine.py)  - a 
thing which we may expect with some exoteric build system producing 10-line-
long command lines (a.k.a. autotools) . 

As a proof of its quality, Fedora, Ubuntu and SuSe all ship a python-argparse 
package for older versions of python (<2.7). Given that the module is self-
contained and as small as 80KB, wouldn't be feasible to add it as a build 
dependency?

So that I could drop the alternate implementation - which, sadly, makes one of 
the tests from the testsuite (apart from my own) fail.

Find all commits at: https://github.com/satufk/cython/commits/_commandline

--SKS
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] CmdLine.py refactoring

2011-08-08 Thread Stefan Behnel

Stefano, 08.08.2011 22:36:

As a proof of its quality, Fedora, Ubuntu and SuSe all ship a python-argparse
package for older versions of python (<2.7). Given that the module is self-
contained and as small as 80KB, wouldn't be feasible to add it as a build
dependency?


Note that that's huge compared to the current command line parser. The 
current implementation doesn't even use 8K, and it's perfectly 
self-contained as well.


Could you try to explain what the advantages of your new implementation are?

Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] CmdLine.py refactoring

2011-08-08 Thread Vitja Makarov
2011/8/9 Stefan Behnel :
> Stefano, 08.08.2011 22:36:
>>
>> As a proof of its quality, Fedora, Ubuntu and SuSe all ship a
>> python-argparse
>> package for older versions of python (<2.7). Given that the module is
>> self-
>> contained and as small as 80KB, wouldn't be feasible to add it as a build
>> dependency?
>
> Note that that's huge compared to the current command line parser. The
> current implementation doesn't even use 8K, and it's perfectly
> self-contained as well.
>
> Could you try to explain what the advantages of your new implementation are?
>

One more note: with optparser it would be harder to handle options like -Werror,
that's easy to remove them at all, or they could be handled as "W:"

Don't know how it's made in gcc.

-- 
vitja.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] CmdLine.py refactoring

2011-08-08 Thread Dag Sverre Seljebotn

On 08/09/2011 08:33 AM, Stefan Behnel wrote:

Stefano, 08.08.2011 22:36:

As a proof of its quality, Fedora, Ubuntu and SuSe all ship a
python-argparse
package for older versions of python (<2.7). Given that the module is
self-
contained and as small as 80KB, wouldn't be feasible to add it as a build
dependency?


Note that that's huge compared to the current command line parser. The
current implementation doesn't even use 8K, and it's perfectly
self-contained as well.


I'd prefer if optparse was sufficient. The main advantage of argparse to 
me seems to be in parsing command structures, such as "hg add ...", "hg 
init ...". Since we don't do that in Cython I'd think optparse would be 
sufficient, and that we should not ship argparse.



Could you try to explain what the advantages of your new implementation
are?


Assuming one switches to optparse, I find this line of reasoning highly 
dubious... and think the burden should be the other way: Please argue 
why custom, specific, low-level code is necesarry in Cython's command 
line parser.


Using optparse/argparse have the obvious benefits that they are higher 
level and so more stuff can be automated. In particular, better 
automatically up-to-date command line help tracking changes elsewhere in 
the codebase (such as directives that can be passed to -X).


Dag Sverre
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel