Skip to main content

odoid

Deterministic mixed-radix ID encoding. Maps a non-negative integer to a 6, 7, or 8-character alphanumeric string with a serial-number aesthetic.

encode(0,            6)  →  "0A0000"
encode(1234567,      6)  →  "0D7NM7"
encode(1234567,      7)  →  "0A15NM7"
encode(236223201279, 8)  →  "ZZ9ZZZZZ"

Features

  • Deterministic — same integer + length always produces the same string, and vice-versa.
  • Human-readable — ambiguous characters I, L, O are excluded from all positions.
  • Fixed positional structure — position 1 is always a letter, position 2 is always a digit.
  • Pure Python — no dependencies, works on Python 3.8+.

Install

pip install odoid

Usage

Encode

from odoid import encode

encode(0, 6)            # "0A0000"
encode(1234567, 6)      # "0D7NM7"
encode(1234567, 7)      # "0A15NM7"
encode(236223201279, 8) # "ZZ9ZZZZZ"

encode(n, length=6) — default length is 6.

Decode

from odoid import decode

decode("0A0000")    # 0
decode("0D7NM7")    # 1234567
decode("0A15NM7")   # 1234567

Returns int. Input is uppercased before lookup, so decode("0d7nm7") is valid.

OdoIDGenerator

from odoid import OdoIDGenerator

g = OdoIDGenerator(namespace="orders", length=7)
result = g.next()
# result.id        → e.g. "3H5NV2K"
# result.n         → the raw integer
# result.length    → 7
# result.namespace → "orders"

Lengths and Capacity

Length Max integer (exclusive)
6 230,686,720
7 7,381,975,040
8 236,223,201,280

Errors

Error When
OverflowError n < 0 or n >= MAX[length]
UnsupportedLengthError length is not 6, 7, or 8
InvalidCharacterError character not in positional charset during decode

All three are subclasses of ValueError.

Specification

See SPEC.md for the full processing instruction document.

License

MIT

Metadata

Release files for odoid 1.0.3

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

Source distribution (sdist)

Source distribution for odoid 1.0.3
File Size Uploaded Provenance Actions
odoid-1.0.3.tar.gz 5.6 kB Without provenance Details for odoid-1.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 12.6 kB

Release files / odoid-1.0.3.tar.gz

Download URL odoid-1.0.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4576bcc5f0c69e44b7df3451872c0d3aedcbdbc7b06a7e6a5573d0d9eec040ea
BLAKE2b-256 checksum
How to use checksums
31c2641d1a211e04b01f9630a0834e362975034306a1c38c994f3c216f706c72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / odoid-1.0.3-py3-none-any.whl

Download URL odoid-1.0.3-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f5360d2f0d2e2871b9dde7e744df71b71776586d70b3761a80b56f9bc285b1e
BLAKE2b-256 checksum
How to use checksums
f99c8a966f2fa731ea8392a833ae2e703a2d9a73f721a08399e85d6f099f6fd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for odoid 1.0.3

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.

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