Skip to main content

hdfs-s3-gateway (Python)

Python bindings for the HDFS → S3 read-only gateway. This package wraps the Rust gateway so it can be driven from Python either as a foreground blocking call or as an in-process background server.

Usage

from hdfs_s3_gateway import Gateway

# Background server (no subprocess — runs on its own native thread + tokio runtime).
gw = Gateway(namenode_uri="hdfs://localhost:8020", hdfs_root="/data", bucket_name="hdfs")
gw.start()
print(gw.address)   # e.g. "127.0.0.1:8080"
# ... point any S3 client at the endpoint ...
gw.stop()           # graceful shutdown

# Or as a context manager:
with Gateway(config_path="gateway.toml") as gw:
    print(gw.address)
    # ... use the endpoint ...

The gateway performs no authentication by default — it must run behind network-level access control. See the top-level project README for the full security posture. You can optionally enable SigV4 auth by passing auth_secret="..." to Gateway(...) (or the --auth-secret CLI flag / auth_secret TOML key). When set, a valid signature is required (unsigned requests are rejected, wrong secret → 403 SignatureDoesNotMatch), so clients use normal signing (any access-key id + that secret) instead of anonymous / aws_skip_signature. When unset (the default), the gateway accepts both anonymous and signed requests.

Reading data through the gateway

Once the gateway is running, point any S3 client at its endpoint. The examples below assume the gateway was started with hdfs_root="/data" and bucket_name="hdfs", exposing a hive-partitioned table at s3://hdfs/seed_parquet/country=us/year=2021/data.parquet.

By default all clients use anonymous / unsigned access (the gateway has no auth). The endpoint is http://<gw.address> — e.g. http://127.0.0.1:39111. If you started the gateway with auth_secret, drop the anonymous / aws_skip_signature flags and pass any access-key id plus that secret instead.

polars

import polars as pl

ep = f"http://{gw.address}"
so = {
    "aws_skip_signature": "true",
    "aws_endpoint_url": ep,
    "aws_allow_http": "true",
}
# Whole directory tree (hive partition columns are recovered automatically):
df = pl.read_parquet(f"s3://hdfs/seed_parquet/", storage_options=so)
# Or a recursive glob (polars expands it client-side into S3 listings):
df = pl.read_parquet(f"s3://hdfs/seed_parquet/country=*/year=*/*.parquet", storage_options=so)

DuckDB

import duckdb

ep = f"http://{gw.address}"
host = ep.replace("http://", "")
duckdb.sql("INSTALL httpfs; LOAD httpfs;")
duckdb.sql(f"SET s3_endpoint='{host}';")
duckdb.sql("SET s3_use_ssl=false;")
duckdb.sql("SET s3_access_key_id='';")
duckdb.sql("SET s3_secret_access_key='';")
duckdb.sql("SET s3_session_token='';")
duckdb.sql("SET s3_url_style='path';")

# DuckDB's httpfs reads a directory tree via a recursive glob:
df = duckdb.sql("SELECT * FROM read_parquet('s3://hdfs/seed_parquet/**')").df()

pandas (pyarrow engine)

import pandas as pd

ep = f"http://{gw.address}"
so = {
    "anon": "true",
    "endpoint_url": ep,
    "client_kwargs": {"endpoint_url": ep},
}
# pandas delegates s3:// URIs to fsspec/s3fs, not pyarrow's native S3 filesystem.
df = pd.read_parquet("s3://hdfs/seed_parquet/", storage_options=so)

pandas (s3fs / fsspec engine)

import pandas as pd

ep = f"http://{gw.address}"
so = {
    "anon": "true",
    "endpoint_url": ep,
    "client_kwargs": {"endpoint_url": ep},
}
df = pd.read_parquet("s3://hdfs/seed_parquet/", storage_options=so)

pyarrow (native S3FileSystem)

import pyarrow.dataset as ds
import pyarrow.fs as pafs

ep = f"http://{gw.address}"
host = ep.replace("http://", "")
s3 = pafs.S3FileSystem(anonymous=True, endpoint_override=host, scheme="http")
# pyarrow wants a "bucket/key" path, not a full s3:// URI.
dataset = ds.dataset("hdfs/seed_parquet", format="parquet", filesystem=s3, partitioning="hive")
table = dataset.to_table()

