Skip to content

[OPIK-668]: BaseMetric safer defaults #1826

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ldaugusto
Copy link
Contributor

…default

Details

Issues

Resolves #

Testing

Documentation

@ldaugusto ldaugusto requested a review from a team as a code owner April 11, 2025 10:49
Copy link
Contributor

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit fd16bbb.

Copy link
Contributor

github-actions bot commented Apr 11, 2025

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit fd16bbb.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

Let's also get some eyes from the SDK team.

Comment on lines +36 to +37
def __init__(self, name: str | None = None, track: bool = True) -> None:
self.name = name if name is not None else self.__class__.__name__
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe the following would be enough:

def __init__(self, name: str = None, track: bool = True) -> None:
        self.name = name if name is not None else self.__class__.__name__

Or even better:

    def __init__(self, name: str = __class__.__name__, track: bool = True) -> None:
        self.name = name

Copy link
Collaborator

@alexkuzmik alexkuzmik Apr 29, 2025

Choose a reason for hiding this comment

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

@ldaugusto @andrescrz
BaseMetric is not supposed to be instantiated directly, it's a base for other metric classes. So, there is no point in adding a default value to it at all, subclasses will have their own default names anyway.

I suggest closing the PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

Test coverage?

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