Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Google Drive Ocamlfuse | 4,870 | 2 months ago | 181 | mit | OCaml | |||||
FUSE filesystem over Google Drive | ||||||||||
Gcsf | 2,203 | 2 years ago | 21 | April 12, 2020 | 32 | mit | Rust | |||
a FUSE file system based on Google Drive | ||||||||||
Laravel Google Cloud Storage | 485 | 33 | 16 | 9 months ago | 15 | September 22, 2020 | 39 | mit | PHP | |
A Google Cloud Storage filesystem for Laravel | ||||||||||
Fuse Google Drive | 271 | 7 years ago | 18 | gpl-2.0 | C | |||||
A fuse filesystem wrapper for Google Drive. | ||||||||||
Gmusicfs | 158 | 7 years ago | 33 | Python | ||||||
A FUSE filesystem for Google Music | ||||||||||
Spreadsheetfs | 126 | 3 years ago | 1 | mit | Python | |||||
Use Google Sheets as a Filesystem to get Unlimited Free Cloud Storage | ||||||||||
Storage File Transfer Json Python | 80 | 6 years ago | 2 | apache-2.0 | Python | |||||
Uploads and downloads files between Google Cloud Storage and the local filesystem using the Google Python Client Library. | ||||||||||
Node Gdrive Fuse | 61 | 5 years ago | 16 | JavaScript | ||||||
This is a simple filesystem written in NodeJS to mount Google Drive as a local drive. | ||||||||||
Java Storage Nio | 51 | 37 | 31 | 5 days ago | 181 | April 19, 2022 | 7 | apache-2.0 | Java | |
Lrkfm | 47 | 5 days ago | 9 | mit | Java | |||||
Awesome, (ad) free, open source file manager for Android |
A Python filesystem abstraction of Google Cloud Storage (GCS) implemented as a PyFilesystem2 extension.
With GCSFS, you can interact with Google Cloud Storage as if it was a regular filesystem.
Apart from the nicer interface, this will highly decouple your code from the underlying storage mechanism: Exchanging the storage backend with an
in-memory filesystem for testing or any other
filesystem like S3FS becomes as easy as replacing gs://bucket_name
with mem://
or s3://bucket_name
.
For a full reference on all the PyFilesystem possibilities, take a look at the PyFilesystem Docs!
Install the latest GCSFS version by running:
$ pip install fs-gcsfs
Or in case you are using conda:
$ conda install -c conda-forge fs-gcsfs
Instantiating a filesystem on Google Cloud Storage (for a full reference visit the Documentation):
from fs_gcsfs import GCSFS
gcsfs = GCSFS(bucket_name="mybucket")
Alternatively you can use a FS URL to open up a filesystem:
from fs import open_fs
gcsfs = open_fs("gs://mybucket/root_path?project=test&api_endpoint=http%3A//localhost%3A8888&strict=False")
Supported query parameters are:
You can use GCSFS like your local filesystem:
>>> from fs_gcsfs import GCSFS
>>> gcsfs = GCSFS(bucket_name="mybucket")
>>> gcsfs.tree()
foo
bar
file1.txt
file2.csv
baz
file3.txt
file4.json
>>> gcsfs.listdir("foo")
["bar", "baz"]
>>> gcsfs.isdir("foo/bar")
True
Uploading a file is as easy as:
from fs_gcsfs import GCSFS
gcsfs = GCSFS(bucket_name="mybucket")
with open("local/path/image.jpg", "rb") as local_file:
with gcsfs.open("path/on/bucket/image.jpg", "wb") as gcs_file:
gcs_file.write(local_file.read())
You can even sync an entire bucket on your local filesystem by using PyFilesystem's utility methods:
from fs_gcsfs import GCSFS
from fs.osfs import OSFS
from fs.copy import copy_fs
gcsfs = GCSFS(bucket_name="mybucket")
local_fs = OSFS("local/path")
copy_fs(gcsfs, local_fs)
For exploring all the possibilities of GCSFS and other filesystems implementing the PyFilesystem interface, we recommend visiting the official PyFilesystem Docs!
To develop on this project make sure you have pipenv installed and run the following from the root directory of the project:
$ pipenv install --dev --three
This will create a virtualenv with all packages and dev-packages installed.
All CI tests run against an actual GCS bucket provided by Othoz.
In order to run the tests against your own bucket, make sure to set up a Service Account with all necessary permissions:
All five permissions listed above are e.g. included in the predefined Cloud Storage IAM Role roles/storage.objectAdmin
.
Expose your bucket name as an environment variable $TEST_BUCKET
and run the tests via:
$ pipenv run pytest
Note that the tests mostly wait for I/O, therefore it makes sense to highly parallelize them with xdist, e.g. by running the tests with:
$ pipenv run pytest -n 10
Credits go to S3FS which was the main source of inspiration and shares a lot of code with GCSFS.