nfs4fs
nfs4fs is a Linux fsspec implementation backed by
VFSI's vectorized NFSv4 and SMB2/3 clients.
Bulk fsspec operations are translated into protocol-native compounds, reducing
round trips for workloads with many small files.
Install
python -m pip install nfs4fs
Published wheels use CPython's stable ABI and support standard CPython 3.9 and newer on Linux x86-64 and AArch64. A separate CPython 3.14 free-threaded wheel is built and tested on x86-64. A source build additionally requires Rust, CMake, Clang, Git, Kerberos/GSS development headers, and userspace-RCU development headers. The extension statically links libntirpc and bundles non-platform shared-library dependencies into release wheels.
The package installs fsspec.specs entry points for both nfs4 and vfsi, so
normal use does not require import nfs4fs before calling fsspec.
NFSv4
Pass the server as an option or as the URL authority:
import fsspec
fs = fsspec.filesystem(
"nfs4",
host="nfs.example",
root="exports/project",
auto_mkdir=False,
)
fs.pipe({"/part-0": b"hello", "/part-1": b"world"})
parts = fs.cat(["/part-0", "/part-1"])
with fsspec.open("nfs4://nfs.example/exports/project/part-0", "rb") as file:
print(file.read())
The client negotiates NFSv4.2 and falls back to NFSv4.1. Set
minor_version=1 or minor_version=2 to require a specific version. The
current NFS transport uses TCP and AUTH_SYS. Kerberos flavors are not yet
exposed by the Python package.
compound_size_limit caps the payload merged into one compound. The default is
1 MiB; lower it when a server has a smaller request limit:
fs = fsspec.filesystem(
"nfs4", host="nfs.example", compound_size_limit=256 * 1024
)
Connection setup and individual NFS RPCs are independently bounded. Defaults are 10 seconds and 5 seconds, respectively:
fs = fsspec.filesystem(
"nfs4",
host="nfs.example",
connect_timeout=5.0,
request_timeout=15.0,
)
SMB2/3
Use the protocol-neutral vfsi name and select the SMB backend explicitly:
fs = fsspec.filesystem(
"vfsi",
backend="smb",
host="samba.example",
share="data",
username="alice",
password="secret",
domain="WORKGROUP",
root="team-a",
)
fs.pipe_file("/hello.txt", b"hello over SMB")
print(hex(fs.smb_dialect()))
Empty credentials request guest access. SMB paths must be valid UTF-8. The SMB backend does not advertise Unix link or ownership semantics; capability-aware operations use following metadata where possible.
Do not embed credentials in URLs. Supply them as storage options or through
the normal fsspec configuration mechanisms, and avoid logging serialized
filesystem objects containing secrets.
Operations that vectorize
The largest benefit comes from giving fsspec multiple paths at once:
cat,cat_ranges, andopen_filesbatch reads;pipeandputbatch writes;- recursive
get,put,cp,rm, and tree walks use vector metadata and mutation operations; cp_file/copyuse NFSv4.2 or SMB server-side copy when available, with a client-side fallback.
minor_version(), capabilities(), server_copy_enabled(), smb_dialect(),
compound_stats(), and rpc_stats() are available on the native client for
feature inspection and diagnostics.
Production notes
- One filesystem instance owns one native session protected by a mutex.
Operations on that instance are serialized. Use separate instances with
skip_instance_cache=Truewhen independent connections are required. - Native calls release the CPython interpreter lock while waiting for storage. The extension also declares free-threaded CPython support; each filesystem's native-session mutex still serializes that instance.
- On a transport failure, safe idempotent path reads reconnect and retry once
by default. Mutations are never replayed automatically because the server may
already have completed an ambiguously failed request. Set
auto_reconnect=Falseto disable automatic read recovery. - A process fork is detected before the next operation and creates a fresh
native session in the child without sending protocol teardown over the
parent's inherited connection. Do not fork while an operation is in flight
or share an already-open
Nfs4Fileacross a fork. Once application or RPC helper threads exist, use multiprocessing'sspawnmethod. Prefer creating filesystem instances after worker processes start. - Call
close()or usewith fsspec.filesystem(...) as fs:to release the native session deterministically. Closing also removes the instance from fsspec's instance cache. exists,isfile, andisdirreturnFalsefor missing paths but propagate authentication and connectivity failures. This prevents outages from being mistaken for absent data.auto_mkdirisFalseby default. Enable it only when write operations are allowed to create missing parents.rootrejects.and..components. Use it to keep all paths under an export- or share-relative prefix; it is not a substitute for server-side authorization.- Vector batches are bounded by both
batch_size(128 items) andmax_batch_bytes(64 MiB). Files larger than that byte threshold stream intransfer_chunk_sizechunks (8 MiB). Tune these per server and workload; every value must be positive. - Transaction writes use a disk-backed spool after
transaction_spool_threshold(8 MiB), upload to unpredictable temporary names in each destination directory, then expose the batch with a vectorized rename. This prevents partial file contents from becoming visible. Like fsspec transactions generally, a multi-file commit is staged rather than a server-wide atomic transaction: a server failure during the final rename batch can expose a prefix of the batch. pipe_file(..., mode="create")and create-modeputuse an exclusive server create, so concurrent creators cannot silently overwrite one another.
Local development
On Ubuntu/Debian:
sudo apt-get install clang libclang-dev cmake pkg-config \
libkrb5-dev libgssglue-dev liburcu-dev
python -m venv .venv
.venv/bin/pip install maturin fsspec pytest
cd python
../.venv/bin/maturin develop
../.venv/bin/python -m pytest tests
Tests use the local dummy backend unless NFS/SMB integration variables are provided. CI runs the same suite against NFSv4.1, NFSv4.2, patched server-side COPY, SMB 2.1 guest access, and authenticated SMB 3.1.1.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nfs4fs-0.2.0.tar.gz.
File metadata
- Download URL: nfs4fs-0.2.0.tar.gz
- Upload date:
- Size: 244.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd3b4e98637d33bb619b131b2634a0e27b5d0263fc795346bbb92a28675184c4
|
|
| MD5 |
7652c690d23892021ed6ad59508839fd
|
|
| BLAKE2b-256 |
cfae51abb348d5651b31b377d9274372d7b447b1e0640f8dc27a9f1adf39b94c
|
Provenance
The following attestation bundles were made for nfs4fs-0.2.0.tar.gz:
Publisher:
python-release.yml on vmingchen/vnfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfs4fs-0.2.0.tar.gz -
Subject digest:
fd3b4e98637d33bb619b131b2634a0e27b5d0263fc795346bbb92a28675184c4 - Sigstore transparency entry: 2775765420
- Sigstore integration time:
-
Permalink:
vmingchen/vnfs@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Branch / Tag:
refs/tags/nfs4fs-v0.2.0 - Owner: https://github.com/vmingchen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nfs4fs-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nfs4fs-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.4 MB
- Tags: CPython 3.14t, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9ec417f5234ef0b1c4ece3bb7bfd463f6d1c9a6b5ae4da51c7d08e7fa50125c
|
|
| MD5 |
6f8f2fbb2ae5c2ad54a394b42f5f7378
|
|
| BLAKE2b-256 |
918b2a428d2e3d0969a1c8de5a160dadbd0c71c9b45c4caad65fadd0907cd31d
|
Provenance
The following attestation bundles were made for nfs4fs-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl:
Publisher:
python-release.yml on vmingchen/vnfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfs4fs-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl -
Subject digest:
d9ec417f5234ef0b1c4ece3bb7bfd463f6d1c9a6b5ae4da51c7d08e7fa50125c - Sigstore transparency entry: 2775765616
- Sigstore integration time:
-
Permalink:
vmingchen/vnfs@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Branch / Tag:
refs/tags/nfs4fs-v0.2.0 - Owner: https://github.com/vmingchen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce7054ecbc84f4a68ed460e5ae7ad6a68144aae6b16f497ed72e4d9efed7357b
|
|
| MD5 |
8e84406708049c1e4c20239cd1e6283a
|
|
| BLAKE2b-256 |
f57854da86e4245e7aa071f439b47d130c8373f13a21d9e6ade15b4645f71e6a
|
Provenance
The following attestation bundles were made for nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl:
Publisher:
python-release.yml on vmingchen/vnfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
ce7054ecbc84f4a68ed460e5ae7ad6a68144aae6b16f497ed72e4d9efed7357b - Sigstore transparency entry: 2775765697
- Sigstore integration time:
-
Permalink:
vmingchen/vnfs@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Branch / Tag:
refs/tags/nfs4fs-v0.2.0 - Owner: https://github.com/vmingchen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98fafed9f49e49ef51068230eac093607bcd73f723e2156092e7257a8264aa1d
|
|
| MD5 |
2455dc663a4a4d0b5f11224ffc362c9f
|
|
| BLAKE2b-256 |
e19687a529295e119ddcca519a2bb236462ca0f796d6aa8d1a91903bbd69a9f7
|
Provenance
The following attestation bundles were made for nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl:
Publisher:
python-release.yml on vmingchen/vnfs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfs4fs-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
98fafed9f49e49ef51068230eac093607bcd73f723e2156092e7257a8264aa1d - Sigstore transparency entry: 2775765520
- Sigstore integration time:
-
Permalink:
vmingchen/vnfs@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Branch / Tag:
refs/tags/nfs4fs-v0.2.0 - Owner: https://github.com/vmingchen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@bd6b36946c24384f42043ff7cb9545f7790c29f6 -
Trigger Event:
push
-
Statement type: