Skip to content

Library should not be printing to stdout without verbose option #6929

Closed

Description

@jnothman

I think it's good policy not to print anything to standard output in library code, except when that's specified by the API, e.g. through a verbose parameter. We have, for instance, a few unguarded print calls in sklearn/datasets. These should be weeded out. One option for fixing is to use logging.info; another is to use print(..., file=sys.stderr).

Activity

  1. fasiabbu commented on Jun 24, 2016

    @fasiabbu

    Hi,
    I see there are still a lot of places where print is being used. I presume all this should converted to logging.info. Is anybody working on this?

  2. lesteve commented on Jun 24, 2016

    @lesteve
    Member

    @fasiabbu somebody is already working on this, look at the PR above i.e. #6930.

  3. amueller commented on Oct 13, 2016

    @amueller
    Member

    somewhat related #78

  4. mitar commented on Jul 4, 2018

    @mitar
    Contributor

    I would also prefer if all output would go through Python logging.

  5. jnothman commented on Jul 4, 2018

    @jnothman
    MemberAuthor

    Yes, this could do with some love. One concern is that we're not sure how to manage backwards compatibility.

  6. mitar commented on Jul 4, 2018

    @mitar
    Contributor

    Backwards compatibility being going to warn and print, or even the formatting of what has been printed out?

  7. jnothman commented on Jul 4, 2018

    @jnothman
    MemberAuthor
  8. dkgaraujo commented on May 26, 2022

    @dkgaraujo

    It seems this is still open. One possibility to deal with users expecting prints to stdout is to append all existing prints with a deprecation warning, mentioning that in a next 1.x version the prints would be taken out and the user might adjust the verbose parameter (or whatever the other solution is).

  9. adrinjalali commented on Apr 19, 2024

    @adrinjalali
    Member

    Closing as duplicate of #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions