Skip to content

Add gist FS #888

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

Closed
martindurant opened this issue Jan 13, 2022 · 3 comments
Closed

Add gist FS #888

martindurant opened this issue Jan 13, 2022 · 3 comments

Comments

@martindurant
Copy link
Member

We have a github implementation, which I find surprisingly convenient. We should also do one for gists, which also have a reasonable API https://docs.github.com/en/rest/reference/gists . We could mirror the github implementation and require user/gist_id, or only require user and auto list their gists (which have hex-like IDs, not sensible names). I tend towards the latter.
Within a gist you only have a single flat list of files.

"https://api.github.com/users/martindurant/gists" lists my gists, AND the files within each of them, giving size and URL to the raw download. The call can be optionally paginated.

@martindurant
Copy link
Member Author

(yes, you could view this as unnecessary, since you can always get the URL for a file in a given gist from the web interface)

@lmmx
Copy link
Contributor

lmmx commented Feb 16, 2025

This would be great and would allow downstream projects like Universal Pathlib to support it with minimal extra code.

I've recently used UPath to make octopolars, remarkably simply!

I don't view this as unnecessary, it's a very reasonable extension from GitHub and would showcase the fsspec stable nicely.

lmmx added a commit to lmmx/filesystem_spec that referenced this issue Feb 16, 2025
@lmmx
Copy link
Contributor

lmmx commented Feb 16, 2025

I implemented it! :-)

import fsspec

gist_id = "c6ed259a32957069b4a39bf9e40becae"
print("Gist ID:", gist_id)
fs = fsspec.filesystem("gist", gist_id=gist_id)
file_list = fs.ls("")
print("Files in the Gist (via fsspec):", file_list)
(filesystem_spec) louis 🌟 ~/dev/filesystem_spec $ python ~/lab/fsspec/gist.py 
Gist ID: c6ed259a32957069b4a39bf9e40becae
Files in the Gist (via fsspec): ['1-cad.md', '2-cad.md', '3-cad.md', '4-cad.md', '5-cad.md']

lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
lmmx added a commit to lmmx/filesystem_spec that referenced this issue May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants