BoPeng / simuPOP

A general-purpose forward-time population genetics simulation environment.
http://bopeng.github.io/simuPOP/
GNU General Public License v2.0
30 stars 12 forks source link

banner information should be written to stderr not stdout #98

Closed noamBarkai closed 1 year ago

noamBarkai commented 1 year ago

By default, when importing simuPOP it displays "banner" information about version, build etc. like so:

> import simuPOP
simuPOP Version 1.1.10.9 : Copyright (c) 2004-2016 Bo Peng
Revision 4603 (Oct 13 2020) for Python 3.7.8 (64bit, 0thread)
Random Number Generator is set to

This is currently written to console via print() command and could be problematic in cases where the library is used in a Python script that is run with its output redirected to some file, which is a very common use-case. The common practice in Linux generally is that all "diagnostics" information be written to stderr, not stdout - see for example this SO answer

There is currently a way to suppress writing this information in simuPOP altogether - by setting the "quiet" mode before importing the library, like so:

from simuOpt import setOptions

setOptions(quiet=True)
import simuPOP as sim

But the banner information should be written to stderr regardless IMO