{"id":727,"library":"vine","title":"Vine: Python Promises","description":"Vine is a lightweight Python library that implements 'promises' for managing future evaluations and lazy computations, particularly useful in asynchronous and event-driven programming paradigms. It enhances flexibility by allowing nested promises within callbacks and error handlers. As of version 5.1.0, it is actively maintained by the Celery project.","status":"active","version":"5.1.0","language":"python","source_language":"en","source_url":"https://github.com/celery/vine","tags":["promises","async","future","concurrency","lazy-evaluation"],"install":[{"cmd":"pip install vine","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The core class for creating and managing promises.","symbol":"promise","correct":"from vine import promise"},{"note":"A utility function to wrap functions, especially when chaining promises.","symbol":"wrap","correct":"from vine import wrap"}],"quickstart":{"code":"from vine import promise\n\n# Create a promise instance\np = promise()\n\n# Attach a callback for successful completion\ndef on_success(result):\n    print(f\"Promise fulfilled with: {result}\")\n\np.then(on_success)\n\n# Attach an error handler for failures\ndef on_error(exc):\n    print(f\"Promise failed with error: {exc!r}\")\n\np.on_error = on_error\n\n# Fulfill the promise with a value\nprint(\"Fulfilling promise with 100...\")\np(100)\n# Expected output: Promise fulfilled with: 100\n\n# Create another promise to demonstrate error\np_error = promise()\np_error.then(on_success) # Attach same success handler\np_error.on_error = on_error # Attach same error handler\n\n# Fulfill the promise with an error\nprint(\"\\nFulfilling promise with an exception...\")\np_error.throw(ValueError(\"Operation failed!\"))\n# Expected output: Promise failed with error: ValueError('Operation failed!')","lang":"python","description":"This quickstart demonstrates how to create a promise, attach success and error handlers using `.then()` and `on_error`, and then fulfill the promise with a value or an exception."},"warnings":[{"fix":"Upgrade your Python environment to 3.7 or newer to use `vine` version 5.x. Consider pinning `vine<5.0.0` if you require Python 2.x or older Python 3 versions.","message":"Python 2.x and older Python 3 versions (3.4, 3.5, 3.6) are no longer supported. Version 5.0.0 dropped support for Python 2.x, 3.4, and 3.5. Version 5.1.0 further dropped Python 3.6, making Python 3.7+ the officially supported range for current releases.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Remove imports from `vine.five`. The library is now Python 3.7+ exclusive, so compatibility shims are no longer necessary.","message":"The `vine.five` module, which contained compatibility shims for Python 2/3, was removed in `vine` 5.0.0a1. Any code directly importing or relying on `vine.five` will break.","severity":"breaking","affected_versions":">=5.0.0a1"},{"fix":"If encountering issues after a `vine` upgrade, ensure that its primary consumers (e.g., Celery, Kombu) are also updated to their latest compatible versions. Re-installing the parent library (e.g., `pip install --upgrade celery kombu`) can often resolve implicit dependency conflicts by selecting a compatible `vine` version.","message":"Dependency conflicts can arise when `vine` is used as a transitive dependency by other libraries like Celery or Kombu. Upgrading `vine` independently may lead to issues such as `ModuleNotFoundError` (e.g., for `vine.five` in older setups) or other unexpected behaviors due to incompatible versions between `vine` and its consumers.","severity":"gotcha","affected_versions":"All versions, especially major upgrades"},{"fix":"Investigate the specific code path that triggers the `ValueError('Operation failed!')`. This might involve debugging the promise fulfillment logic to understand the exact condition leading to the exception. If the error is not directly related to `vine`'s public API or its immediate dependencies, consider it an application-specific issue. If it surfaces after a `vine` upgrade, review `vine`'s release notes for subtle behavioral changes that could impact promise-related operations.","message":"A generic `ValueError('Operation failed!')` indicates a functional failure during promise fulfillment. This is likely an application-level error rather than a direct dependency or environmental issue covered by other warnings. It may suggest a change in `vine`'s underlying behavior that affects how promises are handled or how specific operations within the promise logic might now fail under certain conditions.","severity":"gotcha","affected_versions":"All versions, especially major upgrades"},{"fix":"Examine the traceback (if available) to pinpoint the exact source of the ValueError. Review application code paths leading to the 'Operation failed!' message. Ensure all necessary inputs are valid and operations are correctly handled. If `vine` is involved, verify its usage patterns and data inputs are correct according to its API documentation.","message":"A generic 'ValueError('Operation failed!')' was observed, indicating a potential issue within the application logic or an unhandled exception during an operation. This error is too general to be linked to specific `vine` library issues without further context from a traceback.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T18:20:11.830Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install vine`","cause":"The `vine` library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'vine'"},{"fix":"Use the `promise.get()` method to retrieve the result of a resolved promise (this blocks), or provide callbacks to `promise.then()` for asynchronous handling.","cause":"The `vine.Promise` object does not expose a `.result` attribute for direct access to its resolved value; values are retrieved via `get()` or callbacks.","error":"AttributeError: 'Promise' object has no attribute 'result'"},{"fix":"Provide a callable function (e.g., a lambda or a defined function) as the `callback` or `errback` argument to `then()`.","cause":"The `then` method was called with a non-callable object (e.g., a string, integer, or `None`) for its `callback` or `errback` argument, where a function was expected.","error":"TypeError: 'str' object is not callable"},{"fix":"Ensure that `resolve()` or `reject()` is called only once per `vine.Promise` instance, typically by managing state or ensuring resolution logic is not triggered multiple times.","cause":"The `resolve()` or `reject()` method was called on a `vine.Promise` object that has already been resolved or rejected, indicating a logical error in promise management.","error":"RuntimeWarning: Promise already resolved."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"5.1.0","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"17.8M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.4,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"18M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.3,"disk_size":"19.7M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.3,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.7,"import_time_s":0.03,"mem_mb":1.3,"disk_size":"20M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":1.3,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.1,"disk_size":"11.6M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.1,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.5,"import_time_s":0.04,"mem_mb":1.1,"disk_size":"12M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.1,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":1.8,"disk_size":"11.3M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":1.4,"disk_size":"11.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.5,"import_time_s":0.04,"mem_mb":1.6,"disk_size":"12M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.03,"mem_mb":1.2,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"17.3M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.7,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"18M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":1.1,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}