Canovice
Canovice

Reputation: 10163

For Python, "import gcsfs" or "from google.cloud import storage" to interact with GCS

Some old code we are making sense of is importing and using both of these libraries. It seems like both are used for connecting to GCS buckets and reading from / writing to buckets.

# GCS Library
import gcsfs # which of these...
from google.cloud import storage # ...is better?

Are both of these libraries maintained, or is 1 considered the better, official python library for interacting with GCS?

Upvotes: 2

Views: 6392

Answers (1)

Right leg
Right leg

Reputation: 16720

The google-cloud-storage (that you import via from google.cloud import storage) is the library recommended by Google in their docs. Likewise, in the repo's readme of that library is stated:

The maintainers of this repository recommend using Cloud Client Libraries for Python, where possible, for new code development

Which is where you'll find the repo for google-cloud-storage.

On the other hand, gcsfs's doc states:

This software is beta, use at your own risk.

It seems like google-cloud-* libraries are the recommended, official way to go.

Upvotes: 3

Related Questions