Skip to content

Unify user-facing output: replace bare print() in library code with logger #9

Description

@tschm

Problem

Library code in src/pycharting/api/interface.py mixes two output channels for user-facing messages: it logs via logger and writes directly to stdout with bare print(), e.g. interface.py:284–285:

if _active_server and _active_server.is_running:
    logger.info("Stopping ChartServer...")
    _active_server.stop_server()
    print("✓ Chart server stopped")
else:
    print("ⓘ No active server to stop")

Bare print() in library code writes to a caller's stdout unconditionally (no level control, not capturable through logging config), which is surprising for a library consumed in scripts and notebooks.

Proposed fix

Route user-facing messages through a single channel — either the existing logger, or one small notify helper — instead of bare print(). Audit src/pycharting/ for any other bare print() calls and convert them too.

Acceptance criteria

  • No bare print() remains in src/pycharting/.
  • User-facing messages go through one consistent channel.
  • Existing behavior is preserved and make test passes (update any tests that assert on captured stdout).

Subcategory: Code structure & readability (8 → 9) from the Rhiza quality assessment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions