Skip to content

fix: replace print() with logger.warning() in extensions catalog warnings - #3969

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/extensions-use-logger
Open

fix: replace print() with logger.warning() in extensions catalog warnings#3969
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/extensions-use-logger

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

print(..., file=sys.stderr) is inappropriate for library code - it bypasses the logging framework and can't be silenced or redirected by consumers.

Fix

Replaced with logger.warning() for proper log management. Removed unused local sys imports.

…ings

Print statements to stderr are not appropriate for library code that may
be consumed by tools or tests. Replaced with logger.warning() for proper
log management. Removed unused local sys imports.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Replaces direct stderr warnings with standard Python logging in the extension catalog.

Changes:

  • Added a module logger.
  • Migrated two catalog warnings to logger.warning().
  • Removed unused local sys imports.
Show a summary per file
File Description
src/specify_cli/extensions/__init__.py Routes catalog warnings through logging.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

src/specify_cli/extensions/init.py:3757

  • Please cover the partial-fetch failure path with caplog: make one catalog raise ExtensionError, let another succeed, and assert the named warning is logged while merging continues. This is the second logging behavior changed by the PR and currently has no regression test.
                logger.warning(
                    "Could not fetch catalog '%s': %s", catalog_entry.name, e,
                )
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +3520 to 3523
logger.warning(
"Using non-default extension catalog. "
"Only use catalogs from sources you trust.",
file=sys.stderr,
)
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.

3 participants