Dependencies

Moccasin allows for working with either:

Installing GitHub Dependencies

To install a package from GitHub, you can run the following:

mox install ORG/REPO[@VERSION]

For example:

# Without a version
mox install pcaversaccio/snekmate
# With a version
mox install pcaversaccio/snekmate@0.1.0

This will create an entry in your moccasin.toml file that looks like this:

[project]
dependencies = [
    "pcaversaccio/snekmate@0.1.0",
]

Which follows the same syntax that pip and uv to do installs from GitHub repositories. This will also download the GitHub repository into your lib folder.

You can then use these packages in your vyper contracts, for example in an miniaml ERC20 vyper contract:

from lib.snekmate.auth import ownable as ow
initializes: ow

from lib.snekmate.tokens import erc20
initializes: erc20[ownable := ow]
exports: erc20.__interface__

@deploy
@payable
def __init__():
    erc20.__init__("my_token", "MT", 18, "my_token_dapp", "0x02")
    ow.__init__()

Installing pip/PyPI Dependencies

Moccasin let’s you directly install and work with PyPI packages as you would any other python package. PyPi dependencies in moccasin are by default powered by the uv tool. In order to use this, you need to have the uv tool installed. However, you can change this setting to pip in your moccasin.tom.

[project]
installer = "pip" # change/add this setting

As of today, moccasin supports:

  • pip

  • uv

You can also directly install and work with PyPI packages as you would any other python package. To install a package from PyPI, you can run the following:

mox install PACKAGE

For example:

mox install snekmate

Note

Snekmate is both a pypi and a GitHub package.

This will create an entry in your moccasin.toml file that looks like this:

[project]
dependencies = [
    "snekmate==0.1.0",
]