Skip to main content

A distributed unique ID generator inspired by Twitter's Snowflake.

Project description

sonyflake-py

codecov Build Status Documentation Status

Sonyflake is a distributed unique ID generator inspired by Twitter's Snowflake.

This is a python rewrite of the original sony/sonyflake project, written in Go.

A Sonyflake ID is composed of

39 bits for time in units of 10 msec
 8 bits for a sequence number
16 bits for a machine id

Installation

pip install sonyflake-py

Quickstart

from sonyflake import SonyFlake
sf = SonyFlake()
next_id = sf.next_id()
print(next_id)

The generator can be configured with variety of options, such as custom machine_id, start_time etc.

  • start_time should be an instance of datetime.datetime.
  • machine_id should be a callable which returns an integer value upto 16-bits.

License

The MIT License (MIT).

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

sonyflake-py-1.2.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distributions

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

sonyflake_py-1.2.0-py3.9.egg (4.1 kB view details)

Uploaded Egg

sonyflake_py-1.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file sonyflake-py-1.2.0.tar.gz.

File metadata

  • Download URL: sonyflake-py-1.2.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for sonyflake-py-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a9d1849865782af553258a0a9f91b65a608f518e27b32802e405773028098dad
MD5 941e71ea58ab1193bfe5bf1563528930
BLAKE2b-256 650bda422abad43a95934876f6e02f5f95be1065548e2ae7fc91933b37fc77bb

See more details on using hashes here.

File details

Details for the file sonyflake_py-1.2.0-py3.9.egg.

File metadata

  • Download URL: sonyflake_py-1.2.0-py3.9.egg
  • Upload date:
  • Size: 4.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for sonyflake_py-1.2.0-py3.9.egg
Algorithm Hash digest
SHA256 2bd45c9ec4c0af0e553756a4b942bf67860baa7ec2ae7e0f1070c1b152a2df53
MD5 a96cdca0e74398aaedfc61b6b205489b
BLAKE2b-256 a30314df640ce677fc24619dfd7ec5cdc4ba947fdfa2eeac5332e8fd331fdc54

See more details on using hashes here.

File details

Details for the file sonyflake_py-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: sonyflake_py-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for sonyflake_py-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1efa71c419b31e12fe377e5761507c0eabb4f0e33c49fc6d00e2df0f944cd4cb
MD5 016741e7c2d59b0656d7450dad287e18
BLAKE2b-256 f086a04d6f4a50d62158f7dbe6838b27663357d6ae7cedb9ce93d267ef2ef88f

See more details on using hashes here.

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