Skip to main content

P4Rust

Safe Rust bindings to the Perforce 2026.1 C++ API. Precompiled resources support Windows MSVC, Linux GNU, and macOS on x64 and ARM64. Consumers compile only Rust.

Published Packages

Language Link Compatibility
Rust crates.io Windows MSVC, Linux GNU (glibc 2.28+), macOS 12+; x64 and ARM64. Consumers compile only Rust.
Python PyPI CPython 3.9+ (cp39-abi3), including free-threaded CPython 3.15+ (cp315-abi3.abi3t); Windows, Linux (glibc 2.28+), macOS 12+; x64 and ARM64.

Rust

[dependencies]
p4rust = "0.1"
use p4rust::{Client, Config, Event, Result, ResultExt};

// Stream file records, progress, and command completion.
fn main() -> Result<()> {
    let client = Client::new(Config::new("localhost:1666", "user", "workspace"))
        .context("Failed to create client")?;
    let events = client
        .command("sync")
        .args(["D:/workspace/file.txt"])
        .run()
        .context("Failed to start sync")?;

    for event in events {
        match event.context("Failed to sync file")? {
            Event::Record(record) => {
                for (key, value) in record.fields() {
                    println!("{key}: {value}");
                }
            }
            Event::Progress(progress) => {
                println!(
                    "{:?}: {}/{}",
                    progress.kind, progress.current, progress.total
                );
            }
            Event::Message(message) | Event::HandleError(message) => {
                println!("{}", message.text);
            }
            event => println!("{event:#?}"),
        }
    }
    Ok(())
}

run() streams events; collect_output() collects results. Configure input, timeout, and cancellation on the builder.

Tagged records use the SDK's standard accumulation and are emitted once complete. Intermediate cumulative snapshots are not copied into the event stream.

Use FastReconcile for parallel local processing.

let events = client
    .command("reconcile")
    .args(["-n", "-m", "D:/workspace/..."])
    .reconcile_handler(
        p4rust::FastReconcile::new()
            .metadata_workers(8)
            .digest_workers(4)
            .move_workers(4),
    )
    .run()
    .context("Failed to start reconcile")?;

for event in events {
    println!("{:#?}", event.context("Failed to reconcile")?);
}

-n previews changes; -m checks timestamps before contents; -M enables move detection.

Python

Install p4rust from PyPI with pip install p4rust. Wheels support ordinary CPython 3.9+ and free-threaded CPython 3.15+ on the same six platforms. Public APIs include complete typing and preserve native message codes, bytes, progress, and completion status. The Python ZIP is also available from GitHub Releases.

from p4rust import Client, Config, RecordEvent

client = Client(Config("localhost:1666", "user", "workspace"))
events = (
    client
    .command("files")
    .args(["D:/workspace/..."])
    .timeout(30.0)
    .run()
)
with events:
    for event in events:
        if isinstance(event, RecordEvent):
            print(event.record.fields())

Use .input(form), .cancellation(token), or .reconcile_handler(FastReconcile()) before .run(). collect_output() collects the remaining stream; close() cancels a command.

Reusing a connection

Config::discover(cwd) in Rust and Config.discover(cwd) in Python resolve the SDK's environment, registry, and P4CONFIG defaults without a server connection. Discovered and explicit credentials are excluded from configuration debug output. Set password, ignore_file, or tagged on a configuration before creating its client; these settings are isolated per client and session. Use client.is_ignored(absolute_path) for the SDK's local ignore rules. Tagged and untagged clients own separate protocol connections.

client.command() opens an independent connection for each command. Use a session for sequential queries on one dedicated SDK thread:

with client.session() as session:
    with session.command("info").run() as events:
        output = events.collect_output()
    with session.command("files").args(["D:/workspace/..."]).run() as events:
        output = events.collect_output()

