Skip to content

Environment variables that change how SmartPy is run ​

Here is a list of some useful ways to change how SmartPy is run.

They can be set when calling python on a SmartPy test scenario, as in:

bash
$ SMARTPY_DEBUG=1 python welcome.py

SMARTPY_OUTPUT_DIR ​

If not None then set to output compilation files to a different directory.

SMARTPY_OASIS ​

If not None then set to point to the filepath of a different oasis binary.

SMARTPY_CANOPY ​

If not None then set to point to the filepath of a different canopy binary.

SMARTPY_DEBUG ​

If not None then adds extra information to the logging and exception reporting.

SMARTPY_USE_DOCKER ​

If not None then forces to use docker container - useful for testing.

NOTE docker is used automatically if on Darwin MacOS.

SMARTPY_PYTHON_PARSER ​

Set SMARTPY_PYTHON_PARSER=1 to use the optional SmartPy parser written in Python instead of the default parser in canopy.

The Python parser is built on the standard-library ast module. It works with CPython and with Pyodide in the browser. Use it when you want the same parse path locally as in the Web IDE, or when debugging parser behaviour without canopy.

bash
$ SMARTPY_PYTHON_PARSER=1 python welcome.py

SMARTPY_DEPENDENCIES_FILE ​

See Flags.

SMARTPY_FLAGS ​

See Flags.

SMARTPY_CONTRACT_COVERAGE ​

When set to a non-empty value other than 0, SmartPy adds the contract-coverage scenario flag when creating a test scenario. Use this when running scenarios under coverage.py to record executed lines in SmartPy contract source files (.py modules and .spy files) and merge them into the coverage report. You can also enable the flag with SMARTPY_FLAGS=--contract-coverage, or with scenario.add_flag("contract-coverage") before the scenario adds the modules to measure: modules passed to sp.test_scenario are added before any add_flag call. See Measuring coverage.