Skip to main content

A unified Python ID generator library.

Project description

anyID logo

anyID

A unified Python library for generating a variety of unique identifiers.

anyid provides a simple and consistent interface for generating different kinds of IDs, from classic UUIDs to modern sortable identifiers like ULID and KSUID. It's lightweight, type-annotated, and has minimal dependencies.

Supported Identifiers

ID Type Sortable Length (chars) URL Safe Notes
CUID Yes 25 Yes Collision-resistant for horizontal scaling.
CUID2 No 24 (default) Yes An improved, more secure version of CUID.
KSUID Yes 27 Yes K-Sortable Unique Identifier.
NanoID No 21 (default) Yes Secure, URL-friendly, and fast.
ShortUUID No ~22 Yes A shorter, URL-safe version of a standard UUID.
Snowflake Yes 19 (integer) No Twitter's distributed, time-sortable ID generator.
ULID Yes 26 Yes Universally Unique Lexicographically Sortable Identifier.
UUID No 36 No The classic, ubiquitous UUID v4.
XID Yes 20 Yes Globally unique ID that is sortable by time.

Installation

pip install anyid

Usage

The API is simple and consistent across all ID types.

from anyid import cuid, ulid, uuid

# Generate a CUID
my_cuid = cuid()
print(f"CUID: {my_cuid}")

# Generate a ULID
my_ulid = ulid()
print(f"ULID: {my_ulid}")

# Generate a UUID (v4)
my_uuid = uuid()
print(f"UUID: {my_uuid}")

Contributing

Contributions are welcome! This project uses pytest for testing and ruff and black for linting and formatting. Please feel free to open an issue or submit a pull request.

Credits

  • Logo created by Grok
  • Thanks Copilot for reviewing my code
  • Thanks Gemini CLI for helping me with bug fixes and tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anyid-0.2.4.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anyid-0.2.4-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file anyid-0.2.4.tar.gz.

File metadata

  • Download URL: anyid-0.2.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anyid-0.2.4.tar.gz
Algorithm Hash digest
SHA256 2d759a81f7b0605133b8a083d48f16f5dc37cf58582b351612818c9143814a49
MD5 c9e30755aae2cb4debd71bdb06752f20
BLAKE2b-256 3307b4a6bb9cc2a80128955e81c60ffe307de7a4fa5b1ab4763aabbda082cb99

See more details on using hashes here.

Provenance

The following attestation bundles were made for anyid-0.2.4.tar.gz:

Publisher: publish.yml on adelra/anyid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anyid-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: anyid-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for anyid-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d35c86eaf5a0c7250e7e65e133220a0d72fbcf54708a27d3f31509f37dd181be
MD5 f07b9f42c7732807aacd0d84db93c083
BLAKE2b-256 6a1ff052c8f782e40ebcacd0df78bc18c10a2d9c723c15caa420e8ed1ddf7f13

See more details on using hashes here.

Provenance

The following attestation bundles were made for anyid-0.2.4-py3-none-any.whl:

Publisher: publish.yml on adelra/anyid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page