I'm leaving the Zed extension pointing to the older commit of the Tree-sitter grammar, I'll update that after this version bump. It's a bit awkward to do it this way around, but there are circular dependencies that can't be avoided. Maybe with an attack on SHA1 it can be done in theory, but let's not go there.
2.3 KiB
Installation
RCL is written in Rust and builds with Cargo. RCL has few dependencies, so it’s quick and easy to build from source, but you can also use one of the options below that automate the process.
As a Nix flake
The repository includes a Nix flake. You can run RCL with a flake-enabled version of Nix, such as Nix 2.18:
nix run 'github:ruuda/rcl?ref=v0.8.0' -- --help
The Nix flake also includes the Python module:
PYTHONPATH=$(nix build github:ruuda/rcl?ref=v0.8.0#pyrcl --print-out-paths)/lib python3
The Nix flake also includes a shell with all the tools needed for development, as well as the environment that is tested on CI.
From source
To build from source, clone the repository from one of the two mirrors:
git clone https://github.com/ruuda/rcl.git
git clone https://codeberg.org/ruuda/rcl.git
Then build with Cargo. The repository includes a rust-toolchain.toml
file that specifies a compatible Rust version. When Cargo is managed by
Rustup, Rustup will automatically fetch the right toolchain.
cargo build --release
Put the binary on your PATH to be able to use it system-wide, e.g.:
cp target/release/rcl ~/.local/bin
To build a static binary rather than a dynamically linked one:
cargo build --release --target x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/rcl ~/.local/bin
Python module from source
To build the Python module, follow the steps as before, but build the pyrcl
directory:
cargo build --release --manifest-path pyrcl/Cargo.toml
Then rename libpyrcl.so to rcl.so so that Python can discover it, and copy
it to a location on the PYTHONPATH, e.g.:
cp target/release/libpyrcl.so ./rcl.so
Now you can use the module as any regular one:
$ python3
>>> import rcl
>>> rcl.loads("10 + 32")
42
It is also possible to build a wheel that can be installed into a virtualenv using Maturin.