python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Fire can't find custom `__str__` of `~datasets.Dataset` from HuggingFace

Open nerdai opened this issue 9 months ago • 1 comments

Hi,

I am using fire on a main function that returns a ~datasets.Dataset object. When running from cli, I get the help screen for ~datasets.Dataset rather than the __str__ implementation (likely inherited from a parent class -- haven't looked).

Reproducible example

from datasets import Dataset
import fire

def main():
    # Create a simple dataset
    dataset = Dataset.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]})
    return dataset

if __name__ == "__main__":
    fire.Fire(main)
    
    # This works but I feel shouldn't be necessary:
    # def custom_serializer(obj: object) -> str:
    #     if hasattr(obj, "__str__"):
    #         return str(obj)
    #     else:
    #         return ""
    # fire.Fire(main, serialize=custom_serializer)

nerdai avatar Apr 07 '25 01:04 nerdai

Just to note that this still happens with lg 0.32.2 and that if an SSH key is loaded into a keyring then the SSH connection is successful.

I'd like to know what lazygit is doing on startup when it connects to the origin? Is it doing a git fetch or something? How can this be prevented?

artfulrobot avatar Feb 09 '22 11:02 artfulrobot

OK, so it seems that I can suppress this behaviour with the following config:

git:                                                                                                     
  autoFetch: false 

I'm renaming the issue again, then, as this seems like a bug in that it seems a wrong/empty(?) password gets submitted to SSH if keys are not loaded, which can causes firewalls/fail2ban to block the host using lg.

artfulrobot avatar Feb 09 '22 11:02 artfulrobot

i'm having the same issue. I guess i'm confused as to why it's happening. It doesn't prompt for password and immediately goes right to Enter passphrase for key... [email protected] Permission denied but never allows me to enter a password. I can then manually Push and pull just fine and enter password but after a few seconds it will immediately go back to that error again. I even made sure to do the git config --global user.email "[email protected]". can someone help? my key is knownhosts as well

umop3plsdn avatar Oct 06 '22 18:10 umop3plsdn

as soon as i start lazygit in a repo where remote is via ssh, fetching starts and the ui gets locked and messed up.

xenitane avatar May 23 '25 13:05 xenitane

as soon as i start lazygit in a repo where remote is via ssh, fetching starts and the ui gets locked and messed up.

I have reproduced this it tries to use git merge tool.

Eveeifyeve avatar Jun 18 '25 14:06 Eveeifyeve

as soon as i start lazygit in a repo where remote is via ssh, fetching starts and the ui gets locked and messed up.

I have reproduced this it tries to use git merge tool.

This was a regression that we had in 0.51; it should be fixed in 0.51.1. The current version is 0.52. @Eveeifyeve Which version are you using?

stefanhaller avatar Jun 18 '25 15:06 stefanhaller

Oh okay, well I should update. Still on 0.51.0.

Eveeifyeve avatar Jun 18 '25 15:06 Eveeifyeve