Skip to main content

Amalgam®

Amalgam® is an LLM-ready, tree-structured language for safe, sandboxed code generation, manipulation, and advanced information-theoretic inference. Unlike traditional languages that prioritize developer shorthand, Amalgam focuses on code-data symmetry and semantic consistency. These properties give it unique strengths in a wide variety of domains, including genetic programming, instance-based machine learning, simulation, agent-based modeling, data storage and retrieval, the mathematics of probability theory and information theory, and game content and AI. This package supports directly calling the language via Python.

Coding in Amalgam can be done natively as demonstrated in the Amalgam User Guide or through this Python wrapper.

Supported Platforms

Compatible with Python versions: 3.11, 3.12, 3.13, and 3.14.

Operating Systems

Binaries are built for the following operating systems, though in theory they could be built for virtually any modern system.

OS x86_64 arm64
Windows Yes No
Linux Yes Yes
MacOS No Yes

Install

To install the current release:

pip install amalgam-lang

Usage

This wrapper allows the user to write and execute Amalgam™ code in Python, just like any other Python program. Once the wrapper is imported, the code handles like native Python code as shown below:

from amalgam.api import Amalgam
import json

amlg = Amalgam()
# Load entity .amlg or .caml file
amlg.load_entity("handle_name", "/path/to/file.amlg")
# Execute a label in the loaded entity, passing parameters as JSON
response = amlg.execute_entity_json("handle_name", "label_name", json.dumps({ "abc": 123 }))
result = json.loads(response)

The wrapper handles the Amalgam language binary (so/dll/dylib) automatically for the user, however the default binary can be overridden using the library_path parameter.

amlg = Amalgam(library_path="/path/to/amalgam-mt.so")

Native backends

The wrapper calls the Amalgam C library through one of two backends: the compiled C extension amalgam._api, or a fallback backend that calls the library through ctypes. Both backends pass bytes arguments to the engine without copying them; the C extension also passes ASCII str arguments, such as json.dumps() output, without the UTF-8 copy the ctypes backend makes, which matters for large payloads. The AMALGAM_PY_BACKEND environment variable selects one:

  • auto (the default, also used when the variable is unset or empty) uses the C extension when it is installed and ctypes otherwise.
  • c uses the C extension, and raises ImportError when it is not installed.
  • ctypes always uses ctypes.

Releases publish cp311-abi3 wheels that include the C extension for Linux (manylinux, x86_64 and aarch64), macOS (arm64), and Windows (amd64), plus a py3-none-any wheel without it that always uses ctypes. A source or editable install (pip install . or pip install -e .) compiles it, which needs a C compiler; without one, the install still succeeds and uses the ctypes backend.

Testing

There is a Pytest unit test suite located in amalgam/test. Most tests load the Amalgam library from amalgam/lib/{os}/{architecture} and are skipped when it is not there; link or copy the libraries from a local Amalgam build into that directory, or download a release matching version.json and copy its lib/ files there.

To specify whether the tests should use single-threaded or multi-threaded Amalgam, set the AMALGAM_LIBRARY_POSTFIX environment variable to the desired postfix, e.g., -st or -mt.

Tests that call the library run once per native backend. The C extension backend is skipped when the extension is not built; pass --require-c-extension (on by default when the CI environment variable is set to a truthy value, meaning anything other than empty, 0, false, no, or off, ignoring case and surrounding whitespace) to make a missing extension a test failure instead.

License

License

Contributing

Contributing

Metadata

