Skip to content

Conversation

@tfrere
Copy link
Contributor

@tfrere tfrere commented Nov 14, 2025

No description provided.

- 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.
Copilot finished reviewing on behalf of tfrere November 14, 2025 19:13
Copy link
Contributor

Copilot AI left a 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 version from importlib.metadata to 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 version field to the DaemonStatus dataclass to expose the version information through the status API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +46 to +51
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")
Copy link

Copilot AI Nov 14, 2025

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.

Copilot uses AI. Check for mistakes.
except Exception:
package_version = None
self.logger.warning("Could not determine daemon version")

Copy link

Copilot AI Nov 14, 2025

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.

Suggested change

Copilot uses AI. Check for mistakes.
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.

2 participants