Rust callers use let session = client.session()?, then session.command(...) and session.close()?. A session opens its connection lazily and retains it between commands. A busy or closed session rejects new work immediately. Use independent commands or separate sessions for concurrency.

Stream cancellation, deadlines, output backpressure, and reconcile handlers remain command-local. A cancelled, failed, or disconnected native command discards its connection; a later command reconnects without replaying the failed operation. Closing a session cancels active work and requests cleanup on the owner thread without blocking the caller. Command builders and streams retain their session, and the last owner also requests cleanup when dropped.

Maintainers

xtask builds native resources and packages all six targets. GitHub Actions runs builds, Clippy, and Python typing checks, publishes changed crates.io versions and Python wheels to PyPI, and releases separate Rust and Python ZIPs.

Metadata

Release files for p4rust 0.1.19

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

Built distributions (wheels)

Table of built distributions (wheels) for p4rust 0.1.19
File Actions
p4rust-0.1.19-cp315-abi3.abi3t-win_arm64.whl CPython 3.15 abi3t, abi3 Windows ARM64 Details for p4rust-0.1.19-cp315-abi3.abi3t-win_arm64.whl
p4rust-0.1.19-cp315-abi3.abi3t-win_amd64.whl CPython 3.15 abi3t, abi3 Windows x86-64 Details for p4rust-0.1.19-cp315-abi3.abi3t-win_amd64.whl
p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl CPython 3.15 abi3, abi3t Linux glibc 2.28+ x86-64 Details for p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl CPython 3.15 abi3, abi3t Linux glibc 2.28+ ARM64 Details for p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_x86_64.whl CPython 3.15 abi3t, abi3 macOS 12.0+ x86-64 Details for p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_x86_64.whl
p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_arm64.whl CPython 3.15 abi3t, abi3 macOS 12.0+ ARM64 Details for p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_arm64.whl
p4rust-0.1.19-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details for p4rust-0.1.19-cp39-abi3-win_arm64.whl
p4rust-0.1.19-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for p4rust-0.1.19-cp39-abi3-win_amd64.whl
p4rust-0.1.19-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for p4rust-0.1.19-cp39-abi3-manylinux_2_28_x86_64.whl
p4rust-0.1.19-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for p4rust-0.1.19-cp39-abi3-manylinux_2_28_aarch64.whl
p4rust-0.1.19-cp39-abi3-macosx_12_0_x86_64.whl CPython 3.9 abi3 macOS 12.0+ x86-64 Details for p4rust-0.1.19-cp39-abi3-macosx_12_0_x86_64.whl
p4rust-0.1.19-cp39-abi3-macosx_12_0_arm64.whl CPython 3.9 abi3 macOS 12.0+ ARM64 Details for p4rust-0.1.19-cp39-abi3-macosx_12_0_arm64.whl

Total release size: 43.7 MB

Release files / p4rust-0.1.19-cp315-abi3.abi3t-win_arm64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-win_arm64.whl
Size 3.1 MB
Tags CPython 3.15 Windows ARM64 abi3 abi3t
SHA-256 checksum
How to use checksums
471d520f5af9f80bc7ff4a0ba1c2ba8e8c59374a87d3e69d2a4dc0cf5f1367c1
BLAKE2b-256 checksum
How to use checksums
c59b741916b6466ff0b0b24b13b74a70f8a27be3c56ca10e6bb7ebf7a35234ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp315-abi3.abi3t-win_amd64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-win_amd64.whl
Size 3.5 MB
Tags CPython 3.15 Windows x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
21f21c6d9ced54fa357fe1eebb73df0021915ac273335c5391bbf10c53009385
BLAKE2b-256 checksum
How to use checksums
c5902f42e3cab619e725f58b700a9654f371eabca6d67ad205752a4e52c695de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
Size 4.1 MB
Tags CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
48ffcc547437e13a983ecab97a4a53be44f463e5333572ba1be648d69bc6caa3
BLAKE2b-256 checksum
How to use checksums
8c2dadf385746f9fc4d9fcf62453bae14b806106f8327c44dda43554347f2637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
Size 4.3 MB
Tags CPython 3.15 Linux glibc 2.28+ ARM64 abi3 abi3t
SHA-256 checksum
How to use checksums
7e9b5bc5e2d5e51230e50931ac7c195788d55e74d60f3420a12612d538d49a74
BLAKE2b-256 checksum
How to use checksums
477aacc10028fd4ef6b6fd0f683c3639d495eaf62f094b3faf61546e2954f008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_x86_64.whl
Size 3.3 MB
Tags CPython 3.15 abi3 abi3t macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
d81f88c20f15fdaf4eea408c3eae9dfcbe2a3c1840eda80339d7b8a6b7d15a0b
BLAKE2b-256 checksum
How to use checksums
ac15bfab5626fe2ab9e3af79481ff00d4d62b1994daaa983a6304adce4f88fae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_arm64.whl

