Skip to content

fix: stop configuring root logging at import (#100) - #102

Open
tschm wants to merge 1 commit into
alihaskar:masterfrom
tschm:rhiza_fix_100_20260930
Open

tschm wants to merge 1 commit into
alihaskar:masterfrom
tschm:rhiza_fix_100_20260930

Conversation

@tschm

@tschm tschm commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #100

Acceptance criterion (verbatim):

python -c "import logging, pycharting; print(logging.getLogger().handlers)" prints [], a test asserts that, and make test passes.

What changed

  • src/pycharting/core/server.py: removed the module-level logging.basicConfig(level=logging.INFO, ...). A plain import pycharting no longer adds a handler to the root logger or changes its level, so it can't override the logging setup of whatever app imports it.
  • tests/pycharting/core/test_server.py: added test_import_leaves_root_logging_unconfigured. It runs the criterion's exact command in a fresh interpreter, because pytest attaches its own capture handlers to the root logger and an in-process check would never see [].

Gates

  • make fmt: pass
  • make test: pass, 179 tests, 100% coverage (bar is 90%)
  • The criterion's command, run by hand: prints []

Deliberately not addressed. The issue's optional suggestions are not in this PR: attaching a NullHandler to the pycharting logger ("if default output is wanted"), and adding logging config to demo.py or to server.py's __main__ block. The criterion doesn't need either. uvicorn.run(..., log_level="info") still configures uvicorn's own server logs when you run the server directly.

Closes #100

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

Stop configuring root logging at import in core/server.py

1 participant