API

Heta Compiler CLI

HetaImporter.heta_helpFunction
heta_help(command::Union{String, Nothing}=nothing)

Displays help for heta-compiler CLI

Arguments:

  • command: command to display. Default is nothing to display general help
HetaImporter.heta_buildFunction
heta_build(
  target_dir::AbstractString;
  declaration::String = "platform",
  units_check::Bool = false,
  log_mode::String = "error",
  log_path::String = "build.log",
  log_level::String = "info",
  debug::Bool = false,
  dist_dir::String = "dist",
  meta_dir::String = "meta",
  source::String = "index.heta",
  type::String = "heta",
  export_format::Union{String, Nothing} = nothing,
)

Builds the models from Heta-based platform

See heta compiler docs for details: https://hetalang.github.io/hetacompiler/cli-references.html#running-heta-build-with-options

Arguments:

  • target_dir : path to the directory where Heta platform is located
  • declaration : filepath to the platform declaration file. Default is "platform"
  • units_check : if set to true units will be checked for the consistency
  • log_mode : log mode. Default is "error"
  • log_path : path to the log file. Default is "build.log"
  • log_level : log level to display. Default is "info"
  • debug : turn on debug mode. Default is false
  • dist_dir : directory path, where to write distributives to. Default is "dist"
  • meta_dir : meta directory path. Default is "meta"
  • source : path to the main heta module. Default is "index.heta"
  • type : type of the source file. Default is "heta"
  • export_format : export the model to the specified format: julia,dynms,{format:SBML,version:L3V1}

Julia File Generation

HetaImporter.build_dynms_fileFunction
build_dynms_file(heta_dir; build_dir, kwargs...)

Build a Heta platform and write a DynMS JSON file to joinpath(build_dir, DYNMS_MODEL_DIR, DYNMS_MODEL_NAME).

The returned value is the generated DynMS JSON file path.

Arguments:

  • heta_dir : path to a Heta source directory containing a platform declaration file
  • build_dir : directory path where generated files are written. Default is joinpath(heta_dir, "dist")
  • spaceFilter : filter for namespaces in the Heta model. Can be a string, a vector of symbols, or nothing. Default is nothing
  • kwargs : other arguments supported by heta_build
HetaImporter.build_julia_fileFunction
build_julia_file(heta_dir; build_dir, ir_format=:julia, kwargs...)

Build a Heta platform and write a Julia source file to joinpath(build_dir, JULIA_MODEL_DIR, JULIA_MODEL_NAME).

When ir_format == :julia, heta-compiler writes Julia code directly. When ir_format == :dynms, heta-compiler writes DynMS JSON first; HetaImporter then converts that DynMS IR to readable Julia source.

The returned value is the generated Julia file path.

Arguments:

  • heta_dir : path to a Heta source directory containing a platform declaration file
  • ir_format : format of the intermediate representation of the model. Default is :julia
  • build_dir : directory path where generated files are written. Default is joinpath(heta_dir, "dist")
  • spaceFilter : filter for namespaces in the Heta model. Can be a string, a vector of symbols, or nothing. Default is nothing
  • kwargs : other arguments supported by heta_build
HetaImporter.write_dynms_juliaFunction
write_dynms_julia(dynms_json, julia_path)

Write readable Julia code generated from DynMS JSON. This is intended for debugging, review, and packages that load generated Julia source.

DynMS Parsing

HetaImporter.parse_dynms_specFunction
parse_dynms_spec(dynms_json::AbstractString)
parse_dynms_spec(data::AbstractDict)

Parse a DynMS JSON file or already-loaded JSON dictionary into a DynMSSpec.

The returned specification contains parsed model definitions, Julia expression trees for mathematical expressions, event definitions, and metadata from the DynMS generator.

HetaImporter.parse_dynms_modelFunction
parse_dynms_model(model::AbstractDict)

Parse one DynMS model dictionary into a DynMSModelDef.

This is mainly useful when working with a model entry extracted from a DynMS document. For normal use, prefer parse_dynms_spec.