-
Notifications
You must be signed in to change notification settings - Fork 41
Feat/add daemon version to status #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
- Add version field to DaemonStatus dataclass - Retrieve package version using importlib.metadata with fallback to pyproject.toml - Include version in daemon status response via /api/daemon/status endpoint
Remove complex fallback mechanism for package version. Keep only importlib.metadata.version() which works in production. If it fails, gracefully return None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds version tracking to the daemon by including the package version in the daemon's status information. This enables users and systems to programmatically determine which version of the daemon is running.
Key Changes
- Imports
versionfromimportlib.metadatato retrieve the installed package version - Retrieves and logs the daemon version during initialization with error handling for cases where the version cannot be determined
- Adds a
versionfield to theDaemonStatusdataclass to expose the version information through the status API
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| package_version = version("reachy_mini") | ||
| self.logger.info(f"Daemon version: {package_version}") | ||
| except Exception: | ||
| package_version = None | ||
| self.logger.warning("Could not determine daemon version") |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception handling is too broad. importlib.metadata.version() specifically raises PackageNotFoundError when a package is not found. Consider catching the specific exception type instead of a bare Exception:
from importlib.metadata import PackageNotFoundError, version
# ...
try:
package_version = version("reachy_mini")
self.logger.info(f"Daemon version: {package_version}")
except PackageNotFoundError:
package_version = None
self.logger.warning("Could not determine daemon version")This makes the error handling more precise and explicit about what failure case is being handled.
| except Exception: | ||
| package_version = None | ||
| self.logger.warning("Could not determine daemon version") | ||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected. Please remove the trailing whitespace at the end of this line.
No description provided.