zuid
Generates URL-safe random ids with a prefix and optional timestamp.
Installing
pip install zuid
Usage
The ZUID class works as a callable id factory for a given prefix:
>>> from zuid import ZUID
>>> generator = ZUID(prefix='user_')
>>> generator()
'user_03QewpfEIpPWUICXdgtvdR'
>>> generator()
'user_1LJSXMoyH6p7VsiL8wwIm1'
The factory generates ids that are 22 chars long by default, which in
base 62 corresponds to 131 random bits. For comparison, a v4 UUID has
122 random bits. It can be changed with the length parameter:
>>> generator = ZUID(prefix='user_', length=27)
>>> generator()
'user_X5fSIStIKpYWcg07nqEfPbMvmME'
With the timestamped parameter, the factory uses the current nanoseconds since epoch as the first 8 bytes, preserving the order when sorting by id.
>>> generator = ZUID(prefix='user_', timestamped=True)
>>> generator()
'user_1qzuvBwgHdQVO2gA4GelYX'
>>> generator()
'user_1qzuvCscVyClzGaqakgvsl'
>>> generator()
'user_1qzuvDb0TuCuIJJON103Of'
>>> generator()
'user_1qzuvES4mTQ7fWykywvjNb
Metadata
Release files for zuid 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zuid-0.1.1.tar.gz | 3.5 kB | Without provenance | Details for zuid-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zuid-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for zuid-0.1.1-py3-none-any.whl |
Total release size: 7.3 kB
Release files / zuid-0.1.1.tar.gz
| Download URL | zuid-0.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
150f72b2e2a882f4ee1aeef921856dec506dd87eebea9afb31d6b87295f0f694
|
|
BLAKE2b-256 checksum How to use checksums |
60f9b6e0592719110599925b3416188e0ee40da688005877aaeb3db8f9193d9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Linux/4.15.0-69-generic
|
Release files / zuid-0.1.1-py3-none-any.whl
| Download URL | zuid-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d8c86d73806fa8927a31843073dbec0c09f8f25822f5f4480ea492c80f463b0
|
|
BLAKE2b-256 checksum How to use checksums |
4210888b45bdd7438dbb1fae59a55c30eed7042a6f811071fc8535256c16c454
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.8 Linux/4.15.0-69-generic
|
Security for zuid 0.1.1
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.