conda-build icon indicating copy to clipboard operation
conda-build copied to clipboard

Limit logging config to CLI

Open kenodegard opened this issue 10 months ago • 0 comments

Checklist

  • [X] I added a descriptive title
  • [X] I searched open requests and couldn't find a duplicate

What is the idea?

Only apply logging defaults/config when conda-build's CLI entrypoints are called (e.g. the conda_build.cli.main_*.execute functions).

Why is this needed?

Conda-build is not only a CLI application. It is also a library and downstream applications import from it and use the API. This means we should not be setting any logging defaults or otherwise customizing the logging and rather defer to the downstream applications and allow them to control logging as they see fit.

Efforts are already underway to improve conda's logging with much of the same mindset (see https://github.com/conda/conda/issues/13541, https://github.com/conda/conda/pull/13735, and https://github.com/conda/conda/pull/13732).

While working on this we need to beware prior art, e.g., https://github.com/conda/conda-build/issues/2106.

What should happen?

  • [ ] Remove logging customization that occurs upon import:

    https://github.com/conda/conda-build/blob/6982cbdfe73bf9a190be75337755e90a90e11df5/conda_build/cli/main_convert.py#L16

    https://github.com/conda/conda-build/blob/6982cbdfe73bf9a190be75337755e90a90e11df5/conda_build/utils.py#L1661-L1667

  • [ ] Only "initialize" logging when conda-build CLI entrypoints are invoked.

Additional Context

No response

kenodegard avatar Apr 09 '24 23:04 kenodegard