Download URL p4rust-0.1.19-cp315-abi3.abi3t-macosx_12_0_arm64.whl
Size 3.6 MB
Tags CPython 3.15 abi3 abi3t macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
70b7f55d45cd3b49abb7e242fb31455cd964da4fbf04755f36906833e52feb52
BLAKE2b-256 checksum
How to use checksums
cb9c85e4d319fc8b0d93d619d08b15c0bfd759b49ce834a7410f8f02db5bb743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-win_arm64.whl

Download URL p4rust-0.1.19-cp39-abi3-win_arm64.whl
Size 3.1 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
63dde94f0f00272ef7f5b018ff39abb8d82e862e6b009f01c646afb85828b66e
BLAKE2b-256 checksum
How to use checksums
def88291ab91d442b452d529b035bb822eb42085767f2b29ca1d68170396b834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-win_amd64.whl

Download URL p4rust-0.1.19-cp39-abi3-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
be27ccec0a27354e1a33d91c8669afad60beb58b5667102f9cd2dd8897b46fe7
BLAKE2b-256 checksum
How to use checksums
894f404d585163c5c0d38157726efedfb49cd9de296492ffe5e793a8b72bbfb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.19-cp39-abi3-manylinux_2_28_x86_64.whl
Size 4.1 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2fa3e3811fe02f3f0fd312707ae36b3af97c603dfd62b5a285d9cbf48dc5eb37
BLAKE2b-256 checksum
How to use checksums
b70e5e4566790819b3b9cf19eb95c7c0c71207f4b77f3befd95ad8b9abc51895
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.19-cp39-abi3-manylinux_2_28_aarch64.whl
Size 4.3 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
911cdc8cdab28c059a5b1f66a9a4b9c506b2c1bb0f4c58145acb2e4e4c9ae678
BLAKE2b-256 checksum
How to use checksums
f06b7b9dc3d5c9a72b7032243fe5deaad27ed92056aca49290aaa55356a1569f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.19-cp39-abi3-macosx_12_0_x86_64.whl
Size 3.3 MB
Tags CPython 3.9 abi3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
16cdd3b9fd31ae3897a8829a1d0330c2c2daec744d32fa303b7f3fe3d5d33fd7
BLAKE2b-256 checksum
How to use checksums
52a9828b0ea13d381b5629478bd5371fccc7f4315ba95ecbc3c9b6b083c98044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / p4rust-0.1.19-cp39-abi3-macosx_12_0_arm64.whl

Download URL p4rust-0.1.19-cp39-abi3-macosx_12_0_arm64.whl
Size 3.6 MB
Tags CPython 3.9 abi3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
21a05f5f085c2e09593fd58630b7f6c2c15aecb17bcd173995fa9768480314ac
BLAKE2b-256 checksum
How to use checksums
459bd22a63548ec72fa53b95676e810bb99298d0b225f893483cfb3c1a89066d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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}

Security for p4rust 0.1.19

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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