Skip to main content

SCRU64: Sortable, Clock-based, Realm-specifically Unique identifier

PyPI License

SCRU64 ID offers compact, time-ordered unique identifiers generated by distributed nodes. SCRU64 has the following features:

  • 63-bit non-negative integer storable as signed/unsigned 64-bit integer
  • Sortable by generation time (as integer and as text)
  • 12-digit case-insensitive textual representation (Base36)
  • ~38-bit Unix epoch-based timestamp that ensures useful life until year 4261
  • Variable-length node/machine ID and counter fields that share 24 bits
# pass node ID through environment variable
import os

os.environ["SCRU64_NODE_SPEC"] = "42/8"

import scru64

# generate a new identifier object
x = scru64.new_sync()
print(x)  # e.g., "0u2r85hm2pt3"
print(int(x))  # as a 64-bit unsigned integer


# generate a textual representation directly
print(scru64.new_string_sync())  # e.g., "0u2r85hm2pt4"

See SCRU64 Specification for details.

SCRU64's uniqueness is realm-specific, i.e., dependent on the centralized assignment of node ID to each generator. If you need decentralized, globally unique time-ordered identifiers, consider SCRU128.

License

Licensed under the Apache License, Version 2.0.

Metadata

Release files for scru64 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scru64 1.0.2
File Size Uploaded
scru64-1.0.2.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scru64 1.0.2
File Interpreter ABI Platform
scru64-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / scru64-1.0.2.tar.gz

Download URL scru64-1.0.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9b5ff1d2b732c465f081778095ffe9a4f536ba7373ea8ae18f1583450bf5648d
BLAKE2b-256 checksum
How to use checksums
5ee9da8cf5347b6256974f454f365d04f099d89e80184a479fb8122cc12e4e4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0

Release files / scru64-1.0.2-py3-none-any.whl

Download URL scru64-1.0.2-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d8fb7dbecd1e461a42af561ea28b50037b4a4f25b6470c3c2d5487751a1359c
BLAKE2b-256 checksum
How to use checksums
60b272b885c1cc3b1740a0410b97def2538e15dc1788b92f91952df1c2d70b95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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