Skip to main content

B58UUID for Python

PyPI version Python versions License: MIT Tests

Base58-encoded UUID library for Python with zero dependencies.

Why This Library?

  • Compact: 22 characters instead of 36
  • URL-safe: No special characters that need escaping
  • Unambiguous: Uses Bitcoin's Base58 alphabet (excludes 0, O, I, l)
  • Fast: Optimized encoding/decoding algorithms
  • Safe: Comprehensive error handling with overflow protection
  • Zero dependencies: Uses only Python standard library
  • Type hints: Full type annotation support
  • Python 3.8+: Compatible with Python 3.8 and higher

Installation

pip install b58uuid

Usage

import b58uuid

# Generate a new UUID
b58 = b58uuid.generate()
print(b58)  # Output: 3FfGK34vwMvVFDedyb2nkf

# Encode existing UUID
encoded = b58uuid.encode('550e8400-e29b-41d4-a716-446655440000')
print(encoded)  # Output: BWBeN28Vb7cMEx7Ym8AUzs

# Decode back to UUID
uuid_str = b58uuid.decode('BWBeN28Vb7cMEx7Ym8AUzs')
print(uuid_str)  # Output: 550e8400-e29b-41d4-a716-446655440000

API

Functions

  • generate() -> str - Generate a new random UUID and return Base58 encoding
  • encode(uuid_str: str) -> str - Encode UUID string to Base58
  • decode(b58_str: str) -> str - Decode Base58 string to UUID

Exceptions

  • ValueError - Raised for invalid input or overflow

Features

  • Zero dependencies (uses only Python standard library)
  • Always produces exactly 22 characters
  • Uses Bitcoin Base58 alphabet (no 0, O, I, l)
  • Thread-safe operations
  • Type hints support
  • Full error handling with overflow protection

Testing

# Run tests
python -m pytest tests/ -v

# Run tests with coverage
python -m pytest tests/ --cov=b58uuid --cov-report=html

Development

Requirements

  • Python 3.8 or higher
  • pytest (for testing)

Building from Source

# Clone the repository
git clone https://github.com/b58uuid/b58uuid-py.git
cd b58uuid-py

# Install in development mode
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Build package
python -m build

For detailed contribution guidelines, see CONTRIBUTING.md.

License

MIT License - see LICENSE file for details.

Metadata

Release files for b58uuid 1.0.0

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

Source distribution (sdist)

Source distribution for b58uuid 1.0.0
File Size Uploaded Provenance
b58uuid-1.0.0.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / b58uuid-1.0.0.tar.gz

Download URL b58uuid-1.0.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d5eca8b1eea85a93080b7a8346e6202d8447136811ca113e9efd9d0d87200b90
BLAKE2b-256 checksum
How to use checksums
df672c4af90aa8113ef0a44f0b255ffd8c24d76005ad0cca529887ec19c75552
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / b58uuid-1.0.0-py3-none-any.whl

Download URL b58uuid-1.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7b3fe59d8363125a3ac0f97cde72e4249df099cb72493e49dbf5c18e767e0a4
BLAKE2b-256 checksum
How to use checksums
d941e0a1699e4286662aab0f3407b7412e24def674df61fe2b6eb154ea5d1b9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for b58uuid 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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