Skip to main content

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

Project description

sonyflake-py

codecov Build 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.1.0.tar.gz (3.4 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.1.0-py3.9.egg (3.4 kB view details)

Uploaded Egg

sonyflake_py-1.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sonyflake-py-1.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for sonyflake-py-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ff5c699e4d615e14f71fe58c007f9c6bac287610c930161c81f78ce1bc26e00b
MD5 28432f91b8971fa67832ebff8d51f30f
BLAKE2b-256 0c44ab2fd0e62764acfd6e0aeaad1da63aee5d10faae7b8b97871ab7f2045a19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sonyflake_py-1.1.0-py3.9.egg
  • Upload date:
  • Size: 3.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for sonyflake_py-1.1.0-py3.9.egg
Algorithm Hash digest
SHA256 0bfae1266d4b98ff8b198f59316e1f6467fb6b87a43ab2f18e30c72389fc740f
MD5 b4829cbf5419f26f93a15dc00662f2c5
BLAKE2b-256 1160e7ff8073ab8da4b82f16899f199c116a86aafc22155a132b76de102e5a2c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sonyflake_py-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for sonyflake_py-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 711d19ccb8b5f886159cb17ae414a9470fc94d486545934c203332cfaae5958d
MD5 7d90314afc59e6acf23e57aa5fe97f74
BLAKE2b-256 911e1089d18f40fca0c9411841d7b1817556bef9c35f3cfdb6cf749c5f2bcf10

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