gcsfs

A Pythonic filesystem interface to Google Cloud Storage, built on fsspec

SDK
PyPI
v2026.8.0
395stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity100
Maintenance72
Community84
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality82
Innovation76
Learning Curve78

gcsfs gives Python code a familiar, file-system-like interface to Google Cloud Storage (GCS), letting you read, write, and list objects in a bucket as if they were local files and directories. Built on top of the fsspec framework, it plugs directly into the wider PyData ecosystem (pandas, Dask, xarray, Zarr) so any tool that already understands fsspec-style paths can transparently read from or write to gcs:// URLs without bespoke integration code.

Beyond basic file operations, gcsfs handles authentication (default gcloud credentials, service-account keys, anonymous access, or the metadata server), async I/O via aiohttp for high-concurrency workloads, and newer GCS features like Hierarchical Namespace buckets (atomic renames, higher QPS) and zonal Rapid Buckets for low-latency ML training pipelines. It is maintained under the fsspec GitHub organization and used heavily in data engineering and ML infrastructure where GCS is the backing object store.

What You Get

  • A GCSFileSystem class implementing the full fsspec AbstractFileSystem API (ls, open, glob, walk, exists, rm, mkdir) against GCS buckets
  • Multiple authentication modes: default gcloud/service-account credentials, anonymous access, explicit token dicts, or the GCE metadata service
  • Async support via aiohttp for high-concurrency reads/writes, including a synchronous wrapper for use in non-async code
  • Built-in support for GCS Hierarchical Namespace buckets (atomic directory renames, higher QPS) and zonal Rapid Buckets with true append support
  • Caching and prefetching layers for efficient sequential and random-access reads of remote objects
  • Direct interoperability with pandas, Dask, Zarr, and any other library built on fsspec’s URL-chaining conventions

Common Use Cases

  • Reading and writing pandas/Dask dataframes directly from gcs://bucket/path without manually calling the GCS client SDK
  • Backing ML training pipelines and checkpointing with GCS, particularly on Hierarchical Namespace or Rapid buckets for low-latency access
  • Building data lake / ETL pipelines that treat a GCS bucket as a mounted, POSIX-like filesystem
  • Mounting GCS buckets as local filesystems via FUSE for tools that require true file paths
  • Streaming large objects (logs, model artifacts, datasets) into memory-constrained environments using gcsfs’s caching strategies

Under The Hood

Architecture - The core of gcsfs is gcsfs/core.py (~2,800 lines), which implements GCSFileSystem on top of fsspec’s AsyncFileSystem base class, translating filesystem calls (ls, open, glob, rm) into GCS JSON API requests. extended_gcsfs.py layers Hierarchical Namespace and Rapid Bucket-specific behavior (atomic renames, true appends) on top of the base implementation, while _dircache.py, caching.py, and prefetcher.py handle directory listing caches and read-ahead buffering to cut down on redundant network round trips; credentials.py centralizes the several supported auth flows. Tech Stack - Built for Python 3.10+ using aiohttp for async HTTP, google-auth/google-auth-oauthlib for credentials, and google-cloud-storage/google-cloud-storage-control as the underlying GCS client dependencies, with fsspec as the abstract filesystem base it implements against; packaging uses hatchling with hatch-vcs for version derivation from git tags. Code Quality - The gcsfs/tests directory contains close to 20 test modules covering core filesystem operations, caching, credentials, retries, concurrency, and the newer HNS/zonal extensions, indicating strong ongoing test discipline; the codebase is typed incrementally and uses flake8/isort for style enforcement in CI. API Design - The library deliberately mirrors Python’s built-in file and os module conventions (fs.open, fs.ls, fs.glob) so existing fsspec-aware code can point at gcs:// paths with almost no changes, which is the primary ergonomic win over using the raw google-cloud-storage client directly.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search