This is a reimplementation from scratch of the C++ Hyperon prototype in the Rust programming language. This project replaces the previous prototype. See MeTTa scripts and Python examples to become familiar with Hyperon features.
If you find troubles with the installation, see the Troubleshooting section below.
Install latest stable Rust, see Rust installation page. Python 3 (3.6 or later), GCC (7.5 or later) and CMake (3.10 or later) are required to build C and Python API.
Install cbindgen:
cargo install --force cbindgen
Install Conan and make default Conan profile:
python3 -m pip install conan==1.47
conan profile new --detect default
Install Python library and dependencies in development mode (execute following command in the top directory of repository):
python3 -m pip install -e ./python[dev]
A docker image can be used to run a reproducible environment. See instructions inside the Dockerfile. If the docker image doesn't work, please raise an issue.
Build and test the library:
cd ./lib
cargo build
cargo test
To enable logging during tests execute:
RUST_LOG=hyperon=debug cargo test
Generate docs:
cd ./lib
cargo doc --no-deps
Docs can be found at ./lib/target/doc/hyperon/index.html
.
Setup build:
mkdir -p build
cd build
cmake ..
To run release build use -DCMAKE_BUILD_TYPE=Release
cmake flag.
Build and run tests:
make
make check
In order to run examples you need to add Python libraries into the PYTHONPATH
after compilation:
cd build
export PYTHONPATH=$PYTHONPATH:`pwd`/python
Run MeTTa script from command line:
cd python/tests
python3 metta.py ./scripts/<name>.metta
Different IDEs may require different tweaks to support the languages used in the codebase. The language servers which we use for development are:
- Rust Language Server;
- clangd, generate compile
commands for the
clangd
usingcmake
variable:cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=Y ..
- Python LSP server.
If you see the following cmake
output:
ERROR: Not able to automatically detect '/usr/bin/cc' version
ERROR: Unable to find a working compiler
WARN: Remotes registry file missing, creating default one in /root/.conan/remotes.json
ERROR: libcheck/0.15.2: 'settings.compiler' value not defined
Try to create the default Conan profile manually:
conan profile new --detect default
If it doesn't help, then try to manually add compiler
, compiler.version
and
compiler.libcxx
values in the default Conan profile
(~/.conan/profiles/default
).
For example:
conan profile update settings.compiler=gcc default
conan profile update settings.compiler.version=7 default
conan profile update settings.compiler.libcxx=libstdc++ default
Please ensure you are using the latest stable version:
rustup update stable