{"id":10296,"library":"timeflake","title":"Timeflake","description":"Timeflake is a Python library for generating 128-bit, roughly-ordered, URL-safe UUIDs, inspired by Twitter's Snowflake, Instagram's ID, and Firebase's PushID. It combines a timestamp with a random component. The current version is 0.4.3, with releases typically occurring a few times a year to introduce new features or address issues.","status":"active","version":"0.4.3","language":"en","source_language":"en","source_url":"https://github.com/anthonynsimon/timeflake","tags":["uuid","id generation","snowflake","unique identifier","timestamp"],"install":[{"cmd":"pip install timeflake","lang":"bash","label":"Install Timeflake"}],"dependencies":[],"imports":[{"note":"The main class was renamed from `Timeflake` to `timeflake` (lowercase) in v0.4.0. The top-level `timeflake()` function is now the primary way to instantiate a Timeflake object. Importing `Timeflake` directly is no longer possible after v0.4.0.","wrong":"from timeflake import Timeflake","symbol":"timeflake","correct":"import timeflake"}],"quickstart":{"code":"import timeflake\n\n# Generate a new timeflake\ntf = timeflake.timeflake()\n\nprint(f\"Generated Timeflake: {tf}\")\nprint(f\"As integer: {tf.int}\")\nprint(f\"As hex: {tf.hex}\")\nprint(f\"As base62: {tf.base62}\")\nprint(f\"As UUID: {tf.uuid}\")\nprint(f\"As datetime: {tf.datetime}\")\n\n# Encode and decode a timeflake\nencoded_tf = tf.base62\ndecoded_tf = timeflake.parse(encoded_tf)\nprint(f\"\\nOriginal: {tf}, Decoded: {decoding_tf}\")\n","lang":"python","description":"This quickstart demonstrates how to generate a new Timeflake, access its various representations (integer, hex, base62, UUID, datetime), and parse an existing Timeflake string back into an object."},"warnings":[{"fix":"Instead of `from timeflake import Timeflake; tf = Timeflake()`, use `import timeflake; tf = timeflake.timeflake()`.","message":"The main class name changed from `Timeflake` to `timeflake` (lowercase). This affects how you import and instantiate the object.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Previous versions might have used `Timeflake.random()` or similar. The new recommended way is `timeflake.timeflake()` for a new random ID, or `timeflake.parse()` to decode.","message":"The primary way to instantiate a Timeflake object changed. The top-level `timeflake()` function now returns an instance of the `timeflake` class.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Understand the ordering guarantees for your use case. If strict monotonicity within the same millisecond is critical, Timeflake may not be the ideal solution without additional sequencing.","message":"Timeflake IDs are 'roughly-ordered', not strictly monotonic. While the timestamp component ensures general ordering, the random component means two IDs generated in the exact same millisecond might not be strictly ordered relative to each other. This is typically acceptable for most distributed systems where perfect ordering is not a strict requirement.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"The class was renamed to `timeflake` (lowercase). Use `import timeflake; tf_obj = timeflake.timeflake()` to instantiate a new object.","cause":"Attempting to access the `Timeflake` class (with an uppercase 'T') directly from the `timeflake` module after version 0.4.0.","error":"AttributeError: module 'timeflake' has no attribute 'Timeflake'"},{"fix":"To generate a new timeflake, call the `timeflake()` function *within* the module: `import timeflake; tf_obj = timeflake.timeflake()`.","cause":"Attempting to call the `timeflake` module directly as a function (e.g., `tf = timeflake()`) without referring to the constructor function.","error":"TypeError: 'module' object is not callable"},{"fix":"Update your code to `import timeflake` and then use `timeflake.timeflake()` to create instances.","cause":"This usually happens when you remove `from timeflake import Timeflake` (due to the v0.4.0 breaking change) but your code still tries to call `Timeflake()` directly.","error":"NameError: name 'Timeflake' is not defined"}]}