A direct interface with Amalgam compiled DLL, dylib, or so.
Project description
Amalgam™
Amalgam™ is a domain specific language (DSL) developed primarily for genetic programming and instance based machine learning, but also for simulation, agent based modeling, data storage and retrieval, the mathematics of probability theory and information theory, and game content and AI. The language format is somewhat LISP-like in that it uses parenthesized list format with prefix notation and is geared toward functional programming, where there is a one-to-one mapping between the code and the corresponding parse tree. The Howso Engine is an example of a program written in Amalgam.
Resources
General Overview
Coding in Amalgam can be done natively as demonstrated in the Amalgam User Guide or through this Amalgam™ Python wrapper. The Python wrapper handles the binaries for the user so the user just needs to worry about the code.
Supported Platforms
Compatible with Python versions: 3.9, 3.10, 3.11, and 3.12.
Operating Systems
OS | x86_64 | arm64 |
---|---|---|
Windows | Yes | No |
Linux | Yes | Yes |
MacOS | Yes | 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")
Testing
There is a Pytest
unit test suite located in amalgam/test
. The tests in test_standalone.py
will only execute if an Amalgam
binary is located in the default expected path of amalgam/lib/{os}/{architecture}
.
To specify whether test_standalone.py
should use single-threaded or multi-threaded Amalgam
(assuming the appropriate binary is in the above path), set the AMALGAM_LIBRARY_POSTFIX
environment variable to the desired postfix, e.g., -st
or -mt
.
License
Contributing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for amalgam_lang-12.3.10-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6657f4f111762fe458627aae5d7ff70d7efe2f292374216ded5a33205efe38a |
|
MD5 | da56278155451e701393142892cfe52f |
|
BLAKE2b-256 | f95b728b7220d2b0f20c03949294a190bcd5f0edfa2d7b555775f6736938c987 |
Hashes for amalgam_lang-12.3.10-py3-none-manylinux_2_29_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb18e5082a5234358619a434ca92641d1f70bf946d161be9cf7fa4bb6bd499d |
|
MD5 | e74aeb978340d8b336738d8c32a19ee5 |
|
BLAKE2b-256 | dda8d994f0ce6a9290a591b4109114f0001d060bdf4565ed4e417fdbfd65d03d |
Hashes for amalgam_lang-12.3.10-py3-none-manylinux_2_29_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55f990117f26fedbc1ae8aac22bb390d31de9fe23e9cb1bf698b68a2a00fe034 |
|
MD5 | 8bc871d804368560e672ac7267cf153b |
|
BLAKE2b-256 | 1ebb4ee70bc6408edf27588b2ac55918e86768cd0c3029e19ed3f408e6b4da57 |
Hashes for amalgam_lang-12.3.10-py3-none-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1c891aa829a3a064fef612fce8b72b6ec95d928aaad5e7bbc27d183e088882 |
|
MD5 | e2fc24c1c68ae0d31e561ceb7437e5f9 |
|
BLAKE2b-256 | fab5875af05cb925668fe89f3736a3d82e6eb1de33230595fc1aa96f890d8ff2 |
Hashes for amalgam_lang-12.3.10-py3-none-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c7a40f5a07600726b22a617f51b4461b7416d188fcfd05a0e64b3917b20cbb2 |
|
MD5 | 9a39f7fae5631bcd319b6c4c13db8117 |
|
BLAKE2b-256 | d1c71253f927b9f847f1c8840d717cd57fdca9f104d2aeaf3fb2c1b023509f08 |
Hashes for amalgam_lang-12.3.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce4908a6a4aa6a5f8beb692659fb6b653b734c1ed20479dfa717f09194cd0be9 |
|
MD5 | caf93e676326bc5e69bd45a2148aafea |
|
BLAKE2b-256 | 2aae60b1b6c7dffff2ded49709df052eb829e852e3c93bcae99495ea8b0fd56d |