This is a fork of 45Drives/python3-libzfs
(taken at commit 08e8778),
which is itself a packaging fork of truenas/py-libzfs.
Why this fork exists: the base does not build on my Ubuntu 26.04 (Python 3.14, Cython 3.x, OpenZFS 2.4.1). This fork adds one fix commit on top that makes it cythonize, compile, and run correctly there. No features or behaviour are changed.
What changed (summary):
- Cython 3.x GIL/exception model — added
noexceptto thecdef nogilC callbacks (zfs_iter_f,zpool_iter_f,zprop_func, thezfs_userspace_cb_timpl); Cython 3 rejects nogil callbacks without an explicit exception spec. children/snapshots/bookmarksiteration onZFSDatasetnow resolves the inheritedZFSResource.__iteratecallback into a local before thewith nogil:block, instead of referencingself.__iterateinside it — Python name-mangling across the class hierarchy made that fall through to a GIL-requiring lookup, which Cython 3 rejects.- Python 2 leftovers — the removed
longbuiltin replaced withint. - OpenZFS 2.4.1 header drift —
.pxdexterns and call sites updated for addedconstqualifiers (nvpair_value_string*,zpool_get_status,nvlist_add_*_array),zpool_add's newcheck_ashiftparameter (call site passesFalseto keep prior behaviour), and thezfs_userspace_cb_tcallback's newdefault_quotaparameter (accepted and ignored, as before).
Full reasoning for every change is in CHANGES.md. Files touched:
libzfs.pyx, nvpair.pxi, pxd/libzfs.pxd, pxd/nvpair.pxd.
Licensing is unchanged: BSD-2-Clause, per LICENSE. The fix commit is offered
under the same license as the files it modifies.
Everything below this line is the upstream README, unchanged.
Python bindings for libzfs
py-libzfs is a fairly straight-forward set of Python bindings for libzfs for ZFS on Linux and FreeBSD.
INSTALLATION
./configure && make install
FEATURES:
- Access to pools, datasets, snapshots, properties, pool disks
- Many others!
QUICK HOWTO:
import libzfs
Get a list of pools:
pools = list(libzfs.ZFS().pools)
Get help:
help(libzfs)