Note on path forms. Only polars and DuckDB expand glob patterns (country=*/year=*) client-side into real S3 listings; the other engines pass the glob literally to the gateway, which cannot match it. For a whole partitioned table, use the directory form (s3://hdfs/seed_parquet/).

Release files for hdfs-s3-gateway 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hdfs-s3-gateway 0.2.2
File Size Uploaded
hdfs_s3_gateway-0.2.2.tar.gz 227.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for hdfs-s3-gateway 0.2.2
File
hdfs_s3_gateway-0.2.2-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Details
hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Details
hdfs_s3_gateway-0.2.2-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
hdfs_s3_gateway-0.2.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
hdfs_s3_gateway-0.2.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 36.2 MB

Release files / hdfs_s3_gateway-0.2.2.tar.gz

Download URL hdfs_s3_gateway-0.2.2.tar.gz
Size 227.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7a1553e0eda4d529ac8a9c414d985a218f18d49ab403b0069cc20825b06cd818
BLAKE2b-256 checksum
How to use checksums
11b34b8062090e881628149c9e9e50ec2a9011ee0a9cfefde564510b2726f533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp314-cp314t-win_amd64.whl

Download URL hdfs_s3_gateway-0.2.2-cp314-cp314t-win_amd64.whl
Size 4.3 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
9edf121078ce890e1cd3967f9ef5e0dd26f17c030096957b2c246d58daa0fb12
BLAKE2b-256 checksum
How to use checksums
188f45281565fbb81e7cd0d2e7be590c9e86d18e28d86045d7fa08fb8c0c7d8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.9 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1b563b3ed4a18cffe5ba03f0d733a7cdb34f8716f3e25add647e943fe80aa8f4
BLAKE2b-256 checksum
How to use checksums
bf6c9f272e4011b3d2317f582bf582d8aac2b12551de6d4c042d9aef9a7d7e99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hdfs_s3_gateway-0.2.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.0 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
37bde0bf8090ae25eec0d34b88ef74510479cbcee7c233f7903ec91d7d6ab7fd
BLAKE2b-256 checksum
How to use checksums
d002f320034ffbe39ec45f01563323051d9f746926811397d5ac2aee01cde1d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp314-cp314t-macosx_11_0_arm64.whl

Download URL hdfs_s3_gateway-0.2.2-cp314-cp314t-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
72924756cbc4e3261531c0d8e8c8a6386cc40a150db3fbeffe7d85a768d25c7a
BLAKE2b-256 checksum
How to use checksums
f8605d98737e42fb9b4bdcc9260c633c689ff26ac3b7fb839df8b9640ed96d2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp310-abi3-win_amd64.whl

Download URL hdfs_s3_gateway-0.2.2-cp310-abi3-win_amd64.whl
Size 4.3 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
719339550300bac9072e81849988a22a6212d4c85b7582f2d17d11af55b4fe41
BLAKE2b-256 checksum
How to use checksums
dfef7e3a4500210898214c828d6055112d64b5cb45a27c3cba1d70bb19f06d5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
143b727c0878000ac88d04772b90e24496233daeed4b8a10378d0f221ab96a2e
BLAKE2b-256 checksum
How to use checksums
485862cd45f5daba6f5cc728d9edd8a6063fd42c417d650b3bd529a27900f9d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hdfs_s3_gateway-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.0 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5898bd744781dfeaced93a7bb20aab9d636734c45e6168db1ab9b22a26b18de2
BLAKE2b-256 checksum
How to use checksums
cc5ea60e092eb288c62c5e58f0df09f2f1ad8a08f4dccd2878fac4427fdf5600
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hdfs_s3_gateway-0.2.2-cp310-abi3-macosx_11_0_arm64.whl

Download URL hdfs_s3_gateway-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea23fc8a0f4390bedfc3c1f43ed66bcec0967e860ee29c85dc8281e0bdec85e0
BLAKE2b-256 checksum
How to use checksums
ad0275d88984813f9ab57444f6c1c612b528ee9d15aa9c5301fda4ca7c1a9019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.3

9 release files

This release

0.2.2 This release

9 release files

0.2.1

9 release files

0.2.0

9 release files

0.1.2

9 release files

0.1.1

9 release files

0.1.0

11 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page