Skip to main content

Code Expression

An executable programming code expression.

Note that CodeExpression nodes lack the executeAuto and executePure properties that CodeChunk nodes have because they will always be executed (when dependencies) change and should be side-effect free.

This schema type is marked as unstable ⚠️ and is subject to change.

Properties

Name@idTypeDescriptionInherited from
programmingLanguageschema:programmingLanguagestringThe programming language of the code.Code
textschema:textstringThe text of the code.Code
codeDependenciesstencila:codeDependenciesArray of (CodeChunk or Parameter)The upstream dependencies of the code. See note 1.CodeExecutable
codeDependentsstencila:codeDependentsArray of (CodeChunk or CodeExpression)The downstream dependents of the code. See note 2.CodeExecutable
compileDigeststencila:compileDigeststringA digest of the content, semantics and dependencies of the node.CodeExecutable
errorsstencila:errorsArray of CodeErrorErrors when compiling (e.g. syntax errors) or executing the chunk.CodeExecutable
executeCountstencila:executeCountintegerA count of the number of times that the node has been executed. See note 3.CodeExecutable
executeDigeststencila:executeDigeststringThe compileDigest of the node when it was last executed.CodeExecutable
executeDurationstencila:executeDurationnumberDuration in seconds of the last execution of the code.CodeExecutable
executeEndedstencila:executeEndedDateThe date-time that the the last execution of the code ended.CodeExecutable
executeRequiredstencila:executeRequired'No', 'NeverExecuted', 'SemanticsChanged', 'DependenciesChanged', 'DependenciesFailed'Whether, and why, a node requires execution or re-execution. See note 4.CodeExecutable
executeStatusstencila:executeStatus'Scheduled', 'ScheduledPreviouslyFailed', 'Running', 'RunningPreviouslyFailed', 'Succeeded', 'Failed', 'Cancelled'Status of the most recent, including any current, execution of the code.CodeExecutable
idschema:idstringThe identifier for this item.Entity
mediaTypeschema:encodingFormatstringMedia type, typically expressed using a MIME format, of the code. See note 5.Code
metastencila:metaobjectMetadata associated with this item.Entity
outputstencila:outputNodeThe value of the expression when it was last evaluated.CodeExpression

Notes

  1. codeDependencies : Note that this excludes CodeExpression nodes since they should not have side effects (e.g. assigning variables) that would cause another node to be dependent upon them.
  2. codeDependents : Note that in comparison to codeDependencies, this property does not allow for Parameter dependents (because parameters are never dependent upon others).
  3. executeCount : Intended to increment with each successive execution of the node, including across sessions. Note that this differs to the execution_count in Jupyter Notebook format which is the "code cell's prompt number" and which resets at the start of each new session.
  4. executeRequired : Derived from a comparison of compileDigest and executeDigest and the executeStatus of dependencies. No: no re-execution is required, the semantics of the code and its dependencies has not changed since it was last executed. NeverExecuted: execution is required because the code has never been executed (or any previous execution was not persisted in its state). SemanticsChanged: re-execution is required because the semantics of the code has changed since it was last executed. DependenciesChanged: the semantics of one or more dependencies (including transitive dependencies) changed since it was last executed. DependenciesFailed: one or more dependencies (including transitive dependencies) failed when it was last executed.
  5. mediaType : This property allows the differentiation of formats using the same programming language or variants of a programming language. An example is using programmingLanguage "json" and encodingFormat "application/ld+json" for JSON-LD code examples.

Available as

Source

This documentation was generated from CodeExpression.schema.yaml.