-
Notifications
You must be signed in to change notification settings - Fork 363
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
Some implementations don't have same function signatures as base class #1100
Comments
I agree that the implementations should have the same defaults as each other, and that this default should be defined in the base class. There might be occasional cases where different defaults are appropriate for some given backend, but that should be rare and need justification. I expect much of our test suite is explicit about the optional arguments like So yes, we should fix it, but, as you say, this is a tricky thing to do without breaking downstream code. Listing the known instances in the description of this issue would be a great start. |
I'll make a list tomorrow(it's 12 pm in China), but if I remember it correctly, |
Methods that have a different default value:
Method that missed some parameters in the base class:
|
I think we should always keep the signature unchanged. Other implementations may add parameters, but they should not have fewer parameters or change their default value. If something isn't supported in some FS, the implementation should warn user that give value other than the default value. |
I agree; but it is plausible that at least some of those instances have correct signatures and defaults, but obfuscated in the kwargs. You are right that it would be better explicitly consistent. Your code looks like a useful addition and you might consider adding it in a test marked xfail (wouldn't mind seeing how it looks). See also #651 |
Just noting that this is related to issue #899. |
Hi, I noticed some implementations change the default value of some parameters, for example:
AbstractFilesystem
havedetail=True
inls
, howeverLocalFileSystem
havedetail=False
. (https://github.com/fsspec/filesystem_spec/blob/master/fsspec/spec.py#L301, https://github.com/fsspec/filesystem_spec/blob/master/fsspec/implementations/local.py#L56)This is inconsistent, for example, people may expect all filesystems to behave the same in
ls
operations. Also, aslistdir
just callsls
, if implementations changed the signature ofls
, calling it withlistdir
will use the default value specified inAbstractFileSystem
since it's defined there and implementations don't rewrite that. This behavior inconsistency already caused issues (for example, Lightning-AI/pytorch-lightning#3805).So I wrote a test to find out if there is any more inconsistency, and I found a lot. (https://github.com/leoleoasd/filesystem_spec/blob/master/fsspec/implementations/tests/test_common.py#L65, https://github.com/leoleoasd/filesystem_spec/actions/runs/3407906000/jobs/5667983849)
Is this a bug, should we fix it? The fix is definitely a breaking change and may cause some code to stop working. Maybe we should, first, find what implementation has different signatures, and warn users that use its default value about the change?
The text was updated successfully, but these errors were encountered: