DamlForge lets you write Canton smart contracts in .vy files. These use Python
syntax with a few contract-specific (Vyper-flavored) keywords. The forge compiler turns each
.vy file into ordinary Daml source, and DPM, the Daml package manager, builds,
tests, and ships that source. Nothing in a .vy file runs as Python: the file is
parsed, checked, and lowered straight to Daml.
How it works
1. Install DamlForge (Python 3.11 or newer):
pip install damlforge
2. Write a contract in Main.vy:
from forge.builtins.daml_lang import create
from forge.models import ContractId, Party, choice, template
@template
class Asset:
issuer: Party
owner: Party
name: str
signatory: Party = issuer
observer: Party = owner
ensure: bool = name != ""
@choice(controller=owner, consuming=True)
def give(self, new_owner: Party) -> ContractId[Asset]:
return create(Asset(issuer=self.issuer, owner=new_owner, name=self.name))
3. Compile it to Daml:
forge daml Main.vy -o out/
forge generates out/Main.daml:
module Main where
template Asset
with
issuer : Party
owner : Party
name : Text
where
signatory issuer
observer owner
ensure name /= ""
choice Give : ContractId Asset
with
new_owner : Party
controller owner
do
let self = this
create (Asset with issuer = self.issuer, owner = new_owner, name = self.name)
More: see the full documentation, from setup to packaging.
Documentation
The guide at docs.damlforge.noders.services
walks through DamlForge from setup to packaging. Every example in it compiles
with forge dar and is covered by a passing Daml Script test.
| # | Page | Covers |
|---|---|---|
| 1 | Development Environment Setup | Installing DPM and DamlForge, creating a project, editor setup, day-to-day commands |
| 2 | Language Fundamentals | Types, structs, enums, variants, Optional, functions, control flow, dates, imports |
| 3 | Compiler Errors | Every DF error code, with the message, cause, and fix |
| 4 | Contract Templates | Templates, signatories, observers, ensure, testing with Daml Script |
| 5 | Choices | Choices as methods and as delegation, updating a contract in place, consuming and non-consuming choices, a simple cash model |
| 6 | Design Patterns | Propose-accept, delegation, authorization, locking, multi-party agreements |
| 7 | Working with Time | datetime support, ledger time, deadlines and time windows, setTime/passTime |
| 8 | Contract Keys | key and maintainer, by-key lookups, Daml 3.5 requirements |
| 9 | Interfaces | Declaring and implementing interfaces, views, converting contract IDs |
| 10 | Building and Packaging | forge dar, daml.yaml settings, multi-package projects, DAR contents |
| 11 | Variants | Constructor styles, recursive and generic variants, current limitations |
Claude Code skill
See .claude/skills/damlforge-vy-lang/
for the full language reference. It is also a Claude Code skill: Claude Code uses
it to write, read, and review .vy files, translate .daml files to .vy, and
explain DF compiler errors in this repository.
Installing
DamlForge is published on PyPI as damlforge. It installs the forge command and the forge Python package:
python -m venv .venv
source .venv/bin/activate # .venv\Scripts\activate on Windows
pip install damlforge
Using DamlForge in another project (pip, Poetry)
Add DamlForge as a dependency of the project that holds your .vy contracts.
With pip, pin it in requirements.txt:
damlforge==<version>
Then install and build:
pip install -r requirements.txt
forge dar path/to/daml_project -o out.dar
With Poetry, add it to a dev group, since it's only needed at build time:
poetry add --group dev damlforge@<version>
This records it in your pyproject.toml:
[tool.poetry.group.dev.dependencies]
damlforge = { version = "<version>", extras = ["stubgen"] }
Leave out extras if you don't need forge stubs. Run the compiler through Poetry's environment:
poetry install
poetry run forge dar path/to/daml_project -o out.dar
The stubs for the Daml standard library (DA.*, GHC.*), Splice (Splice.*), forge.models, and forge.builtins ship inside the package. Once it's installed, .vy files import them directly, with no extra path setup:
from DA.List import sort
from forge.builtins.daml_lang import create
from forge.models import Party, choice, template
Splice stubs also need the matching Splice DAR in data-dependencies in daml.yaml. See Development Environment Setup and Building and Packaging.
Installing from GitHub Releases
Releases are also built by CI on every v*.*.* tag and attached to the corresponding GitHub Release as damlforge-<version>-py3-none-any.whl, which installs with pip install damlforge-<version>-py3-none-any.whl.
Upgrading
Upgrade in place:
pip install -U damlforge==<new-version>
If you installed the old forge wheel from GitHub Releases, run pip uninstall forge first, since the distribution was renamed to damlforge.
Publishing to PyPI
.github/workflows/publish-pypi.yml is started by hand from the Actions tab (Run workflow) with the version to publish. It builds the sdist and wheel with that version and uploads them through PyPI trusted publishing, so no API token is stored in the repository.
Commands
Installing the wheel puts a forge command on your PATH. It's a Click CLI with a subcommand per compile target:
forge --help # top-level usage and subcommand list
forge --version # installed forge version
forge daml --help # per-subcommand usage (also: forge dar, forge json, forge stubs)
forge daml path/to/file.vy -o out/ # .vy -> out/<Module>.daml + out/<Module>.map.json
forge daml path/to/vy_source_dir -o out/ # compiles top-level .vy files in the directory
forge dar path/to/vy_project -o out.dar # compile the project and build a real .dar
forge json path/to/file.vy --pretty-json # .vy -> JSON AST, printed to stdout
forge stubs input.dar -o generated/ # .dar -> generated .vy stubs
forge <path> [options] (no subcommand) is shorthand for forge daml <path> [options].
forge stubs uses dazl, which is installed together with DamlForge.
See Building and Packaging for daml.yaml
requirements, DPM options, and stub generation.
Examples
The examples/ directory has complete projects to compile and study:
| Example | Shows |
|---|---|
examples/basic/ |
Templates, interfaces, cross-module imports |
examples/token_standard/ |
A Splice token-standard holding and transfer flow |
examples/splice-api-token-burn-mint-v1/ |
A template implementing the external Splice Holding interface |
examples/crowd_loans/ |
Enums, GenMap, nested loops, Splice data dependencies |
examples/splice-util-batched-markers/ |
A Splice featured-app template with structs, choices, and Splice API data dependencies |
Building the wheel yourself
If you have the source checked out:
pip install build
python -m build # or: make build
produces dist/damlforge-<version>-py3-none-any.whl, versioned from the nearest git tag (see Makefile's build/release targets and .github/workflows/build-wheel.yml).
Local development
python -m venv .venv
source .venv/bin/activate
pip install -e . # installs forge + runtime deps (click, etc.) in editable mode
pip install --group test # pytest + friends
pip install --group lint # black/flake8/isort/mypy
--group needs pip>=25.1 (pip install -U pip first if needed); otherwise install the pinned packages listed under [dependency-groups] in pyproject.toml directly.
With an editable install, forge/python -m forge picks up changes under forge/ immediately - no reinstall needed:
forge --help
forge daml examples/basic/simple.vy -o /tmp/out && cat /tmp/out/Simple*.daml
Run the test suite and linters:
pytest -q # or: make test
make lint # mypy, black, flake8, isort in sequence
License
DamlForge is licensed under the Apache License, Version 2.0.
Copyright 2026 Noders Team. Author: Artem Bogomaz artembogomaz@gmail.com.
Metadata
Release files for damlforge 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| damlforge-0.0.14.tar.gz | 413.9 kB | With provenance | Details for damlforge-0.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| damlforge-0.0.14-py3-none-any.whl | Python 3 | none | any | Details for damlforge-0.0.14-py3-none-any.whl |
Total release size: 728.8 kB
Release files / damlforge-0.0.14.tar.gz
| Download URL | damlforge-0.0.14.tar.gz |
|---|---|
| Size | 413.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4881529abe9ed1e9e3567cefd52add9192d6656eb899dc86c2a0b59616d8514e
|
|
BLAKE2b-256 checksum How to use checksums |
74146bfe045d56c68e0d4b9c0e2689d061e082663ed53b2d624f1c757a2c5d20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / damlforge-0.0.14-py3-none-any.whl
| Download URL | damlforge-0.0.14-py3-none-any.whl |
|---|---|
| Size | 314.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be3de29ffdbda2627543a37200467ee184d51533ec995bd18a2577505bb1c659
|
|
BLAKE2b-256 checksum How to use checksums |
2f532b77289f44399fd81af185eca83bc08c402d52fc5562167a7d4e7284d50a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for damlforge 0.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for damlforge-0.0.14.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.