Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mantis_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def create_space (self, space_name: str,
raise SpaceCreationError (progress["error"])

if progress["progress"] != previous_progress:
print(f"{progress["progress"]}% - {progress['message']}")
print(f"{progress['progress']}% - {progress['message']}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While this change correctly fixes the f-string syntax error, it's generally better practice for a library (SDK) to use logging instead of print() for output.1 Using the configured logger allows the user of the SDK to control the verbosity and destination of the output. I suggest using logger.info here for progress messages, which seems more appropriate than print() given that a logger is already in use in this file.

Suggested change
print(f"{progress['progress']}% - {progress['message']}")
logger.info(f"{progress['progress']}% - {progress['message']}")

Style Guide References

Footnotes

  1. In library code, it is recommended to use the logging module for all event logging, including informational messages, warnings, and errors. Avoid using print() as it writes to standard output and is not easily configurable by the application that imports and uses the library.

previous_progress = progress["progress"]

# Detects whether we need to select some params
Expand Down