Registry / serialization / fastnanoid

fastnanoid

JSON →
library0.4.3pypypi✓ verified 89d ago

Fastnanoid is a tiny, secure, URL-friendly, and highly performant unique string ID generator for Python, leveraging a Rust implementation via PyO3. It provides a drop-in replacement for other Nano ID implementations with a focus on speed. The current version is 0.4.3, with a release cadence that has seen several minor updates and performance improvements over the past year.

pip install fastnanoid
INSTALL
IMPORT
SIG · FASTNANOID
F
fastnanoid
serializationpythonv0.4.3
Install
1.7s avg
Import
—
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.7MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fastnanoid
✓ from fastnanoid import fastnanoid
✗ from fastnanoid import nanoid
generate
✓ from fastnanoid import generate
uuid
✓ from fastnanoid import uuid

This quickstart demonstrates how to import the `nanoid` function and generate IDs with default settings, a specified length, or a custom alphabet.

from fastnanoid import nanoid # Generate a default Nano ID id_default = nanoid() print(f"Default ID: {id_default}") # Generate a Nano ID with a specific length id_short = nanoid(size=10) print(f"Short ID: {id_short}") # Generate a Nano ID with a custom alphabet and length id_numeric = nanoid(alphabet="0123456789", size=8) print(f"Numeric ID: {id_numeric}")
Debug
Known issues
gotchaWhen installing on certain platforms (e.g., specific Linux distributions, ARM architectures, or very new Python versions) for which pre-compiled wheels are not available, pip may attempt to compile `fastnanoid` from source. This requires the Rust toolchain (rustup, cargo) to be installed on the system.
fix
Ensure Rust is installed and configured correctly (e.g., `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`) or check if an appropriate wheel is available for your environment.
affects: All versions
gotchaThe `nanoid` function expects `size` and `alphabet` as keyword arguments. Passing them positionally or using incorrect keyword names will result in a `TypeError`.
fix
Always use `nanoid(size=10)` and `nanoid(alphabet='abc')` instead of `nanoid(10)` or `nanoid('abc')`.
affects: All versions
Upgrade
Version history
0.4.3latest on PyPI · released Jun 30, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Anthropic
1
Resources
fastnanoid — pip install fastnanoid · libregistry