id57
Rust-backed helpers for generating Artemis-compatible base-57 identifiers.
The project packages a Rust extension that mirrors the existing Python
implementation of Artemis' identifier helpers: the ALPHABET constant plus the
base57_encode, decode57, and generate_id57 functions. Identifiers preserve
lexicographic ordering by concatenating an encoded timestamp (11 base-57
characters) with an encoded UUID component (22 base-57 characters).
Installation
Pre-built wheels are published to PyPI. Once available, install with:
pip install id57
If a wheel is not available for your platform the package falls back to a pure-Python implementation that matches the Rust behavior, so the same API is available everywhere.
Usage
>>> from id57 import ALPHABET, base57_encode, decode57, generate_id57
>>> ALPHABET
'23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
>>> base57_encode(999_999)
'7Qnr'
>>> decode57('7Qnr')
999999
>>> len(generate_id57())
33
The default generator encodes the current UTC timestamp in microseconds and a UUID4 into a 33 character string. You can also supply the parts explicitly:
>>> generate_id57(timestamp=1_700_000_000_123_456, uuid=0x1234)
'22HGcpYU2og22222222222222222223Sm'
Development
The repository uses uv for Python dependency
management and maturin for building the Rust
extension. Helpful targets are available in the Makefile:
make develop # Build and install the extension into uv's virtual environment
make test # Run the pytest suite
make build # Produce wheels via maturin
make publish # Publish wheels to PyPI (requires credentials)
The test suite exercises both the encode/decode helpers and the generate_id57
composition logic, comparing the Rust implementation against the bundled
pure-Python reference for parity.
Publishing workflow
- Build wheels locally:
make build - Verify the wheel installs and the API works:
pip install dist/id57-*.whl - Publish to TestPyPI or PyPI:
make publish - Tag the release (e.g.
v1.0.0) and record the changes inCHANGELOG.md
The CI workflow publishes signed wheels to PyPI whenever a commit lands on
main, using the PYPI_TOKEN secret and creating a matching GitHub Release.
License
Distributed under the MIT License. See LICENSE for details.
Metadata
Release files for id57 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| id57-1.0.0.tar.gz | 32.3 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| id57-1.0.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| id57-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| id57-1.0.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 612.3 kB
Release files / id57-1.0.0.tar.gz
| Download URL | id57-1.0.0.tar.gz |
|---|---|
| Size | 32.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7e174f305a16b5b25d46a957e44f8b3ec5ef3e359448978e5ae94f851f7062d
|
|
BLAKE2b-256 checksum How to use checksums |
995620501da3ca6363321bc491e1f2bab2c1cb0957b470a26f42c7aac0671084
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / id57-1.0.0-cp39-abi3-win_amd64.whl
| Download URL | id57-1.0.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 138.3 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
24644043f0e7f169a3f4d9ba81b45165b8c68e8e37b773023afa2aafa716353d
|
|
BLAKE2b-256 checksum How to use checksums |
8a59ed0593841b366d1a30789c6fa2454cbc91ff156bbb7524da3e6fbf748c85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / id57-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | id57-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 239.3 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
392f9436e8d2432ac1e6ea5c59609c6a2675d47a2827a5fff18d77974c88700c
|
|
BLAKE2b-256 checksum How to use checksums |
567afe7b07beb20afd2984f06e31823e8789ff23f3c5e8457621f5800a2c880d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / id57-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | id57-1.0.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 202.3 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
35ecb58df4f08134211369b8fa5db0579d06c9e95f7f9d94590bec117593cac9
|
|
BLAKE2b-256 checksum How to use checksums |
87aae37c5c4bf5d68fb95ff019c44b7a8a8d6f1e09f9e63ea7e93895066d5c51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|