This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: make setup.py less chatty by default
Type: Stage:
Components: Distutils Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: jhylton, lemburg, mwh, nascheme, nobody
Priority: normal Keywords: patch

Created on 2002-01-17 15:02 by jhylton, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils.patch jhylton, 2002-05-31 17:09
log.py jhylton, 2002-05-31 17:13
Messages (15)
msg38722 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-17 15:02
I don't like the amount of output that setup.py
produces by default, and I don't like the way that -q
and -v affect the amount of output.  In general, I want
setup.py to tell me what it is doing and not what it is
skippping.  It's fine to say nothing with -q, but it
shouldn't say more without -v.

The attached patch is a bit of a kludge, but I'm not
familiar enough with distutils to do any better.  One
problem is that -v/--verbose has previously handled as
a flag, either on or off.  (There is a curiously large
amount of code that compares this boolean to see if
it's greater than some number!)  I had the options
processor to treat self.verbose as a count of -v
options.  So -vv is more verbose than -v.

Then I change the specific prints and announcements
that I've seen with setup.py that I didn't want to see.
 The messages I don't want to see (unless verbose is
high) are about skipping builds of Extensions and not
copying files that are already up-to-date.

With this patch in place, setup.py tells me only the
extensions is actually builds and files it actually copies.
msg38723 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-01-17 15:49
Logged In: YES 
user_id=6656

Um, context diff?
msg38724 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-17 16:32
Logged In: YES 
user_id=31392

Er, context diff.
msg38725 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-01-17 16:45
Logged In: YES 
user_id=6656

Hokay, next question: why the "assert 0" in cmd.py?  Are you
sure you've finished?
msg38726 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-17 16:50
Logged In: YES 
user_id=31392



The distutils package is a maze of twisty little passages
that all look the same <wink>.  I added an assert 0 to make
sure that the execution path that generated the output
wasn't the one with the assert 0.  (It wasn't.)  Didn't
intend for the patch to make it in.

But I'd still be surprised if this patch is the right thing.
 More likely that it demonstrates good behavior that could
be implemented more cleanly.
msg38727 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-01-17 17:25
Logged In: YES 
user_id=6656

You're not wrong :|

The "assert 0" is on the install path though.

Right.  I'm currently fighting emacs to let me print source
duplex, but I want to understand distutils' innards at some
point, might as well be now.
msg38728 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-01-17 18:17
Logged In: YES 
user_id=38388

Jeremy, the patch touches the distutils code, but what you really 
want is to change the behaviour in one single use-case (the setup.py
which Python uses).

The "right" way to fix this would be to subclass the various distutils
classes to implement the change. If this becomes too complicated,
then distutils ought to be tweaked to make this easier in way that
doesn't break existing code (e.g. I don't want to miss the skip
notices for my stuff).
msg38729 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-17 18:17
Logged In: YES 
user_id=31392

If I had to guess, I'd say cleaning up and rationalizing the
use of self.verbose and print vs self.announce() vs the
other methods that print things would teach you a lot about
the internals.

Hey, and reformat the code while you're at it <wink>.
msg38730 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-17 18:25
Logged In: YES 
user_id=31392

MAL, I really want to change distutils not Python's
setup.py.  I use distutils for all sorts of projects and the
default chattiness is always a nuisance.  When I'm doing
development, I invariable have to wade through hundreds of
lines of useless output to find the one or two lines that
confirm a change was made.

You could still get the skip notices for your stuff, you'd
just have to run in extra verbose mode.
msg38731 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-01-18 09:05
Logged In: YES 
user_id=38388

Jeremy, if that's what you want you should at least post
to the distutils list before going ahead and change things.

E.g. I can't see why "skip" notices are any less important
than "building..." notices: they tell you that distutils has
found some components up-to-date and that may sometimes
not be what you'd really expect.

We should first discuss, what distutils developers want as
default and then go ahead and fixup distutils to meet those
demands.
msg38732 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-01-18 14:53
Logged In: YES 
user_id=31392

Good suggestion.  I hadn't planned to change anything, but
wanted to capture the feature request and share the code.
msg38733 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-03-24 02:01
Logged In: YES 
user_id=35752

I would prefer it if setup.py would only print what it's
compiling and not what it's skipping.
msg38734 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-05-31 17:13
Logged In: YES 
user_id=31392

I've attached a new patch that uses a global log module. 
(The added file, log.py, is a separate attachment to this
patch submission.)  The patch is incomplete, as it removes
the announce() method of several objects.  I haven't
bothered to replace all the calls to announce in the
commands; that needs to be done before this patch can be
accepted, but it's too tedious for today :-).

The new approach is to eliminate all uses of verbose except
one on the Distriubtion object that can be controlled by -v
and -q arguments.  The value of Distribution.verbose is used
to set a logging threshold, stored in a global variable in
the log module.  All code that wants to print a message
calls log.method().

The default verbosity is 1, which skips messages that say
"skipping ...".  It does print any activity actually
performed, like calling a C compiler. 

I'm expect more thought needs to be put into the level that
each message is logged at.
msg38735 - (view) Author: Nobody/Anonymous (nobody) Date: 2002-05-31 17:29
Logged In: NO 

Good idea in general.

Removing .announce() however is not since this
is used by third party tools extending distutils with
their own subclasses (BTW, this is something
you always have to keep in mind: distutils is
made to be extended, so any change to the core
API will break packaging tools).
msg38736 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-06-04 20:15
Logged In: YES 
user_id=31392

Modified version checked in preserving announce() as
recommended by MAL.
History
Date User Action Args
2022-04-10 16:04:53adminsetgithub: 35935
2002-01-17 15:02:01jhyltoncreate