This project has been archived by its maintainers, and is no longer receiving any updates.
Quick Start
Ape compiler plugin around the Cairo language.
Dependencies
Installation
via pip
You can install the latest release via pip:
pip install ape-cairo
via setuptools
You can clone the repository and use setuptools for the most up-to-date version:
git clone https://github.com/ApeWorX/ape-cairo.git
cd ape-cairo
python3 setup.py install
Quick Usage
First, you will need to tell ape-cairo how to use the Cairo compiler.
There are two ways to do this:
- Configure your Cairo manifest path in your
ape-config.yaml. - Build or add Cairo compiler binaries to your $PATH.
Both options require cloning the Cairo compiler source code:
git clone git@github.com:starkware-libs/cairo.git
cd cairo
git fetch --all
git checkout <tag> # e.g. v1.0.0-alpha.6
To do the first option, add the following to your ape-config.yaml file:
cairo:
manifest: /Users/home/path/to/cairo/Cargo.toml
Now, when compiling, Ape will use the command cargo run --bin <BIN> --manifest-path <CAIRO-MANIFEST>.
To do the second option instead, build the release binaries for your OS:
cargo build --release
NOTE: This requires being in the same directory as Cairo.
After the build completes, add the target path to your global $PATH variable.
(You may want to add this to your .zshrc / .bashrc file):
export PATH=$PATH:$HOME/path/to/cairo/target/release
Verify you have sierra-compile in your $PATH by doing:
which sierra-compile
WARN: Note that when using Cairo-lang the python package, it will add conflicting binaries with the same name.
You will need to ensure you are using the correct binaries if you have cairo-lang the Python package installed.
which starknet-compile
Alternatively, the first approach avoids this problem.
Using the Compiler
In a project directory where there are .cairo files in your contracts/ directory, run the compile command:
ape compile
It should create ContractType objects in your .build/ folder containing the necessary Sierra code for contract declaration.
Development
This project is in development and should be considered a beta. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.
Release files for ape-cairo 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ape-cairo-0.6.1.tar.gz | 20.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ape_cairo-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.7 kB
Release files / ape-cairo-0.6.1.tar.gz
| Download URL | ape-cairo-0.6.1.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6820045c0d70907f407433bab1812b44f7863a0cb4544469a2165643ee6b1db
|
|
BLAKE2b-256 checksum How to use checksums |
be4249ff4501c4c55b2dc80cb7f62b47d3910e921a03e2d4f06a58cbf3a9ea2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / ape_cairo-0.6.1-py3-none-any.whl
| Download URL | ape_cairo-0.6.1-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18a79481534cd39c626bb003052d7b25c769ae40bf299213eb7d34233217e45e
|
|
BLAKE2b-256 checksum How to use checksums |
b27bccf9fa024619351cfcfc819f3dcaddc65f6d5d65ec1ac2dfbacc95e98ec7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|