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.1.tar.gz (4.2 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.1-py3.9.egg (4.1 kB view details)

Uploaded Egg

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sonyflake-py-1.2.1.tar.gz
  • Upload date:
  • Size: 4.2 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.1.tar.gz
Algorithm Hash digest
SHA256 58f1eb77c92ab6d6093c52ccf36ecd8b5a1863987c75070886de155c48603b3d
MD5 e399ca36048d6c7de7451161530b2f29
BLAKE2b-256 3985512cf34cfd754d40dec2ec9f7b90ea6cea34583e03f677a7768d47113f11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sonyflake_py-1.2.1-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.1-py3.9.egg
Algorithm Hash digest
SHA256 63c41d77f8add977e9451723f00402dfab45ed50791dcd100a3cd1df8e28f761
MD5 6b85378b1178eaa2c601298aa668de48
BLAKE2b-256 2283e16632db2139e7f151b5f4ce887c3c44c38e4da64847f7ddd29327d0b1e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sonyflake_py-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2110536cd1d20bbd60302d3d6f24bf22a16de6b481110a766ef725bda033f8
MD5 9d6ed388a4f62223a4d731415da6e291
BLAKE2b-256 9fd792222882270d4f799e605848b5b3785ba534a70e6b0bcb7e33f6d8c405ce

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