Skip to main content

Python UUID module written in C++

Project description

Build status

cpp_uuid is a Python library written in C++. It provides an API that, in most cases, covers usage of Python’s builtin UUID class. The library implements generate, convert to string and parse UUIDs version 4. It is also possible to convert UUIDs from uuid standard or compare between them.

In most cases you can just replace import section of your code.

from cpp_uuid import UUID, uuid4

item_uuid = uuid4()
other_uuid = UUID('c5fcf05c-6320-47ec-98c0-be84fdb1c321')

Module tested on Python versions from 3.8 to 3.12.

This library uses UUID4 generation from crashoz/uuid_v4 library.

Benchmarks

Performance comparisons were made with the standard uuid and the fastuuid library, which is written in Rust.

Benchmark results (10 6 times for each test)

uuid (ms)

fastuuid (ms)

cpp_uuid (ms)

UUID from str

1543

251

172

UUID from bytes

1112

280

381

uuid4()

2676

1049

131

str(uuid)

859

229

120

uuid.bytes

152

134

90

hash(uuid)

151

104

56

compare UUIDs

123

68

46

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpp-uuid-1.0.1.tar.gz (11.2 kB view details)

Uploaded Source

File details

Details for the file cpp-uuid-1.0.1.tar.gz.

File metadata

  • Download URL: cpp-uuid-1.0.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for cpp-uuid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 71db9c479faaffd81efa91a2a8ad63ffb8f1f4ce6e584abb9dd48666846fc0cf
MD5 f201fc7a7ae070ddb8dd97c6b9dfdf30
BLAKE2b-256 33721c5dcc44be3700090261552db1e4db36382722c5952e57f680c48b2ac5fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page