RayID for Python
A lightweight Python library for generating short, readable identifiers.
RayID generates customizable IDs using different character sets. It can be used for tracking logs, events, requests, and other application resources.
Package Information
| Property | Value |
|---|---|
| Package | rayid |
| Registry | PyPI |
| Latest Version | |
| Python | >=3.9 |
| License | MIT |
Resources
- Source Code: GitLab Repository
- Package Registry: PyPI
- Documentation: RayID Python Docs
- JavaScript Version: npm Package ยท Documentation
Installation
Using pip:
Using uv:
Quick Start
from rayid import RayID
# Create a numeric ID generator
ray = RayID("digit")
# Generate a 16-character ID
identifier = ray.gen(16)
print(identifier)
Character Types
RayID supports four character sets:
| Type | Characters |
|---|---|
digit |
0-9 |
lower |
a-z |
upper |
A-Z |
all |
Digits + lowercase + uppercase |
Examples
from rayid import RayID
# Numeric identifiers
digits = RayID("digit")
print(digits.gen(10))
# Lowercase identifiers
lowercase = RayID("lower")
print(lowercase.gen(10))
# Uppercase identifiers
uppercase = RayID("upper")
print(uppercase.gen(10))
# Mixed alphanumeric identifiers
mixed = RayID("all")
print(mixed.gen(16))
Notes
- The character type is required when creating a
RayIDinstance. - The generated ID length must be a positive integer.
- For character sets containing digits, generated IDs do not start with
0. - Invalid character types raise
ValueError.
For the complete API reference and additional examples, visit the official documentation.
License
RayID is distributed under the MIT License.