Scarb
Scarb manifest file (Scarb.toml)
| Type | object |
|---|---|
| File match |
Scarb.toml
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/scarb/latest.json |
| Source | https://www.schemastore.org/scarb.json |
Validate with Lintel
npx @lintel/lintel check
This type is used to deserialize Scarb.toml files.
Properties
Global Cairo compiler configuration for this package or workspace profile.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#cairo
The [cairo-plugin] target describing a Cairo compiler plugin artifact.
The [dependencies] table for normal build dependencies.
Your packages can depend on other libraries from registries, Git repositories, or subdirectories on your local file system.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/specifying-dependencies.html
The [dev-dependencies] table for dependencies used only in tests.
Development dependencies are not used when compiling a package for building, but are used for compiling tests.
These dependencies are not propagated to other packages which depend on this package.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/specifying-dependencies.html#development-dependencies
The [executable] target describing how to build an executable entrypoint.
The executable target defines an artifact that can be executed with scarb execute command.
This target should be used for packages that are meant to be executed rather than used as dependencies.
Configure the entry function, allow-syscalls, and whether to emit
Sierra output for the executable.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/targets.html#executable-target
The [features] table defining feature flags for conditional compilation.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/conditional-compilation.html#features
The [lib] target describing how to build the package library.
The library target defines a "library" that can be used by other packages. In other words, if a package does not provide a library target, it cannot be used as a dependency. If not specified, the name of the library defaults to the name of the package. A package can have only one library target.
If the manifest does not list any targets, Scarb will assume the library target with its default parameters.
Controls output artifacts (e.g. sierra, casm) and optional
name overrides.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/targets.html#library
The [package] section with metadata about the current package.
Required for non-workspace members. Contains fields like name,
version, edition, publish, license, etc.
The [patch.<source>] tables to override dependency sources.
Useful to redirect packages to local paths or forks for the resolver.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/overriding-dependencies.html#the-patch-section
The [profile] table defining build profiles.
Common profiles are dev and release. Each profile can override cairo
options and tool settings, and may inherit from another profile.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/profiles.html#profiles
The [scripts] table with custom commands you can run via scarb run <name>.
Script commands are simple shell snippets; in workspaces, they can be
marked with { workspace = true } to indicate inheritance.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/scripts.html#listing-scripts
The [[target.*]] tables to define additional, custom-named targets.
The [target-defaults] table to define defaults applied to targets
(for example, test settings) when not explicitly set on a target.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/targets.html#target-defaults
The [[test]] array of tables defining external test suites.
Each table describes a test target with its own parameters. When absent, Scarb may auto-detect tests under the default tests directory.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/targets.html#test-targets
The [tool] table for third‑party tool configuration namespaces.
Keys under tool.<name> are passed to external tools. Use
{ workspace = true } to opt into workspace inheritance when applicable.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#tool
The [workspace] section defining a multi-package workspace.
Lets you list members, define shared dependencies, scripts,
and defaults inherited by workspace members.
Definitions
Git branch to use when git is specified.
Whether to enable this dependency's default features (defaults to true).
A list of features to enable for this dependency.
Git URL for the dependency source.
Local path to the dependency source, relative to the manifest that declares it.
Custom registry index URL to fetch this dependency from.
Specific Git revision (commit hash) to use when git is specified.
Git tag to use when git is specified.
A semver version requirement for the dependency.
Controls function inlining behavior during compilation.
Can be a non-negative integer (inline small functions up to the given weight)
or one of the predefined strategies: "default", "avoid".
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Allows inheriting keys from a workspace.
Authors list to inherit for members.
A Cairo compiler version requirement that this package is
compatible with. This does not change the compiler version used by Scarb
but enforces compatibility (can be ignored with --ignore-cairo-version).
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#cairo-version
Short description of the package; shown on registries.
URL of the package documentation.
Cairo edition to inherit for members (e.g. "2023_10").
Project homepage URL.
Search keywords for package discovery on registries.
SPDX license expression, e.g. "MIT" or "Apache-2.0".
Path to a license file to include in the package.
Path to a README file, or false to disable including a readme.
URL of the source repository.
Version to inherit for members that opt into
workspace.package.version = ....
A valid Cairo package name.
Must use only ASCII lowercase alphanumeric characters or _, cannot be empty,
cannot start with a digit, cannot be a Cairo keyword, and cannot be just _.
See the full naming rules in the Scarb docs.
Type representing a path for use in Scarb.toml where all paths are expected to be relative to
it.
Add additional information about sierra functions to debug info. Used by cairo-debugger. This feature is unstable and is subject to change.
Add a mapping between sierra statement indexes and lines in cairo code to debug info. A statement index maps to a vector consisting of a line which caused the statement to be generated and all lines that were inlined or generated along the way. Used by cairo-coverage. This feature is unstable and is subject to change.
Add a mapping between sierra statement indexes and fully qualified paths of cairo functions to debug info. A statement index maps to a vector consisting of a function which caused the statement to be generated and all functions that were inlined or generated along the way. Used by cairo-profiler. This feature is unstable and is subject to change.
Do not exit with error on compiler warnings.
Enable auto gas withdrawal and gas usage check.
Whether to enable incremental compilation.
Inlining strategy.
If skip_sierra_optimizations is set to true,
the value of this field has to be set to [None] or [Some] with [InliningStrategy::Avoid].
Whether to add panic backtrace handling to the generated code.
Replace all names in generated Sierra code with dummy counterparts, representing the expanded information about the named items.
For libfuncs and types that would be recursively opening their generic arguments.
For functions, that would be their original name in Cairo.
For example, while the Sierra name be [6], with this flag turned on it might be:
- For libfuncs:
felt252_const<2>orunbox<Box<Box<felt252>>>. - For types:
felt252orBox<Box<felt252>>. - For user functions:
test::foo.
Defaults to false except for "dev" profile.
Disable most possible optimizations that happen during compilation.
Since inlining is an optimization as well, setting this field to true will make the cairo
compiler behave (in the aspect of inlining) as if the inlining_strategy was set
to [InliningStrategy::Avoid].
Do not generate panic handling code. This might be useful for client side proving.
Alias for add_statements_code_locations_debug_info.
If both defined, add_statements_code_locations_debug_info takes precedence.
Alias for add_statements_functions_debug_info.
If both defined, add_statements_functions_debug_info takes precedence.
Represents the package section of a Scarb.toml.
A valid Cairo package name.
Must use only ASCII lowercase alphanumeric characters or _, cannot be empty,
cannot start with a digit, cannot be a Cairo keyword, and cannot be just _.
See the full naming rules in the Scarb docs.
Allows inheriting keys from a workspace.
A list of additional assets to ship with the package (packaged alongside sources). Declare files that should be treated as runtime assets of the package. Paths are relative to the package root and must point to files (directories are not allowed). Assets must exist at build time.
[package]
assets = ["mypackage-oracle.wasm", "some/file.dat"]
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#assets
List of package authors.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#authors
A Cairo compiler version requirement that this package is
compatible with. This does not change the compiler version used by Scarb
but enforces compatibility (can be ignored with --ignore-cairo-version).
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#cairo-version
Short description of the package.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#description
URL to package documentation.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#documentation
An optional key that affects which Cairo edition your package is compiled with.
The editions allow newer Cairo compiler versions to introduce opt-in features that may break existing code.
Setting the edition key in [package] will affect all targets in the package, including test suites etc.
Most manifests have the edition field filled in automatically by scarb new with the latest available edition. If the edition field is not present in Scarb.toml, then the default edition is assumed.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#edition
This field is responsible for setting experimental flags to be used on the package for the compiler.
[package]
experimental-features = ["negative_impls"]
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#experimental-features
Project homepage URL.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#homepage
When packaging a package with scarb package command (see
packaging your package), all files excluded with rules from
.gitignore or .scarbignore files are not included in the resulting package tarball.
This field can be used mark files and subdirectories that should be included in the package tarball, even if those files
would be excluded by rules from ignore files.
The paths are relative to the package root and cannot point to files outside the package.
[package]
include = ["target/some/file.txt"]
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#include
An array of strings that describe your package. This can help when searching for the package on a registry, and it is allowed to choose any words that would help someone find this package.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#keywords
The license field contains the name of the software license that the package is released under.
The license-file field contains the path to a file containing the text of the license (relative to this Scarb.toml).
Package registries must interpret the license field as
an SPDX 2 license expression.
The license name must be a known license from the SPDX license list.
SPDX license expressions support AND and OR operators to combine multiple licenses.
[package]
license = "MIT OR Apache-2.0"
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#license-and-license-file
Path to a license file.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#license-and-license-file
UNSTABLE This package does not depend on Cairo's core.
Whether the package is allowed to be published to a registry.
Defaults to true. Set to false to prevent publishing.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#publish
Re-exports direct cairo-plugin dependencies to all downstream packages.
When declared, any package depending on this one will automatically inherit
these plugins as dependencies. Only direct dependencies with the
cairo-plugin target are eligible for re-export.
[package]
re-export-cairo-plugins = ["proc_macro_package"]
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#re-export-cairo-plugins
This field should be the path to a file in the package root (relative to this Scarb.toml) that contains general
information about the package.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#readme
This field should be a URL to the source repository for your package.
[package]
repository = "<https://github.com/software-mansion/scarb>"
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#repository
A free-form map of additional internet links related to this package. Keys are human-readable link names, and values are URLs.
[package.urls]
"We can help you build your project" = "<https://swmansion.com/products/>"
"We're hiring" = "<https://swmansion.com/careers/>"
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/manifest.html#urls
Cairo compiler configuration for this profile.
The name of another profile to inherit defaults from.
Tool-specific configuration for this profile (under tool.<name>).
Emit CASM assembly for the library target.
Override the default target name.
Emit a compiled Sierra program for the library target, in JSON format.
Emit Sierra in a human-readable text form.
Path to the source root of this target.
Defaults to src/lib.cairo.
If true, will allow syscalls in the program.
In general, syscalls are not allowed in executables, as they are currently not checked.
Program entrypoint.
Executable must have exactly one entrypoint that will be used during the execution.
This must be a function with the #[executable] attribute.
Override the default target name.
Emit a compiled Sierra program for the executable function, in JSON format. This may be useful, for example, for debugging or local profiling.
Path to the source root of this target.
Defaults to src/lib.cairo.
If true, mark this plugin as builtin.
Generally, it should not be used.
Override the default target name.
Path to the source root of this target.
Defaults to src/lib.cairo.
Override the default target name.
Path to the source root of this target.
Defaults to src/lib.cairo.
Allows inheriting keys from a workspace.
Represents the workspace root definition.
List of workspace packages that are allowed to have no audits.
Shared workspace [workspace.dependencies] available to members.
Specifying a workspace dependency is similar to package dependencies,
except you can then inherit the workspace dependency as a package dependency.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/workspaces.html#dependencies
List of workspace member package paths (relative to the workspace root). Supports globs to match multiple paths, using typical filename glob patterns like * and ?.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/workspaces.html#members
Package fields that can be inherited by workspace members
via workspace.package.* (e.g., version, edition, authors).
Setting this field to true will cause Scarb to ignore any versions of dependencies, including transitive ones, that are not marked as audited in the registry. If unable to resolve the dependency tree due to this, Scarb will exit with an error. By default, this field is set to false. This policy applies to the entire workspace. This field is ignored in member packages manifest files, and only the one defined in the workspace root manifest is applied when compiling member packages.
You may whitelist specific packages to ignore the require-audits setting by specifying them in the allow-no-audits key:
[workspace]
allow-no-audits = ["alexandria_math"]
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/workspaces.html#security-and-audits
Workspace-wide [workspace.scripts] available to members.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/workspaces.html#scripts
Defaults applied to targets within workspace members when not configured on the target, must be inherited explicitly. For example:
[target-defaults]
test.workspace = true
Workspace-level [workspace.tool] configuration passed to external tools.
- See official documentation at: https://docs.swmansion.com/scarb/docs/reference/workspaces.html#tool
When { workspace = true } you cannot define other keys that configure the source of
the dependency such as version, registry, path, git, branch, tag, rev.
You can also not define default-features.
Only features is allowed.
If true, indicates that the tool configuration is defined at the
workspace level and should be inherited by members.
If true, the script entry is defined at the workspace level and can be
inherited by member packages.