FastUUID provides CPython bindings to a Rust UUID library, offering an API that is functionally identical to Python's built-in `uuid` module but with significantly improved performance. It supports UUID versions v1, v3, v4, v5, and v7. The current version is 0.14.0, and it maintains an active development status with regular releases.
pip install fastuuidVerified import paths — ran on the pinned version, not inferred.
Demonstrates generating a new UUID v4, parsing an existing UUID string, and using `uuid4_bulk` for efficient generation of multiple UUIDs.
Ensure a Rust toolchain is installed in your build environment, or use pre-built wheels if available for your platform and Python version.
Validate UUID strings against RFC 4122 before passing them to `fastuuid.UUID()`, or implement error handling for `ValueError` during parsing.
Verify that you are using the correct Python `fastuuid` package when comparing or migrating from other 'fastuuid' implementations to ensure expected behavior and UUID standard compliance.
For high-throughput single UUID generation in multi-threaded Python applications, consider using `uuid4_bulk()` to generate a batch and then consuming from the batch, or benchmark individual generation calls in your specific use case.
Install a Rust toolchain (e.g., via `rustup.rs`) and a C compiler (e.g., `sudo apt-get install build-essential` on Debian/Ubuntu, or Xcode Command Line Tools on macOS) in your build environment. Alternatively, ensure you are installing fastuuid in an environment for which pre-built wheels exist.
Ensure that all UUID strings strictly follow the RFC 4122 format (e.g., `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`). Validate input UUID strings before passing them to `fastuuid.UUID()`, or implement error handling for `ValueError`.
Install fastuuid using `pip install fastuuid`. If the installation appears to succeed but the error persists, check the installation output for any compilation warnings or errors, particularly those related to the Rust toolchain or linker issues mentioned in other common problems.