Release files for amalgam-lang 37.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amalgam-lang 37.0.0
File Size Uploaded Provenance Actions
amalgam_lang-37.0.0.tar.gz 99.4 MB Without provenance Details for amalgam_lang-37.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for amalgam-lang 37.0.0
File Actions
amalgam_lang-37.0.0-py3-none-any.whl Python 3 none any Details for amalgam_lang-37.0.0-py3-none-any.whl
amalgam_lang-37.0.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for amalgam_lang-37.0.0-cp311-abi3-win_amd64.whl
amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_x86_64.whl CPython 3.11 abi3 Linux glibc 2.29+ x86-64 Details for amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_x86_64.whl
amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_aarch64.whl CPython 3.11 abi3 Linux glibc 2.29+ ARM64 Details for amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_aarch64.whl
amalgam_lang-37.0.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for amalgam_lang-37.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
amalgam_lang-37.0.0-cp311-abi3-macosx_12_0_arm64.whl CPython 3.11 abi3 macOS 12.0+ ARM64 Details for amalgam_lang-37.0.0-cp311-abi3-macosx_12_0_arm64.whl

Total release size: 383.4 MB

Release files / amalgam_lang-37.0.0.tar.gz

Download URL amalgam_lang-37.0.0.tar.gz
Size 99.4 MB
Tags Source
SHA-256 checksum
How to use checksums
55ed1e9d3993a13f68e3b4529b69b3ce71ed85c060bc282f421a8a29c44a5d97
BLAKE2b-256 checksum
How to use checksums
44b83c77502ea3e51c7afad0b2a88af06ee53f73dab0e8b9112a3aca7f216609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-py3-none-any.whl

Download URL amalgam_lang-37.0.0-py3-none-any.whl
Size 99.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fb3346a3eb4dc282e443b8f091d8b03c7afe9ad203d159886ee3d29fd9004cb5
BLAKE2b-256 checksum
How to use checksums
320a60704afeeb4ae321392346c1edef9c288ed13bc4a422285661770e346b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-cp311-abi3-win_amd64.whl

Download URL amalgam_lang-37.0.0-cp311-abi3-win_amd64.whl
Size 6.2 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1397592ab72d02c47280d03a7fe219cd5ebf5d93f7aec2d45840096c7671b381
BLAKE2b-256 checksum
How to use checksums
0ac629d058e923b6c4a2b5be136309561457391333aa51ad36318c093ece34ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_x86_64.whl

Download URL amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_x86_64.whl
Size 81.2 MB
Tags CPython 3.11 Linux glibc 2.29+ x86-64 abi3
SHA-256 checksum
How to use checksums
a0a64897509c5fea4f26b5092cb6f981043acaeb355f56ce1d3fc4b3801d1e3a
BLAKE2b-256 checksum
How to use checksums
da44a38533c318f7ed86d3cbac1ddbde62388cd2acab3a288ed2437accae636d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_aarch64.whl

Download URL amalgam_lang-37.0.0-cp311-abi3-manylinux_2_29_aarch64.whl
Size 8.2 MB
Tags CPython 3.11 Linux glibc 2.29+ ARM64 abi3
SHA-256 checksum
How to use checksums
7f8ea35ea109d45e007e0dac619cdd36a1f6724290bfc88a105b885cfd82f361
BLAKE2b-256 checksum
How to use checksums
aab820dec1412480c8507271884db35c6649b0d678e2a38c839d5d7f46d52b3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL amalgam_lang-37.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 84.1 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
de95715e70afd7d0cfca0effdffe659296665d5ce2eaf20ddda5f507a5dd02f9
BLAKE2b-256 checksum
How to use checksums
0d5c82508410a0022868989c87465a510dd8f751d13b14230bd353acfd1696cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / amalgam_lang-37.0.0-cp311-abi3-macosx_12_0_arm64.whl

Download URL amalgam_lang-37.0.0-cp311-abi3-macosx_12_0_arm64.whl
Size 4.4 MB
Tags CPython 3.11 abi3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
23fddb4fdcd09c5d18ef1a6989350add7d5efb5af0de384e4b79f82f9cc597e2
BLAKE2b-256 checksum
How to use checksums
37cf9d0f91c856397aecb4a5c831bdd15374ddc4390acbd2218663df51892825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for amalgam-lang 37.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

37.0.0 This release

7 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page