Skip to main content

Short id generator

Project description

Python ShortId and SnowflakeId

short_id is a Python 3 library that provides an easy way to generate a short unique id in an orderly way using the snowflake id generation method

  • short id with ordered way
  • snowflake id as ordered unique number
  • short id with more unique without order

short_id hosted on PyPI and can be installed as such:

pip install install ShortId

Alternatively, you can also get the latest source code from Github and install it manually.

import short_id
unique_id :str = short_id.generate_short_id()
snowflake_id :int = short_id.get_next_snowflake_id()

 # To increase id accuracy need to send a mult value the default value is 10000
 # and based on this mult value the id length and accuracy will change 
 unique_id :str = short_id.generate_short_id(1000000)
 snowflake_id :int = short_id.get_next_snowflake_id(1000000)

Running Tests


python -m unittest discover

Changelog


Version 0.1.2

  • Initial release

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

short-unique-id-0.1.2.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

short_unique_id-0.1.2-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

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