[Distutils] Re: [optik] Optik in the stdlib?

Greg Ward gward@python.net
Sat Feb 9 22:12:02 2002

On 05 February 2002, David Goodger said:
> Has anyone looked into getting Optik__ accepted into Python's standard
> library?

I haven't inquired on python-dev, but it's something I'd like to do for
Python 2.3.  There are a few small tweaks I'd like to make to Optik
before I consider it "done", but it's pretty damn close.

> From past experience I know that modifying Lib/getopt.py is
> off-limits; perhaps an "Adding a High-Level Option Module" PEP is in
> order? Yes, I am volunteering to write & champion a PEP.

I don't know if a PEP is necessary just to add a module (or a couple of

> Optik seems to be a generalized and reworked superset of Distutils'
> fancy_getopt.py (also originally written by Greg Ward).

That's a fair assessment.

> Are there any features of fancy_getopt missing from Optik?

Optik uses the wrap_text() function currently provided by fancy_getopt.
This function should be moved elsewhere in the standard library -- maybe
somewhere in the distutils package, maybe somewhere else.  (Heck, maybe
into Optik itself if it goes in the standard lib.)  But I'm pretty sure
Optik is a complete superset of (and completely superior to)

> Are there any plans to replace fancy_getopt in Distutils with Optik? I
> realize their interfaces are not 100% compatible.

Yes, I have had ideas along these lines.  The distutils.fancy_getopt
module would shrink to a wrapper around Optik so that existing Distutils
commands could continue to work -- this is particularly important for
people who subclass commands and add their own options.  That's about as
far as I've gotten.

> Question for Greg: How would you compare the two modules?

fancy_getopt was a quick hack motivated by the obvious fact that the
standard getopt is totally inadequate for applications like the
Distutils that need an extensible option-parsing framework.  It was
toned down ("the simplest thing possible that actually works") because I
didn't want to get distracted by cooking up an all-singing, all-dancing
option-parsing solution just for the Distutils.

Optik is the all-singing, all-dancing option-parsing solution that I
have always wanted.

Greg Ward - geek                                        gward@python.net
"When I hear the word `culture', I reach for my gun." --Goebbels
"When I hear the word `Microsoft', *I* reach for *my* gun." --me