Skip to main content

py9p

Pythonic 9P2000 messages and client helpers backed by plan9port's C wire codec. The Python API is intentionally small: dataclasses model the protocol, to_bytes() uses the native codec, and Client gives scripts a synchronous multiplexed request/response wrapper.

Quick API

from py9p import Tversion, Twalk, decode_message

wire = Tversion(msize=8192).to_bytes()
assert decode_message(wire) == Tversion(msize=8192)

walk = Twalk(fid=0, newfid=1, wname=("usr", "glenda", "notes"))
assert decode_message(walk.to_bytes()) == walk

Stats are first-class dataclasses too:

from py9p import DMDIR, DMEXEC, DMREAD, Dir, Qid

entry = Dir(
    qid=Qid(type=0x80, vers=7, path=42),
    mode=int(DMDIR | DMREAD | DMEXEC),
    length=0,
    name="notes",
    uid="glenda",
    gid="glenda",
    muid="glenda",
)
assert Dir.from_bytes(entry.to_bytes()) == entry

For real transports, use the synchronous multiplexed client:

from py9p import Client, OREAD

with Client.connect_tcp("127.0.0.1", 564) as c:
    c.negotiate()
    c.attach(fid=0, uname="glenda")
    c.walk(fid=0, newfid=1, path="usr/glenda/notes")
    c.open(fid=1, mode=int(OREAD))
    data = c.read(fid=1, count=4096)
    c.clunk(fid=1)

You can drop down a level whenever you need exact protocol control:

from py9p import Rread, read_message, write_message

write_message(sock, Rread(tag=3, data=b"hello"))
msg = read_message(sock)

Client.rpc() manages tags by default. Pass tag=... only when you need a specific protocol tag for a low-level probe.

Scope

This first slice targets 9P2000 message and stat encoding/decoding plus a small synchronous client with multiplexed tagged RPC. It intentionally does not implement auth helpers, server dispatch, namespace/exportfs orchestration, or 9P2000.u extensions. Those belong in higher-level tools built on this protocol layer.

The native library is built from the vendored plan9port converters: convM2S, convS2M, convM2D, and convD2M. py9p adds only a small C shim with fixed-width structs so Python does not depend on plan9port's internal C struct ABI.

Development

(cd vendor && ./build.sh)
python -m pytest

The full local gate mirrors py-libtab's style:

./run-all-tests.sh
./run-all-tests.sh all

Release

The PyPI distribution name is python-9p; the import package remains py9p.

Releases are built by .github/workflows/publish.yml. Configure PyPI Trusted Publishing with:

  • PyPI project: python-9p
  • Owner: kiljoy001
  • Repository: py-9p
  • Workflow: publish.yml
  • Environment: pypi

Publishing runs only for version tags:

git tag v0.1.0
git push origin v0.1.0

Release files for python-9p 0.1.0

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

Source distribution (sdist)

Source distribution for python-9p 0.1.0
File Size Uploaded
python_9p-0.1.0.tar.gz 61.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-9p 0.1.0
File
python_9p-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
python_9p-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
python_9p-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
python_9p-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details

Total release size: 167.0 kB

Release files / python_9p-0.1.0.tar.gz

Download URL python_9p-0.1.0.tar.gz
Size 61.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1745afb66ceec45cfaa3568ef1adf8b570d55b807355a5a2a314ee4de9b84a6f
BLAKE2b-256 checksum
How to use checksums
b70304584d9feddf44b5ec062277ff5624add55d9c0e4ad6f7f90f0ea09e7541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / python_9p-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL python_9p-0.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 26.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ef3795e4d71c25ec45dbbb24bcc537b68e5bd892496ad098b058435703228dc8
BLAKE2b-256 checksum
How to use checksums
facc2a822dff113618d4b9683e0f0d8a2863d21bcdeea1b1e8de62694357fc1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / python_9p-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL python_9p-0.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 26.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b9b6537474bea183b08895a3bdbea775f39c8758ca1fcee608c717733f73f816
BLAKE2b-256 checksum
How to use checksums
929d0824ad8388e6a6cde961530e0b776fc44f692757f34009bdae529973f25e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / python_9p-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL python_9p-0.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 26.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f28ab0e39b05d7f1be2aafeafd4e7e557a399ca5133488e24cc742580aa5c1b7
BLAKE2b-256 checksum
How to use checksums
4799ceb93762ead149a73ac5deb1c6ba427e76e05ba56c4b91b1580739cadea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release files / python_9p-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL python_9p-0.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 26.3 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e999a92f8f2ddc8cf163d84eb64e59c90f4411138dafe3375b88e0355a3107c4
BLAKE2b-256 checksum
How to use checksums
6bc8984c8626ecbbc06ba75a48e6236eec1968a90c8c685f7195dd173477cf87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 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