Skip to content

Remove import-time logging setup - #163

Merged
khoroshevskyi merged 2 commits into
devfrom
no-import-time-logging
Aug 7, 2026
Merged

Remove import-time logging setup#163
khoroshevskyi merged 2 commits into
devfrom
no-import-time-logging

Conversation

@nsheff

@nsheff nsheff commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

pepdbagent used to configure logging as a side effect of being imported. __init__.py called logmuse.init_logger("pepdbagent") and then coloredlogs.install(), so simply running import pepdbagent would attach a handler and start coloring output.

That is the wrong place for that decision. pepdbagent is a library with no command line of its own, so the application using it should decide how its logs look.

Worse, init_logger sets propagate = False on the logger. That disconnects pepdbagent from the normal logging chain, so an application that configures logging the usual way gets nothing from pepdbagent at all. The only way around it is to reach in and configure the pepdbagent logger by name.

That is exactly what pephub does today, in pephub/main.py, where it sets its own level and [PEPDBAGENT] prefix. That still works after this change, so nothing needs to be updated in pephub. It just no longer has to fight the defaults.

This PR deletes the setup block from __init__.py and drops logmuse and coloredlogs from the dependencies, since nothing else in the package used either one. Every module already gets its logger with logging.getLogger(PKG_NAME), and nothing imported _LOGGER from the package root, so there is nothing else to change.

This follows the guidance added in logmuse 0.3.0, which now also applies colors on its own when coloredlogs is installed. Similar cleanups are needed in geopephub, bedboss, bedhost, and pephubclient.

@nsheff
nsheff requested a review from khoroshevskyi August 7, 2026 16:35
CI installs ruff unpinned; 0.16 began formatting Python blocks inside markdown, so README started failing on every branch.

@khoroshevskyi khoroshevskyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@khoroshevskyi
khoroshevskyi merged commit 6f669db into dev Aug 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants