Skip to content

Commit f2b5973

Browse files
PhilogyEvalir
andauthored
doc: add info for vyper lib configuration (#1334)
* doc: add info for vyper lib configuration * 🥢 Fix typo Co-authored-by: evalir <[email protected]> * 📝 Add uv note --------- Co-authored-by: evalir <[email protected]>
1 parent 1be562e commit f2b5973

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/config/vyper.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,35 @@ Otherwise, you can set the path to `vyper` in your `foundry.toml` by adding the
1212
path = "/path/to/vyper"
1313
```
1414

15+
#### Vyper libraries via `forge install`
16+
17+
If you want an import like the following to work in your Vyper contract:
18+
19+
```vyper
20+
from snekmate.utils import eip712_domain_separator
21+
```
22+
23+
You can install Vyper the desired library via `forge install` e.g. `forge install pcaversaccio/snekmate`.
24+
25+
You then need to adjust your `foundry.toml` as follows (replacing "snekmate" with the name of your
26+
desired package):
27+
28+
```toml
29+
skip = ["**/lib/snekmate/**"]
30+
libs = ["lib", "lib/snekmate/src"]
31+
```
32+
33+
#### Vyper libraries via `pip`
34+
35+
Alternatively if you want to install the package via `pip` into your system's python configuration
36+
or a virtual environment you can point foundry to it by modifying your `foundry.toml` as follows:
37+
38+
```toml
39+
# Assuming you have a virtual environment in `.venv` and are using Python 3.12
40+
libs = ["lib", ".venv/lib/python3.12/site-packages/"]
41+
```
42+
43+
Note that compatible alternative python package managers like `uv` will work too.
1544

1645
### 2. Solidity tests
1746

0 commit comments

Comments
 (0)