flync.sdk¶
This page is a full reference of the SDK for developers and contributors to FLYNC.
FLYNC Workspace¶
- class FLYNCWorkspace(name: str, workspace_path: Path | str = '', configuration: WorkspaceConfiguration | None = None)¶
Bases:
objectWorkspace class managing documents, objects, and diagnostics.
This class provides methods to ingest documents, run analysis, and expose semantic and source APIs for use by the SDK and language server.
- Attributes:
name (str): Name of the workspace.
documents (Dict[str, Document]): Mapping of document URIs to Document objects.
objects (Dict[ObjectId, SemanticObject]): Semantic objects indexed by ObjectId.
sources (Dict[ObjectId, SourceRef]): Source references indexed by ObjectId.
dependencies (Dict[ObjectId, Set[ObjectId]]): Dependency graph.
reverse_deps (Dict[ObjectId, Set[ObjectId]]): Reverse dependency graph.
_diagnostics (list[Diagnostic]): Collected diagnostics.
- classmethod load_workspace(workspace_name: str, workspace_path: Path | str) FLYNCWorkspace¶
loads a workspace object from a location of the Yaml Configuration.
- Args:
workspace_name (str): The name of the workspace.
workspace_path (str | Path): The path of the workspace files.
Returns: FLYNCWorkspace
- generate_configs(uri: Path | str | None = None)¶
Save the workspace to the given path.
Creates the output directory (if it does not exist) and writes a simple representation of the workspace. If a FLYNCModel has been loaded via
load_flync_model, it attempts to serialize the model to JSON.- Args:
- uri (str | Path | None): Optional argument to save specific file
instead of the entire workspace.
Returns: None
Configuration module for FLYNC SDK.
Provides a simple configuration object.
- class WorkspaceConfiguration(flync_file_extension: str = '.flync.yaml')¶
Bases:
objectConfiguration object for the FLYNC SDK.
Document¶
- class Document(uri: Path | str, text: str)¶
Bases:
objectRepresents a YAML document with parsing capabilities.
- Attributes:
uri (str): The unique identifier for the document.
text (str): The raw YAML content.
ast (Any | None): The parsed abstract syntax tree, or None if not parsed.
- parse()¶
Parse the YAML text into an abstract syntax tree.
Returns: None
- update_text(text: str)¶
Update the document’s text and re-parse it.
- Args:
text (str): The new YAML content.
Returns: None