You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we want a CLI that is similar to git in the sense that we must first call init before interacting with the repo. For this, we aim for the following (simplified/partially implemented) class, which is intentionally similar to GitPythons Repo class (see here):
When we run the command python something_like_git.py init, it first tries to instantiate the class via __init__, which fails (FileNotFoundError) since it must first create the directory via init.
I think it makes generally more sense if Fire would call classmethods/staticmethods directly on the class without trying to instantiate it. This is usually also how class/static methods are used in a programmatic way (e.g. for git.Repo).
Note that the fix for #113 does not resolve this issue. This is because the path argument for __init__ is (intentionally) optional, so Fire thinks it can call __init__ first. If path wasn't optional, it would behave as wanted: init would be called without first calling __init__.
Anyway, thanks for your great work!
The text was updated successfully, but these errors were encountered:
Suppose we want a CLI that is similar to
git
in the sense that we must first callinit
before interacting with the repo. For this, we aim for the following (simplified/partially implemented) class, which is intentionally similar toGitPython
sRepo
class (see here):When we run the command
python something_like_git.py init
, it first tries to instantiate the class via__init__
, which fails (FileNotFoundError) since it must first create the directory viainit
.I think it makes generally more sense if Fire would call classmethods/staticmethods directly on the class without trying to instantiate it. This is usually also how class/static methods are used in a programmatic way (e.g. for
git.Repo
).Note that the fix for #113 does not resolve this issue. This is because the
path
argument for__init__
is (intentionally) optional, so Fire thinks it can call__init__
first. Ifpath
wasn't optional, it would behave as wanted:init
would be called without first calling__init__
.Anyway, thanks for your great work!
The text was updated successfully, but these errors were encountered: