fpgmaas/deptry

deptry seems to break when no [tool.deptry] section is available in pyproject.toml

fpgmaas opened this issue · 2 comments

Describe the bug

When running deptry 0.3.8 without a [too.deptry] section in [pyproject.toml], it does not function properly:

(example-project-py3.10) ➜  example-project git:(main) ✗ deptry -v .
WARNING:root:Warning: Package 'foo' not found in current environment. Assuming its corresponding module name is 'foo'.

This is all output, while a lot more output is expected. It seems only warning's are logged, and info and debug are skipped. The same command as ran above shows the right output when adding [tool.deptry] to pyproject.toml.

To Reproduce

Run deptry 0.3.8 in a project without [tool.deptry] in it's pyproject.toml

System [please complete the following information]:

  • OS: MacOS
  • Language Version: Python 3.10
  • Poetry version: Poetry 1.2.0

It seems something related to the logging breaks; deptry --version does work when using print to display the version instead of logging.info.

It seems to be caused by the logging statements in config.py. When these are replaced with print, everything works fine.

So it seems using the logging statements before the logger is configured causes the problem. There is no logging configured before this point, since that is configured only within the body of deptry in cli.py.