{"id":23242,"library":"amalgam-lang","title":"Amalgam Language Python Bindings","description":"Python bindings for the Amalgam language runtime, providing a direct interface with the compiled Amalgam shared library (.dll, .dylib, .so). Version 29.0.1 supports Python >=3.10. The library is actively maintained with frequent releases.","status":"active","version":"29.0.1","language":"python","source_language":"en","source_url":"https://github.com/Amalgam-Language/amalgam-lang","tags":["amalgam","language-bindings","native","shared-library","python-interface"],"install":[{"cmd":"pip install amalgam-lang==29.0.1","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core package providing the Amalgam runtime interface.","package":"amalgam-lang","optional":false}],"imports":[{"note":"Module name is 'amalgam', not 'amalgam-lang'. The main class is Amalgam.","wrong":"import amalgam Amalgam","symbol":"Amalgam","correct":"from amalgam import Amalgam"},{"note":"DirectInterface is in a submodule 'direct'. Common mistake to import from top-level.","wrong":"from amalgam import DirectInterface","symbol":"DirectInterface","correct":"from amalgam.direct import DirectInterface"}],"quickstart":{"code":"from amalgam import Amalgam\n\n# Initialize the library, providing path to amalgam shared library if needed\n# If the library is in standard locations, leave blank.\namalgam = Amalgam()\n\n# Load an Amalgam model\nmodel = amalgam.load_model('path/to/model.amalgam')\n\n# Run a simple query\nresult = model.execute(\"index\")  # or any Amalgam command\nprint(result)","lang":"python","description":"Initialize the Amalgam runtime, load a model, and execute a command."},"warnings":[{"fix":"Set the environment variable 'AMALGAM_LIB_PATH' before creating Amalgam instance, or ensure the library is in a default search path.","message":"Version 26+ changed the initialization signature. Amalgam() no longer accepts arguments like 'lib_path' directly; the shared library path must be set via environment variable 'AMALGAM_LIB_PATH' or the platform-specific default search.","severity":"breaking","affected_versions":">=26.0.0"},{"fix":"Use model.execute(...) instead of model.execute_query(...).","message":"The method 'execute_query' is deprecated in favor of 'execute'. 'execute_query' may be removed in future versions.","severity":"deprecated","affected_versions":">=28.0.0"},{"fix":"Download the appropriate Amalgam shared library from the official Amalgam releases and place it in a directory included in the system's library search path, or set AMALGAM_LIB_PATH.","message":"Amalgam library requires a valid Amalgam shared library (.dll/.dylib/.so). The Python package does not include the native runtime by default. Missing library leads to a vague ImportError or RuntimeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use thread-local instances or serialize access to a single Amalgam object.","message":"Thread safety is not guaranteed. Running multiple Amalgam instances from different threads may cause crashes.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Python 3.10 or later.","message":"Python 3.9 support was dropped in version 28.0.0.","severity":"deprecated","affected_versions":">=28.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the package is installed: pip install amalgam-lang==29.0.1. Then use: from amalgam import Amalgam","cause":"The package may not be installed correctly, or the wrong import path is used. The class Amalgam exists in the top-level __init__.py.","error":"ImportError: cannot import name 'Amalgam' from 'amalgam'"},{"fix":"Set the environment variable AMALGAM_LIB_PATH to the directory containing the shared library, or install the library in a system path. For example: export AMALGAM_LIB_PATH=/usr/local/lib","cause":"The native Amalgam shared library is missing or not in the library search path.","error":"RuntimeError: Unable to load Amalgam shared library"},{"fix":"Use: from amalgam.direct import DirectInterface","cause":"Importing from the wrong module; DirectInterface is in amalgam.direct, not amalgam directly.","error":"AttributeError: module 'amalgam' has no attribute 'DirectInterface'"},{"fix":"Amalgam() now takes no arguments. Set the library path via environment variable instead.","cause":"Trying to pass arguments to Amalgam() constructor in version >=26.","error":"TypeError: Amalgam() takes no arguments"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}