Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
Package Configuration file (daml.yaml)
The
daml.yaml defines the following properties for a package:-
sdk-version: (required) The SDK version that this project uses. The assistant will warn you when it is time to update this setting (see theupdate-checksetting in the global config to control how often it checks, or to disable this check entirely). -
name: (required) The name of the project. This is used to manage automatic upgrades between multiple versions of a package. See Smart Contract Upgrades. -
source: (required) The root directory of your Daml source code files relative to the project root. -
init-script: (optional) The name of a Daml script to run when usingdaml start, of the formModule:name. -
version: (required) The project version. -
exposed-modules: (optional) The Daml modules that are exposed by this project, which can be imported in other projects. If this field is not specified all modules in the project are exposed. -
dependencies: (required) library-dependencies of this project. This should contain at leastdaml-primanddaml-stdlib. You may also wish to depend ondaml-scriptfor testing. -
data-dependencies: (optional) Cross-SDK dependencies of this project, as a list of .dar file paths. -
module-prefixes: (optional) Module import prefixes, for module name collisions. This is a mapping from<package-name>-<package-version>to a module prefix string. For exampleThe above prefix would allow you to import modules frommy-packagewith the prefixV1, as follows:This is useful for multi-version testing, see Smart Contract Upgrades. -
build-options: (optional) A list of flag fordaml build(See Daml Build Flags) that will be applied to any action that involves the Compiler. This includesbuild,test,damlc docsanddamlc lint. Included in these flags are controls for warnings, see Recommended Build Options for our recommended set of warnings to enable. -
sandbox-options: (optional) A list of options that will be passed to Sandbox indaml start. -
script-options: (optional) A list of options that will be passed to the Daml script runner when running theinit-scriptas part ofdaml start.
daml.yaml file supports Environment Variable Interpolation.
Multi-package Configuration file (multi-package.yaml)
Themulti-package.yaml file is used to inform Daml Build and the IDE of projects containing multiple connected Daml packages.
An example is given below:
packages: an optional list of directories containing Daml packages, and by extension,daml.yamlconfig files. These allow Daml Multi-Build to find the source code for dependency DARs and build them in topological order.projects: an optional list of directories containingmulti-package.yamlconfig files, which will extend the above package set for resolving the build order. These exist to allow separation of your project into sub-projects which can still be built when removed from the surrounding environment.
dars field, for providing additional information to Daml Studio. See Daml Studio Jump to definition for more details.
The multi-package.yaml file supports Environment Variable Interpolation.
Environment Variable Interpolation
Both the
This allows you to extract common data, such as the sdk-version, package-name, or package-version outside of a package’s daml.yaml and multi-package.yaml config files support environment variable interpolation on all string fields. Interpolation takes the form of ${MY_ENVIRONMENT_VARIABLE}, which is replaced with the content of MY_ENVIRONMENT_VARIABLE from the calling shell. These can be escaped and placed within strings according to the environment variable interpolation semantics.daml.yaml. For example, you can use an .envrc file or have these values provided by a build system. This feature can also be used for specifying dependency DARs, enabling you to either store your DARs in a common folder and pass its directory as a variable, shortening the paths in your daml.yaml, or pass each dependency as a separate variable through an external build system, which may store them in a temporary cache.
The following example showcases this:
\ prefix: \${NOT_INTERPOLATED}, and interpolation can be disallowed for a config file by setting the environment-variable-interpolation field to false.
${MY_VAR} and ${My_Var} do not reference the same variable.
Recommended build-options
The default set of warnings enabled by the Daml compiler is fairly conservative. This is to avoid overwhelming new users with many warnings. Here are
build-options you might declare in a project’s daml.yaml for a stricter set of warnings.-Werror, which turns every warning into an error; this is especially useful for CI build arrangements. Simply remove or comment out any line to disable that category of warning. See the Daml forum for a discussion of the meaning of these warnings and pointers to other available warnings.