pidfd
Dependency-free Python bindings for Linux pidfds. A pidfd is a file descriptor referring to a process: a stable handle that can never hit a recycled pid, becomes readable when the task exits, can be waited on with waitid(2), and can duplicate the task's file descriptors with pidfd_getfd(2). Everything goes through pidfd_open(2), pidfd_send_signal(2), pidfd_getfd(2) and waitid(2) via ctypes. There are no runtime dependencies.
Requires Python 3.10+ and Linux.
Install
pip install pidfd
Usage
import select, signal, subprocess
from pidfd import PidFd, WaitCode
proc = subprocess.Popen(["sleep", "30"])
with PidFd.open(proc.pid) as pf:
# poll(2) reports the fd readable once the task is a zombie
pf.signal(signal.SIGKILL)
poller = select.poll()
poller.register(pf.fileno(), select.POLLIN)
poller.poll()
result = pf.wait() # waitid(P_PIDFD)
assert result.code == WaitCode.CLD_KILLED
PidFd.open(pid, OpenFlag.NONBLOCK) makes wait() fail with EAGAIN
instead of blocking. pf.getfd(fd) duplicates one of the target's open
fds (ptrace access rules apply).
Development
uv sync --group dev
make check
License: 0BSD. Quad4 Software, https://quad4.io
Metadata
Release files for pidfd 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pidfd-0.1.0.tar.gz | 67.1 kB | With provenance | Details for pidfd-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pidfd-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pidfd-0.1.0-py3-none-any.whl |
Total release size: 75.4 kB
Release files / pidfd-0.1.0.tar.gz
| Download URL | pidfd-0.1.0.tar.gz |
|---|---|
| Size | 67.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea4967821d33fff7800b8a3fa9a1ef4e295803bdd9430e7bdb20210b1b35d807
|
|
BLAKE2b-256 checksum How to use checksums |
31b89dddd88627eebf0e844539e509804bff343a458779bec62de7e8423f0125
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / pidfd-0.1.0-py3-none-any.whl
| Download URL | pidfd-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
675838ea1461068e2c19017354b5db711b69f73936c6d553a9e2ed6b013dd616
|
|
BLAKE2b-256 checksum How to use checksums |
e1d167e9c84a5db7417b866fd006ace3754b04a56e478a3c6bde74fecff90572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logSecurity for pidfd 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pidfd-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.