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

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

Total release size: 43.7 MB

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

Download URL p4rust-0.1.17-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
535604e12e0643e17ab52dbc111e733c6fa01a1d6134b3388707862c4a1dcc25
BLAKE2b-256 checksum
How to use checksums
27fd1a3119c6975876129ae62922195a00796bc7625670707c650eed04960766
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.17-cp315-abi3.abi3t-win_amd64.whl

Download URL p4rust-0.1.17-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
c4d4be45b2d9645d4c28ba3e2ac41e3c2e32b947dd0fb9b4d4bf73ece7d4ea6e
BLAKE2b-256 checksum
How to use checksums
e10e1d59c3d0a415bf65d3417d027039f456ab453d2c43b7a6ac05efbdda9ba5
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.17-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.17-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
e9ba46291632f261787079c5b0672240e012924556fc67dfaa8094b979d335e8
BLAKE2b-256 checksum
How to use checksums
5984cdedee9578ceec983af4b8f9a3a64e472336b3e4fc78f1074a07f742cfed
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.17-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.17-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
03644c3e397bcf4ac325176d65cb72569f0aca1d3193fbfe27ea9e87fe7e2ad5
BLAKE2b-256 checksum
How to use checksums
1c9ecf0608402e9dd40db6c66f52a96f93ff9331e0f6a57ed3e16defeeb810cd
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.17-cp315-abi3.abi3t-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.17-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
0bbb2d8f3e999e33bbdd8172460b9c5858c6fb744662221dac31503760e356c9
BLAKE2b-256 checksum
How to use checksums
d46a3720a55605b77b6eebbb49fb54cee903006f3b867bdccf90d88c70dc4eb2
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.17-cp315-abi3.abi3t-macosx_12_0_arm64.whl

Download URL p4rust-0.1.17-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
a8167324cb532445280f51704d74a7cbaa6d56d9e55ad423d5d8dc3d9b60bd2e
BLAKE2b-256 checksum
How to use checksums
7c0ffd2a924c405ff499cfdaa0c0f769b76e6d1a866191ec335ed949eed8b699
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.17-cp39-abi3-win_arm64.whl

Download URL p4rust-0.1.17-cp39-abi3-win_arm64.whl
Size 3.1 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
59c5db447e371d9b92a12add44ed1896518b9a4d49169708a3866ab966d6f407
BLAKE2b-256 checksum
How to use checksums
c53284326c87c8565779df125d874379acd6c9be168dbceefeedf64fab98721c
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.17-cp39-abi3-win_amd64.whl

Download URL p4rust-0.1.17-cp39-abi3-win_amd64.whl
Size 3.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4e8134c67d40d67dfaee87fddee2bc8eda35d15c60f0560c880373568c7ee589
BLAKE2b-256 checksum
How to use checksums
4835e1d8a301ba1d2c621ea68514afa8ae21a70a236057a464ba5bfd9026daf1
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.17-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL p4rust-0.1.17-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
b90e040cf18b2b563de2c9c7ba65791b3b7dd0c8dce12a1e85427d1208b48e00
BLAKE2b-256 checksum
How to use checksums
ee5e1a054a7551491758e2962cfe512aee26073bdaebe11b11370c9a5b9f83f1
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.17-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL p4rust-0.1.17-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
d684bc596ae4e8966ed90a5e57e62607419483c50b86e994dab1b3e023a25743
BLAKE2b-256 checksum
How to use checksums
acadf5c2dcf8be7596b2bc1b831a75b38a3118aae8ae9751e127888e80ddc1bc
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.17-cp39-abi3-macosx_12_0_x86_64.whl

Download URL p4rust-0.1.17-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
2009d454f0e8cd4f4ad38a40fe2a4289ef61eaed121615660e78e44f460cebd7
BLAKE2b-256 checksum
How to use checksums
1ffd3b6f63440ea34b063bc82c46c58354a35361505e338c6edaf80f4ee15a3b
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.17-cp39-abi3-macosx_12_0_arm64.whl

Download URL p4rust-0.1.17-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
6f6b77ec4732ee3ac06371adf8eacc0f975457a1ed0b48176f674daff7c36a00
BLAKE2b-256 checksum
How to use checksums
7d13c92682479bac7b0a12c2e4d6610a11dfcd1e928901f4bedd9c1caca8cee0
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.17

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