How to stop bilby version info being written to console on import
For some reason I get irrationally annoyed that bilby
outputs its version info when I import it. I'm writing a new package that uses bilby and in case it's useful to others, here's how I get bilby to suppress its version info (but still keep the logging info for eveything else) when I import that new package:
### import bilby removing the logger version info output ###
import logging
import io
bilby_logger = logging.getLogger('bilby')
handler = logging.StreamHandler(io.StringIO())
bilby_logger.addHandler(handler)
import bilby # the actual import
bilby_logger.removeHandler(handler)
# reset bilby logging handler to default
from bilby.core.utils import setup_logger
setup_logger()
###