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.

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

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.16
File Actions
p4rust-0.1.16-cp315-abi3.abi3t-win_arm64.whl CPython 3.15 abi3t, abi3 Windows ARM64 Details for p4rust-0.1.16-cp315-abi3.abi3t-win_arm64.whl
p4rust-0.1.16-cp315-abi3.abi3t-win_amd64.whl CPython 3.15 abi3t, abi3 Windows x86-64 Details for p4rust-0.1.16-cp315-abi3.abi3t-win_amd64.whl
p4rust-0.1.16-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ x86-64 Details for p4rust-0.1.16-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
p4rust-0.1.16-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl CPython 3.15 abi3t, abi3 Linux glibc 2.28+ ARM64 Details for p4rust-0.1.16-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
p4rust-0.1.16-cp315-abi3.abi3t-macosx_12_0_x86_64.whl CPython 3.15 abi3, abi3t macOS 12.0+ x86-64 Details for p4rust-0.1.16-cp315-abi3.abi3t-macosx_12_0_x86_64.whl
p4rust-0.1.16-cp315-abi3.abi3t-macosx_12_0_arm64.whl CPython 3.15 abi3, abi3t macOS 12.0+ ARM64 Details for p4rust-0.1.16-cp315-abi3.abi3t-macosx_12_0_arm64.whl
p4rust-0.1.16-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details for p4rust-0.1.16-cp39-abi3-win_arm64.whl
p4rust-0.1.16-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for p4rust-0.1.16-cp39-abi3-win_amd64.whl
p4rust-0.1.16-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for p4rust-0.1.16-cp39-abi3-manylinux_2_28_x86_64.whl
p4rust-0.1.16-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for p4rust-0.1.16-cp39-abi3-manylinux_2_28_aarch64.whl
p4rust-0.1.16-cp39-abi3-macosx_12_0_x86_64.whl CPython 3.9 abi3 macOS 12.0+ x86-64 Details for p4rust-0.1.16-cp39-abi3-macosx_12_0_x86_64.whl
p4rust-0.1.16-cp39-abi3-macosx_12_0_arm64.whl CPython 3.9 abi3 macOS 12.0+ ARM64 Details for p4rust-0.1.16-cp39-abi3-macosx_12_0_arm64.whl

Total release size: 43.6 MB

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

Download URL p4rust-0.1.16-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
a47809851049e07f98bc17c3a788a55e8c092fc64700f96f98ed36b211132da8
BLAKE2b-256 checksum
How to use checksums
4e4c7904b8cbc291d0e9d7f4ecfe462ece8c26a81c99e830c6ba4f887b6ab1af
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.16-cp315-abi3.abi3t-win_amd64.whl

Download URL p4rust-0.1.16-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
96d67265fa84c34e2539e12136582260940ad8f5c706b73f788f856431adb02b
BLAKE2b-256 checksum
How to use checksums
5b658f3d1dcfc1cf17ff6db4c11576e02e88e086a9f50b90155ead9b3daf5381
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.16-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.16-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
Size 4.0 MB
Tags CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
bbb96c10f52bc4fdf6932728fb257608c390af45b876a03b272373d44e98d15d
BLAKE2b-256 checksum
How to use checksums
b63108182983738f66bdc9b546f2a9a552aa04f3139cfa409307ffd7deb6a528
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.16-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.16-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
d7284c8c3680720a10f2da1e45b3f9385cfd552ade0c7910ec95f1ac11925649
BLAKE2b-256 checksum
How to use checksums
9c9aa2bc01288010bfc502c689786e796fcca8c00319003f12a07da21ddc3e0b
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.16-cp315-abi3.abi3t-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.16-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
9fbb46cd503055e330cf764b0f801137457341b43906bdcbe13ec056e6dc6d85
BLAKE2b-256 checksum
How to use checksums
005acf103d0a2cf36a0bfdf8a648c0f4551f4babb87a77a68b8d2f231d182481
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.16-cp315-abi3.abi3t-macosx_12_0_arm64.whl

Download URL p4rust-0.1.16-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
3043f315788dd5235b5502396362d62ae73a25edb31ee0a6c33a4db943d67b2f
BLAKE2b-256 checksum
How to use checksums
36762bb0ef8f02da525d9a337c4ea6ea3242a4c294a0a023cb4846c31c874f98
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.16-cp39-abi3-win_arm64.whl

Download URL p4rust-0.1.16-cp39-abi3-win_arm64.whl
Size 3.1 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
7b02dedc7f2b4129beae0e4955497e6a5c366dc309f8910fe5c67b0377180aed
BLAKE2b-256 checksum
How to use checksums
9ae9f0df611368ee87e1d345d63d9fcb0f0340d64819168811be019a8f096051
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.16-cp39-abi3-win_amd64.whl

Download URL p4rust-0.1.16-cp39-abi3-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6fc1a39e92fdd2dd706f54210665390c1fb8d7b9b13a7d16bb85959321503676
BLAKE2b-256 checksum
How to use checksums
c9b359f96fd0076d1db723d042a9e670745e5c5399806a664d8578818bdd56e3
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.16-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.16-cp39-abi3-manylinux_2_28_x86_64.whl
Size 4.0 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
53549eaf9cd1b01b4786ba5c242650b90537d4990a5be628eb513ad2f0d0046c
BLAKE2b-256 checksum
How to use checksums
44a2c5dd3a8f8b2189d59e189f004734d7e43d3be539ca0c13628b774e9ff239
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.16-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.16-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
32d6c3f4860b3e33d7bb23f789917f5f9972af9d515154f92d26f394175d8df1
BLAKE2b-256 checksum
How to use checksums
c42c39d141c7323cc5a29195199815f09b5837ba4d1b6799d2f64744259bfc0b
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.16-cp39-abi3-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.16-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
90689c653fc14136090a36b46511407ecda8a8be89c7f06a98ab2132cf6f0e5b
BLAKE2b-256 checksum
How to use checksums
d52d5f21a3652a81f0e30479db46a46db36cddb60c3269889e721ade327cc917
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.16-cp39-abi3-macosx_12_0_arm64.whl

Download URL p4rust-0.1.16-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
4c2f0ef8cce45eec210f6fa3dce67ef3a8bf42194b166a8ee11897c702f708dd
BLAKE2b-256 checksum
How to use checksums
c7af1337e9e7faafc347f0c81468a209bcd7ca2d4cbdf63be2b91ce689809072
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.16

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