filesystem_spec icon indicating copy to clipboard operation
filesystem_spec copied to clipboard

Feature request: classmethod returning possible keys of the details=True dictionary for each filesystem.

Open phil65 opened this issue 1 year ago • 2 comments

I have written a Qt ItemModel for fsspec, what is tricky though is that there is no way to know which keys the "details" dictionary can contain for each filesystem (I would like to show a dedicated column for each details key, depending on filesystem) It would be nice to have some classmethod for each FileSystem class which returns all possible keys for the details dictionary.

Example: This is what i have right now for github filesystem: image I have to hardcode in my code though that github filesystem offers "Size", "Type", "Permissions" etc.

Link to code

Thank you for all the work!

phil65 avatar Jul 01 '23 19:07 phil65

I'm not sure we are in a position to guarantee what information might be given by backends and try to be consistent across all of them. The only guarantee is the name, size and filetype. For the github example, we are passing through what is provided by their API, so it might change at any time, and might not always have the same fields for every call (I don't know). Other backends like S3 have various metadata and version fields that may or may not be present. I suppose it might be reasonable for someone to try to enumerate all thew possibilities in all backends, but that would amount to the same work as you are already doing to hard-code fields.

martindurant avatar Jul 04 '23 15:07 martindurant

Ok, I see. Would still be nice to have some kind of guideline for the backends which information should be put behind which key, but for now I will just do the manual work. Thank you.!

phil65 avatar Jul 04 '23 19:07 phil65