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

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

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

Total release size: 43.5 MB

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

Download URL p4rust-0.1.15-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
6760996e0cd9261f48f9ad06782c6cd36223db972f50184ad58bbe85b2dbf417
BLAKE2b-256 checksum
How to use checksums
9906bd66bdac6d1110ed985b5411312ba1a7020249490df5082b00b7bac3a90c
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.15-cp315-abi3.abi3t-win_amd64.whl

Download URL p4rust-0.1.15-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
12efaf4ec79d1f910b2fc83fd5726d01d44230c26003f296549f1293e24ca5c2
BLAKE2b-256 checksum
How to use checksums
de3b02f94d09d3a334dbec840c4d4ec6b63086073162dfe8664cf94f4a6783de
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.15-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.15-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
d0ad0e9dbc57a979be97863f8f93a46de256170905358c4e71707c30e81d63e5
BLAKE2b-256 checksum
How to use checksums
d18a48bf937a0ddcbd6f2aa76c2f764909635011bcb0a7ae8e605181eb5f0ba5
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.15-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.15-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
c74786f860294b5718e1fd4be48ccccf539afb54647aa2b4ee26448de56783b3
BLAKE2b-256 checksum
How to use checksums
31c93193af21cc2ce36799b70141ac6295c9611b89a18fccc6f2a029d2341756
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.15-cp315-abi3.abi3t-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.15-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
306510e5ec0db052097a6f0dc1b29ff2237e41a498794bdbfbf736406c7d69d3
BLAKE2b-256 checksum
How to use checksums
c213cce3feef13143c29432706d22b8f2a0acbd5553de3ad5afcf70a597848ba
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.15-cp315-abi3.abi3t-macosx_12_0_arm64.whl

Download URL p4rust-0.1.15-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
e39e40133642aaeb542900f68ee6f6ccfc8d30a95c2425aa30a6660458288f2f
BLAKE2b-256 checksum
How to use checksums
6d7c323b6f7e61c076e5a1254d8705c0edf67b76b7b70cd55eadecef95dfd7f3
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.15-cp39-abi3-win_arm64.whl

Download URL p4rust-0.1.15-cp39-abi3-win_arm64.whl
Size 3.1 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
e8253ebef34d72068bbb758f6954f6ad5810b6fdc4b1eefdce32373ac14c2732
BLAKE2b-256 checksum
How to use checksums
7272066206c499456b05d8c71c84b224534f37ddffa0f7d5f304c17cc8183ebe
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.15-cp39-abi3-win_amd64.whl

Download URL p4rust-0.1.15-cp39-abi3-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d7297d9be9f1faf94c295332b1c51a050408b9c518885d33331f7309370d3ba1
BLAKE2b-256 checksum
How to use checksums
fba7b6893480748088ebe2f190fc84b5b6c1713194e0720f3b757fbc03b6b61d
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.15-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.15-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
b74e48ee46407d737086f2db409f38e5fdc0d159f3cd4aff16b5c5713333589a
BLAKE2b-256 checksum
How to use checksums
1d694f09f3d95c4d95c8a6e591d83a29860772bb5173e2f255ac0e535fdc20a0
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.15-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.15-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
782187b038d67e1ebf60c5b8352c3c5017acdf968de0ef8a9c902a95f8373c18
BLAKE2b-256 checksum
How to use checksums
c5268cf22da4f886af907f93707a61eb2cde6179d2a0f9f1221381faba0bf1a2
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.15-cp39-abi3-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.15-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
c0a3de214f3dbe501c29221568dadf124b888e07a077d6fa1ef29de52ac0f562
BLAKE2b-256 checksum
How to use checksums
18386371216c8b96ff27933faaec585740b3eee5654f69dd49ccec34c056a493
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.15-cp39-abi3-macosx_12_0_arm64.whl

Download URL p4rust-0.1.15-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
e61ce3aa99a7a4a6db809519825429f67352bfebdb439d26b8ae7247a14d9fc6
BLAKE2b-256 checksum
How to use checksums
7d12c8c0e9acfeabf0bf67bb29b9fb2d13fdba23e82344e9ed0a066c112cbf70
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.15

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