statsforecast
statsforecast copied to clipboard
Importing statsforecast supersedes any logging config
Describe the bug A best practice in python is to setup the main python file in the following way:
<imports>
...
if __name__ == '__main__':
<setup logging>
<start program>
However, importing statsforecast
will supersede any logging setup defined in this best-practice way.
To Reproduce
Steps to reproduce the behavior, run the following commands, with the following contents for test_log.py
:
conda create -n tmp python=3.8 pip
conda activate tmp
pip install statsforecast==1.1.1
python test_log.py
Contents of test_log.py
:
import logging
import statsforecast
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
logging.info("Hello World")
Expected behavior
For logs to appear in the terminal. This does not happen because statsforecast
makes its own call to logging.basicConfig
in the core.py
file, which is a bad practice for a distributed package.
Additional context I will submit a PR shortly.
Thanks for the comments @JeroenPeterBos
This is the contributing guide, if you find any problem feel free to reach us.
#275
Fixed in #275