iterative / dvclive

📈 Log and track ML metrics, parameters, models with Git and/or DVC
https://dvc.org/doc/dvclive
Apache License 2.0
165 stars 36 forks source link

Invalid path causes `TypeError` due to shadowed builtin `type` #761

Closed aazuspan closed 9 months ago

aazuspan commented 9 months ago

When you pass an invalid path type to Live.log_artifact, it's supposed to raise an InvalidDataTypeError:

https://github.com/iterative/dvclive/blob/47c87b3de0d727fe4bb4e46fbe76839bfa692e0e/src/dvclive/live.py#L493-L494

Instead, it raises TypeError: str is not callable because the builtin type is shadowed by the parameter:

https://github.com/iterative/dvclive/blob/47c87b3de0d727fe4bb4e46fbe76839bfa692e0e/src/dvclive/live.py#L484

It's a pretty minor issue, but I thought I'd point it out since it could cause some confusion. Thanks!

dberenbaum commented 9 months ago

@aazuspan Do you have an interest in contributing a fix? We are probably stuck with the type arg name at least until the next major version release, but we could probably work around the issue another way (like move the type checking outside of log_artifact() or checking the type with path.__class__).

aazuspan commented 9 months ago

Sure, I'll make a PR shortly.