dataface 0.1.5.dev384__py3-none-any.whl → 0.1.6.dev34__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dataface/DATAFACE_SYNTAX.md +0 -2
- dataface/__init__.py +2 -1
- dataface/agent_api/__init__.py +2 -2
- dataface/agent_api/_paths.py +3 -3
- dataface/agent_api/chat.py +5 -5
- dataface/agent_api/describe.py +1 -1
- dataface/agent_api/docs/yaml-reference.md +40 -29
- dataface/agent_api/pack.py +2 -1
- dataface/agent_api/{project.py → project_session.py} +50 -53
- dataface/agent_api/query.py +37 -0
- dataface/agent_api/render_face.py +7 -7
- dataface/agent_api/validate.py +4 -4
- dataface/ai/agent.py +44 -8
- dataface/ai/context.py +3 -3
- dataface/ai/llm.py +22 -1
- dataface/ai/mcp/server.py +5 -5
- dataface/ai/tools/__init__.py +11 -11
- dataface/cli/commands/describe.py +3 -3
- dataface/cli/commands/query.py +15 -15
- dataface/cli/commands/render.py +7 -7
- dataface/cli/commands/schema.py +7 -7
- dataface/cli/commands/serve.py +2 -1
- dataface/cli/commands/validate.py +3 -3
- dataface/core/__init__.py +2 -1
- dataface/core/compile/colors.py +0 -44
- dataface/core/compile/compiler.py +15 -22
- dataface/core/compile/config.py +69 -97
- dataface/core/compile/data_table_attachment.py +22 -8
- dataface/core/compile/inherit_graph.py +134 -18
- dataface/core/compile/inherit_registry.yaml +493 -1
- dataface/core/compile/inherit_resolver.py +16 -3
- dataface/core/compile/models/chart/authored.py +1 -6
- dataface/core/compile/models/chart/normalized.py +2 -2
- dataface/core/compile/models/chart/resolved.py +2 -2
- dataface/core/compile/models/factories.py +15 -1
- dataface/core/compile/models/markers.py +22 -0
- dataface/core/compile/models/style/authored.py +22 -5
- dataface/core/compile/models/style/resolved.py +30 -25
- dataface/core/compile/models/style/theme.py +303 -120
- dataface/core/compile/normalize_charts.py +1 -5
- dataface/core/compile/sizing.py +157 -43
- dataface/core/compile/style_cascade.py +5 -3
- dataface/core/connections.py +8 -5
- dataface/core/dashboard.py +6 -8
- dataface/core/defaults/palettes/categorical/category-10-dark.yml +4 -4
- dataface/core/defaults/palettes/categorical/category-10-ghost.yml +36 -0
- dataface/core/defaults/palettes/categorical/category-10-light.yml +25 -33
- dataface/core/defaults/palettes/categorical/category-10.yml +4 -2
- dataface/core/defaults/palettes/categorical/editorial-10-dark.yml +2 -1
- dataface/core/defaults/palettes/categorical/editorial-10-ghost.yml +36 -0
- dataface/core/defaults/palettes/categorical/editorial-10-light.yml +34 -0
- dataface/core/defaults/palettes/categorical/editorial-10.yml +8 -0
- dataface/core/defaults/themes/_base.yaml +3 -0
- dataface/core/defaults/themes/dark.yaml +18 -0
- dataface/core/defaults/themes/stark.yaml +21 -1
- dataface/core/execute/adapters/adapter_registry.py +2 -1
- dataface/core/inspect/renderer.py +2 -1
- dataface/core/project.py +54 -0
- dataface/core/render/chart/arc_attached_table.py +18 -1
- dataface/core/render/chart/decisions.py +105 -2
- dataface/core/render/chart/pipeline.py +73 -164
- dataface/core/render/chart/profile.py +106 -4
- dataface/core/render/chart/render_single.py +11 -7
- dataface/core/render/chart/serialization.py +9 -12
- dataface/core/render/chart/standard_renderer.py +5 -2
- dataface/core/render/chart/vega_lite.py +3 -3
- dataface/core/render/face_api.py +3 -2
- dataface/core/render/faces.py +32 -9
- dataface/core/render/nav.py +22 -4
- dataface/core/render/placeholder.py +1 -1
- dataface/core/render/renderer.py +1 -1
- dataface/core/render/templates/nav/nav.css +3 -1
- dataface/core/render/templates/nav/nav.html +6 -0
- dataface/core/render/templates/nav/nav.js +15 -0
- dataface/core/render/templates/variable_controls/checkbox.html +6 -0
- dataface/core/render/templates/variable_controls/container.html +27 -0
- dataface/core/render/templates/variable_controls/date.html +6 -0
- dataface/core/render/templates/variable_controls/daterange.html +16 -0
- dataface/core/render/templates/variable_controls/number.html +6 -0
- dataface/core/render/templates/variable_controls/readonly.html +4 -0
- dataface/core/render/templates/variable_controls/select.html +7 -0
- dataface/core/render/templates/variable_controls/slider.html +9 -0
- dataface/core/render/templates/variable_controls/text.html +6 -0
- dataface/core/render/variable_controls.py +137 -100
- dataface/core/serve/bootstrap.py +8 -7
- dataface/core/serve/server.py +29 -23
- dataface/integrations/markdown.py +6 -4
- {dataface-0.1.5.dev384.dist-info → dataface-0.1.6.dev34.dist-info}/METADATA +2 -1
- {dataface-0.1.5.dev384.dist-info → dataface-0.1.6.dev34.dist-info}/RECORD +94 -82
- mdsvg/renderer.py +171 -27
- mdsvg/style.py +43 -0
- dataface/core/compile/chart_type_detection.py +0 -490
- {dataface-0.1.5.dev384.dist-info → dataface-0.1.6.dev34.dist-info}/WHEEL +0 -0
- {dataface-0.1.5.dev384.dist-info → dataface-0.1.6.dev34.dist-info}/entry_points.txt +0 -0
- {dataface-0.1.5.dev384.dist-info → dataface-0.1.6.dev34.dist-info}/licenses/LICENSE +0 -0
dataface/DATAFACE_SYNTAX.md
CHANGED
dataface/__init__.py
CHANGED
|
@@ -23,7 +23,8 @@ Quick Start:
|
|
|
23
23
|
...
|
|
24
24
|
... # Create executor and render
|
|
25
25
|
... from dataface.core.compile.config import load_project_sources
|
|
26
|
-
...
|
|
26
|
+
... from dataface.core.project import Project
|
|
27
|
+
... registry = build_adapter_registry(Path.cwd(), project_sources=load_project_sources(Project(Path.cwd())))
|
|
27
28
|
... executor = Executor(face, registry, query_registry=result.query_registry)
|
|
28
29
|
... svg = render(face, executor, format="svg")
|
|
29
30
|
"""
|
dataface/agent_api/__init__.py
CHANGED
|
@@ -47,7 +47,7 @@ from dataface.agent_api.init import (
|
|
|
47
47
|
InitResult as InitResult,
|
|
48
48
|
init_project as init_project,
|
|
49
49
|
)
|
|
50
|
-
from dataface.agent_api.
|
|
50
|
+
from dataface.agent_api.project_session import ProjectSession as ProjectSession
|
|
51
51
|
from dataface.agent_api.query import QueryFaceResult, query_face
|
|
52
52
|
from dataface.agent_api.schema_hints import (
|
|
53
53
|
SchemaHints as SchemaHints,
|
|
@@ -76,7 +76,7 @@ __all__ = [
|
|
|
76
76
|
"DocsSearchHit",
|
|
77
77
|
"InitResult",
|
|
78
78
|
"LinkContext",
|
|
79
|
-
"
|
|
79
|
+
"ProjectSession",
|
|
80
80
|
"ProjectSourcesConfig",
|
|
81
81
|
"QueryDiagnostic",
|
|
82
82
|
"QueryFaceResult",
|
dataface/agent_api/_paths.py
CHANGED
|
@@ -73,8 +73,8 @@ def no_project_hint(project_dir: Path | None) -> str:
|
|
|
73
73
|
class FaceRenderContext:
|
|
74
74
|
"""Path resolution result from a face path + project root.
|
|
75
75
|
|
|
76
|
-
Adapter registry is built by `
|
|
77
|
-
open a `
|
|
76
|
+
Adapter registry is built by `ProjectSession.open`, not by the context — call sites
|
|
77
|
+
open a `ProjectSession` with `project_root` + `dbt_project_path` and read the
|
|
78
78
|
registry off `project.adapter_registry`.
|
|
79
79
|
"""
|
|
80
80
|
|
|
@@ -134,7 +134,7 @@ def build_face_render_context(
|
|
|
134
134
|
class YamlRenderContext:
|
|
135
135
|
"""Path resolution result for rendering inline YAML against a project root.
|
|
136
136
|
|
|
137
|
-
Adapter registry is built by `
|
|
137
|
+
Adapter registry is built by `ProjectSession.open`, not by the context.
|
|
138
138
|
"""
|
|
139
139
|
|
|
140
140
|
project_root: Path
|
dataface/agent_api/chat.py
CHANGED
|
@@ -49,7 +49,7 @@ class ChatSession:
|
|
|
49
49
|
def close(self) -> None:
|
|
50
50
|
"""Flush the session log and release the project's resources."""
|
|
51
51
|
self.writer.close()
|
|
52
|
-
self.context.
|
|
52
|
+
self.context.project_session.close()
|
|
53
53
|
|
|
54
54
|
def __enter__(self) -> Self:
|
|
55
55
|
return self
|
|
@@ -81,13 +81,13 @@ def start_session(
|
|
|
81
81
|
project_dir: Working directory for the session. Defaults to cwd.
|
|
82
82
|
server_port: Port of the embedded HTTP preview server, if running.
|
|
83
83
|
"""
|
|
84
|
-
from dataface.agent_api.
|
|
84
|
+
from dataface.agent_api.project_session import ProjectSession
|
|
85
85
|
from dataface.core.execute.adapters import LOCAL_AUTHORING_REGISTRY_KWARGS
|
|
86
86
|
|
|
87
87
|
cwd = (project_dir or Path.cwd()).resolve()
|
|
88
88
|
client = create_client(model=model)
|
|
89
89
|
context = DatafaceAIContext(
|
|
90
|
-
|
|
90
|
+
project_session=ProjectSession.open(cwd, **LOCAL_AUTHORING_REGISTRY_KWARGS),
|
|
91
91
|
server_port=server_port,
|
|
92
92
|
)
|
|
93
93
|
writer, _ = new_session(cwd, provider=client.provider, model=client.model)
|
|
@@ -123,7 +123,7 @@ def resume_session(
|
|
|
123
123
|
Raises:
|
|
124
124
|
ValueError: If session not found, provider mismatch, or context window exceeded.
|
|
125
125
|
"""
|
|
126
|
-
from dataface.agent_api.
|
|
126
|
+
from dataface.agent_api.project_session import ProjectSession
|
|
127
127
|
from dataface.core.execute.adapters import LOCAL_AUTHORING_REGISTRY_KWARGS
|
|
128
128
|
|
|
129
129
|
cwd = (project_dir or Path.cwd()).resolve()
|
|
@@ -143,7 +143,7 @@ def resume_session(
|
|
|
143
143
|
)
|
|
144
144
|
|
|
145
145
|
context = DatafaceAIContext(
|
|
146
|
-
|
|
146
|
+
project_session=ProjectSession.open(cwd, **LOCAL_AUTHORING_REGISTRY_KWARGS),
|
|
147
147
|
server_port=server_port,
|
|
148
148
|
)
|
|
149
149
|
writer, _ = new_session(cwd, provider=client.provider, model=client.model)
|
dataface/agent_api/describe.py
CHANGED
|
@@ -87,7 +87,7 @@ class DescribeFaceArgs(BaseModel):
|
|
|
87
87
|
default=None,
|
|
88
88
|
description=(
|
|
89
89
|
"Project root for resolving relative paths. Optional on the wire; "
|
|
90
|
-
"the MCP server injects
|
|
90
|
+
"the MCP server injects the project root when omitted."
|
|
91
91
|
),
|
|
92
92
|
)
|
|
93
93
|
|
|
@@ -479,7 +479,7 @@ Authored overlay for Style — all fields optional. Adds CSS shorthand coercers.
|
|
|
479
479
|
| `variables` | [VariablesStyle](#variablesstyle) | ✓ | Variable controls chrome style. |
|
|
480
480
|
| `page` | [PageStyle](#pagestyle) | ✓ | Page-level canvas style (behind the board). |
|
|
481
481
|
| `footer` | [FooterStyle](#footerstyle) | ✓ | Page footer chrome visibility. |
|
|
482
|
-
| `timestamp` | [TimestampStyle](#timestampstyle) | ✓ | Render-timestamp chrome: visibility, format, and font. |
|
|
482
|
+
| `timestamp` | [TimestampStyle](#timestampstyle) | ✓ | Render-timestamp chrome: visibility, placement, format, and font. |
|
|
483
483
|
| `formats` | dict[str, str] | ✓ | Format alias map; None means no aliases at this cascade level. |
|
|
484
484
|
| `palettes` | dict[str, str] | ✓ | Theme palette role assignments: open dict mapping role name to palette file name. Default seed: chrome, info, negative, positive, warning, category, sequence, diverge. |
|
|
485
485
|
| `roles` | dict[str, str] | ✓ | Optional top-level theme role aliases: bare name → role.alias. e.g. ink: chrome.heading |
|
|
@@ -575,10 +575,9 @@ Authored overlay for BarChartStyle. Bar chart style: chart-level fields + marks
|
|
|
575
575
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
576
576
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
577
577
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
578
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
579
578
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
580
579
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
581
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
580
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
582
581
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
583
582
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
584
583
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -612,10 +611,9 @@ Authored overlay for LineChartStyle. Line chart style: chart-level fields + mark
|
|
|
612
611
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
613
612
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
614
613
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
615
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
616
614
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
617
615
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
618
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
616
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
619
617
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
620
618
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
621
619
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -646,10 +644,9 @@ Authored overlay for AreaChartStyle. Area chart style: chart-level fields + mark
|
|
|
646
644
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
647
645
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
648
646
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
649
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
650
647
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
651
648
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
652
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
649
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
653
650
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
654
651
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
655
652
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -681,10 +678,9 @@ Authored overlay for ScatterChartStyle. Scatter chart style: chart-level fields
|
|
|
681
678
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
682
679
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
683
680
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
684
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
685
681
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
686
682
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
687
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
683
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
688
684
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
689
685
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
690
686
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -714,10 +710,9 @@ Authored overlay for HeatmapChartStyle. Heatmap chart style.
|
|
|
714
710
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
715
711
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
716
712
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
717
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
718
713
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
719
714
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
720
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
715
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
721
716
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
722
717
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
723
718
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -758,10 +753,9 @@ Authored overlay for PieChartStyle. Pie/donut chart style: geometry + total (fla
|
|
|
758
753
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
759
754
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
760
755
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
761
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
762
756
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
763
757
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
764
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
758
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
765
759
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
766
760
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
767
761
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -787,15 +781,14 @@ Authored overlay for KpiChartStyle. Produced by cascade from theme YAML.
|
|
|
787
781
|
|
|
788
782
|
| Field | Type | Optional | Description |
|
|
789
783
|
|-------|------|:--------:|-------------|
|
|
790
|
-
| `font` | [FontStyle](#fontstyle) | ✓ |
|
|
784
|
+
| `font` | [FontStyle](#fontstyle) | ✓ | KPI chart-level font overrides; cascades from charts.font. |
|
|
791
785
|
| `padding` | [PaddingStyle](#paddingstyle) | ✓ | Chart inner padding in pixels. |
|
|
792
786
|
| `border` | [BorderStyle](#borderstyle) | ✓ | KPI card border style. |
|
|
793
787
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
794
788
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
795
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
796
789
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
797
790
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
798
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
791
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
799
792
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
800
793
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
801
794
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -816,15 +809,14 @@ Authored overlay for TableChartStyle. Table chart style overrides layered on top
|
|
|
816
809
|
|
|
817
810
|
| Field | Type | Optional | Description |
|
|
818
811
|
|-------|------|:--------:|-------------|
|
|
819
|
-
| `font` | [FontStyle](#fontstyle) | ✓ |
|
|
812
|
+
| `font` | [FontStyle](#fontstyle) | ✓ | Table chart-level font overrides; cascades from charts.font. |
|
|
820
813
|
| `padding` | [PaddingStyle](#paddingstyle) | ✓ | Chart inner padding in pixels. |
|
|
821
814
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Table outer border style. |
|
|
822
815
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
823
816
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
824
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
825
817
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
826
818
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
827
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
819
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
828
820
|
| `background` | str | ✓ | Table background color; None inherits from theme. |
|
|
829
821
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Table text color override (CSS string) or gradient scale config; None uses the theme default. |
|
|
830
822
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -878,10 +870,9 @@ Authored overlay for PointMapChartStyle. Point map chart style.
|
|
|
878
870
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
879
871
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
880
872
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
881
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
882
873
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
883
874
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
884
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
875
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
885
876
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
886
877
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
887
878
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -903,10 +894,9 @@ Authored overlay for GeoshapeChartStyle. Geoshape (choropleth) chart style.
|
|
|
903
894
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
904
895
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
905
896
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
906
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
907
897
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
908
898
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
909
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
899
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
910
900
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
911
901
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
912
902
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
@@ -954,7 +944,6 @@ Flat style patch for layered multi-mark charts.
|
|
|
954
944
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
955
945
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
956
946
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
957
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
958
947
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
959
948
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style overrides. |
|
|
960
949
|
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Chart tooltip style overrides. |
|
|
@@ -1111,6 +1100,8 @@ Authored overlay for TextStyle. Markdown / plain text content.
|
|
|
1111
1100
|
| `line_height` | float | ✓ | Line height multiplier for text content. |
|
|
1112
1101
|
| `align` | enum: "left", "center", "right" | ✓ | Text alignment for the face body-text block. |
|
|
1113
1102
|
| `column` | [TextColumnStyle](#textcolumnstyle) | ✓ | Multi-column layout for the face body-text block. |
|
|
1103
|
+
| `code` | [TextCodeStyle](#textcodestyle) | ✓ | Inline + fenced code box styling (font, background, border). |
|
|
1104
|
+
| `blockquote` | [TextBlockquoteStyle](#textblockquotestyle) | ✓ | Blockquote box styling (font, background, border/left-rule). |
|
|
1114
1105
|
|
|
1115
1106
|
<a id="placeholderstyle"></a>
|
|
1116
1107
|
## PlaceholderStyle
|
|
@@ -1135,13 +1126,13 @@ Authored overlay for ChartsStyle. Registry of all chart-type styles plus shared
|
|
|
1135
1126
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
1136
1127
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
1137
1128
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
1138
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
1139
1129
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
1140
1130
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
1141
1131
|
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Chart tooltip style. |
|
|
1142
1132
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
1143
1133
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
1144
1134
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
|
1135
|
+
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
1145
1136
|
| `default_chart_height` | float | ✓ | Fallback chart height in pixels when aspect-ratio sizing is unavailable. |
|
|
1146
1137
|
| `default_table_height` | float | ✓ | Placeholder table height in pixels; replaced by data-aware row-count sizing at render time. |
|
|
1147
1138
|
| `label_usable_ratio` | float | ✓ | Fraction of chart width usable for axis labels (0–1); labels are tilted when full labels exceed this width. |
|
|
@@ -1223,11 +1214,13 @@ Authored overlay for FooterStyle. Authored visibility toggle for the page footer
|
|
|
1223
1214
|
|
|
1224
1215
|
<a id="timestampstyle"></a>
|
|
1225
1216
|
## TimestampStyle
|
|
1226
|
-
Authored overlay for TimestampStyle. Authored timestamp chrome: visibility, strftime format, and font.
|
|
1217
|
+
Authored overlay for TimestampStyle. Authored timestamp chrome: visibility, placement, strftime format, and font.
|
|
1227
1218
|
|
|
1228
1219
|
| Field | Type | Optional | Description |
|
|
1229
1220
|
|-------|------|:--------:|-------------|
|
|
1230
1221
|
| `visible` | bool | ✓ | Show the render-timestamp line. |
|
|
1222
|
+
| `position` | enum: "top", "footer" | ✓ | Timestamp row: top page chrome or footer baseline. |
|
|
1223
|
+
| `align` | enum: "left", "right" | ✓ | Timestamp horizontal alignment within its row. |
|
|
1231
1224
|
| `format` | str | ✓ | strftime format string for the render timestamp. |
|
|
1232
1225
|
| `font` | [FontStyle](#fontstyle) | ✓ | Timestamp font style overrides (size, color, weight, ...). |
|
|
1233
1226
|
|
|
@@ -1328,7 +1321,6 @@ Authored overlay for InferenceStyle.
|
|
|
1328
1321
|
|-------|------|:--------:|-------------|
|
|
1329
1322
|
| `infer_zero_when_missing` | bool | ✓ | Auto-infer zero-baseline when not authored. |
|
|
1330
1323
|
| `infer_fields_when_missing` | bool | ✓ | Auto-infer chart fields (x, y, etc.) when not authored. |
|
|
1331
|
-
| `infer_type_when_auto` | bool | ✓ | Auto-infer chart type when type is 'auto'. |
|
|
1332
1324
|
|
|
1333
1325
|
<a id="legendstyle"></a>
|
|
1334
1326
|
## LegendStyle
|
|
@@ -1838,6 +1830,26 @@ Authored overlay for TextColumnStyle. Multi-column layout for face body text (CS
|
|
|
1838
1830
|
| `rule` | str | ✓ | CSS column-rule shorthand, e.g. '1px solid #e5e7eb'. None = no rule. |
|
|
1839
1831
|
| `width` | float | ✓ | Minimum column width in pixels for auto-column-count derivation. |
|
|
1840
1832
|
|
|
1833
|
+
<a id="textcodestyle"></a>
|
|
1834
|
+
## TextCodeStyle
|
|
1835
|
+
Authored overlay for TextCodeStyle. Inline and fenced code spans in markdown prose. Box group; mono font by default.
|
|
1836
|
+
|
|
1837
|
+
| Field | Type | Optional | Description |
|
|
1838
|
+
|-------|------|:--------:|-------------|
|
|
1839
|
+
| `font` | [FontStyle](#fontstyle) | ✓ | Box text font overrides — full FontStyle (family, color, size, weight, style, decoration, case). |
|
|
1840
|
+
| `background` | str | ✓ | Box background fill. |
|
|
1841
|
+
| `border` | [BorderStyle](#borderstyle) | ✓ | Box border (width, color, radius). |
|
|
1842
|
+
|
|
1843
|
+
<a id="textblockquotestyle"></a>
|
|
1844
|
+
## TextBlockquoteStyle
|
|
1845
|
+
Authored overlay for TextBlockquoteStyle. Blockquote prose. Box group; border is the left rule.
|
|
1846
|
+
|
|
1847
|
+
| Field | Type | Optional | Description |
|
|
1848
|
+
|-------|------|:--------:|-------------|
|
|
1849
|
+
| `font` | [FontStyle](#fontstyle) | ✓ | Box text font overrides — full FontStyle (family, color, size, weight, style, decoration, case). |
|
|
1850
|
+
| `background` | str | ✓ | Box background fill. |
|
|
1851
|
+
| `border` | [BorderStyle](#borderstyle) | ✓ | Box border (width, color, radius). |
|
|
1852
|
+
|
|
1841
1853
|
<a id="placeholderoverlay"></a>
|
|
1842
1854
|
## PlaceholderOverlay
|
|
1843
1855
|
Authored overlay for PlaceholderOverlay.
|
|
@@ -1908,10 +1920,9 @@ Authored overlay for HistogramChartStyle. Histogram chart style.
|
|
|
1908
1920
|
| `border` | [BorderStyle](#borderstyle) | ✓ | Chart card border style. |
|
|
1909
1921
|
| `animation_duration` | float | ✓ | Vega-Lite animation duration in milliseconds. |
|
|
1910
1922
|
| `palette` | list[str] \| str | ✓ | Ordered list of categorical color stops or a palette name; expanded from a palette name at validation time. |
|
|
1911
|
-
| `dashes` | list[list[int]] | ✓ | Ordered list of Vega-Lite strokeDash arrays for line-family categorical encoding; None disables dash emission. |
|
|
1912
1923
|
| `inference` | [InferenceStyle](#inferencestyle) | ✓ | Engine inference behavior flags. |
|
|
1913
1924
|
| `legend` | [LegendStyle](#legendstyle) | ✓ | Chart legend style. |
|
|
1914
|
-
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ |
|
|
1925
|
+
| `tooltip` | [TooltipStyle](#tooltipstyle) | ✓ | Per-chart-type tooltip style override; None uses the universal style.charts.tooltip. |
|
|
1915
1926
|
| `background` | str | ✓ | Chart-local background color override; None inherits from theme. |
|
|
1916
1927
|
| `color` | str \| [StyleColorConfig](#stylecolorconfig) | ✓ | Chart-local static mark color (CSS string) or gradient scale config; None uses the theme palette. |
|
|
1917
1928
|
| `title` | [TitleStyle](#titlestyle) | ✓ | Chart-level title style override; None inherits the theme title style. |
|
dataface/agent_api/pack.py
CHANGED
|
@@ -24,6 +24,7 @@ from dataface.core.inspect.resolver import LayeredSchemaResolver
|
|
|
24
24
|
from dataface.core.pack.models import PackProposal, ProposedDashboard
|
|
25
25
|
from dataface.core.pack.planner import SourceEntry, plan_pack
|
|
26
26
|
from dataface.core.pack.proposal_store import dump_proposal
|
|
27
|
+
from dataface.core.project import Project
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
class ScaffoldResult(BaseModel):
|
|
@@ -168,7 +169,7 @@ def propose_pack(
|
|
|
168
169
|
raise FileNotFoundError(f"Project directory not found: {project_dir}")
|
|
169
170
|
|
|
170
171
|
registry = build_adapter_registry(
|
|
171
|
-
project_dir, project_sources=load_project_sources(project_dir)
|
|
172
|
+
project_dir, project_sources=load_project_sources(Project(project_dir))
|
|
172
173
|
)
|
|
173
174
|
sql_sources = registry.list_sql_sources()
|
|
174
175
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Session that owns project-scoped resources for Dataface composition roots."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -15,8 +15,7 @@ else:
|
|
|
15
15
|
from typing_extensions import Self
|
|
16
16
|
|
|
17
17
|
# Verb-forwarder imports use SUBMODULES so test monkeypatches on the
|
|
18
|
-
# module attribute affect the call site.
|
|
19
|
-
# are by name; tests patch them at `dataface.agent_api.project.<name>`.
|
|
18
|
+
# module attribute affect the call site.
|
|
20
19
|
from dataface.agent_api import (
|
|
21
20
|
dashboards as _dashboards,
|
|
22
21
|
describe as _describe,
|
|
@@ -32,8 +31,6 @@ from dataface.agent_api.validate import (
|
|
|
32
31
|
from dataface.core import dashboard as _core_dashboard
|
|
33
32
|
from dataface.core.compile.config import (
|
|
34
33
|
ProjectSourcesConfig,
|
|
35
|
-
get_project_warnings_ignore,
|
|
36
|
-
load_project_sources,
|
|
37
34
|
)
|
|
38
35
|
from dataface.core.execute.adapters.adapter_registry import (
|
|
39
36
|
AdapterRegistry,
|
|
@@ -44,6 +41,7 @@ from dataface.core.inspect.query_validator import (
|
|
|
44
41
|
QueryDiagnostic,
|
|
45
42
|
validate_query as _core_validate_query,
|
|
46
43
|
)
|
|
44
|
+
from dataface.core.project import Project
|
|
47
45
|
from dataface.core.project_roots import discover_render_context
|
|
48
46
|
|
|
49
47
|
if TYPE_CHECKING:
|
|
@@ -59,17 +57,17 @@ _SUPER_SCHEMA_AVAILABLE: bool = (
|
|
|
59
57
|
|
|
60
58
|
|
|
61
59
|
@dataclass(init=False)
|
|
62
|
-
class
|
|
60
|
+
class ProjectSession:
|
|
63
61
|
"""Explicit container for project-scoped resources.
|
|
64
62
|
|
|
65
63
|
Composition roots (CLI, MCP, dft serve, Cloud, A lIe, Playground) construct
|
|
66
|
-
one
|
|
67
|
-
resources) into core. Verb methods on
|
|
68
|
-
agent_api functions — they unpack self.
|
|
64
|
+
one ProjectSession at their documented boundary and pass it (or its component
|
|
65
|
+
resources) into core. Verb methods on ProjectSession are thin forwarders to
|
|
66
|
+
agent_api functions — they unpack self.project.root so callers don't
|
|
69
67
|
re-thread it at every call site.
|
|
70
68
|
"""
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
project: Project
|
|
73
71
|
cache: DuckDBCache | None
|
|
74
72
|
_owns_registry: bool
|
|
75
73
|
_read_only: bool
|
|
@@ -80,17 +78,15 @@ class Project:
|
|
|
80
78
|
_duckdb_config: dict[str, Any] | None
|
|
81
79
|
_allow_external_access_in_readonly: bool
|
|
82
80
|
_resolver: SourceResolver | None
|
|
83
|
-
_sources: ProjectSourcesConfig
|
|
84
|
-
_warnings_ignore: frozenset[str]
|
|
85
81
|
|
|
86
82
|
def __init__(
|
|
87
83
|
self,
|
|
88
|
-
|
|
84
|
+
project: Project,
|
|
89
85
|
cache: DuckDBCache | None = None,
|
|
90
86
|
adapter_registry: AdapterRegistry | None = None,
|
|
91
87
|
read_only: bool = True,
|
|
92
88
|
) -> None:
|
|
93
|
-
self.
|
|
89
|
+
self.project = project
|
|
94
90
|
self.cache = cache
|
|
95
91
|
# We own the registry only when we'll lazy-build it ourselves. An injected
|
|
96
92
|
# registry belongs to the caller; we use it but don't close it on their behalf.
|
|
@@ -107,8 +103,6 @@ class Project:
|
|
|
107
103
|
self._duckdb_config = None
|
|
108
104
|
self._allow_external_access_in_readonly = False
|
|
109
105
|
self._resolver = None
|
|
110
|
-
self._sources = load_project_sources(self.project_root)
|
|
111
|
-
self._warnings_ignore = get_project_warnings_ignore(self.project_root)
|
|
112
106
|
|
|
113
107
|
@classmethod
|
|
114
108
|
def open(
|
|
@@ -125,7 +119,7 @@ class Project:
|
|
|
125
119
|
allow_external_access_in_readonly: bool = False,
|
|
126
120
|
resolver: SourceResolver | None = None,
|
|
127
121
|
) -> Self:
|
|
128
|
-
"""Construct a
|
|
122
|
+
"""Construct a ProjectSession rooted at *project_dir*.
|
|
129
123
|
|
|
130
124
|
Cache lifecycle belongs to the caller: pass ``cache=open_cache_from_env()``
|
|
131
125
|
(or another DuckDBCache) when persistent caching is desired, otherwise omit
|
|
@@ -136,17 +130,19 @@ class Project:
|
|
|
136
130
|
Call ``refresh()`` to close the current registry and force a rebuild on the
|
|
137
131
|
next access.
|
|
138
132
|
"""
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
session = cls(
|
|
134
|
+
project=Project(Path(project_dir).resolve()),
|
|
135
|
+
cache=cache,
|
|
136
|
+
read_only=read_only,
|
|
141
137
|
)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return
|
|
138
|
+
session._dbt_project_path = dbt_project_path
|
|
139
|
+
session._connection_string = connection_string
|
|
140
|
+
session._dialect = dialect
|
|
141
|
+
session._target = target
|
|
142
|
+
session._duckdb_config = duckdb_config
|
|
143
|
+
session._allow_external_access_in_readonly = allow_external_access_in_readonly
|
|
144
|
+
session._resolver = resolver
|
|
145
|
+
return session
|
|
150
146
|
|
|
151
147
|
@classmethod
|
|
152
148
|
def from_face(
|
|
@@ -156,7 +152,7 @@ class Project:
|
|
|
156
152
|
read_only: bool = True,
|
|
157
153
|
cache: DuckDBCache | None = None,
|
|
158
154
|
) -> Self:
|
|
159
|
-
"""Open a
|
|
155
|
+
"""Open a ProjectSession rooted at the project directory discovered upward from face_file."""
|
|
160
156
|
resolved = Path(face_file).resolve()
|
|
161
157
|
project_root, dbt_project_path = discover_render_context(resolved.parent, None)
|
|
162
158
|
return cls.open(
|
|
@@ -181,8 +177,8 @@ class Project:
|
|
|
181
177
|
When constructed with an injected registry, returns it directly.
|
|
182
178
|
"""
|
|
183
179
|
return build_adapter_registry(
|
|
184
|
-
self.
|
|
185
|
-
project_sources=self.
|
|
180
|
+
self.project.root,
|
|
181
|
+
project_sources=self.project.sources,
|
|
186
182
|
read_only=self._read_only,
|
|
187
183
|
dbt_project_path=self._dbt_project_path,
|
|
188
184
|
connection_string=self._connection_string,
|
|
@@ -197,19 +193,20 @@ class Project:
|
|
|
197
193
|
"""Policy-free rebuild primitive.
|
|
198
194
|
|
|
199
195
|
For projects opened via ``open()``: closes the current registry (if built)
|
|
200
|
-
and clears it so the next access rebuilds from disk. Also
|
|
201
|
-
sources and warnings_ignore
|
|
196
|
+
and clears it so the next access rebuilds from disk. Also invalidates
|
|
197
|
+
the sources and warnings_ignore caches so the next access re-reads disk.
|
|
202
198
|
|
|
203
199
|
For projects constructed with an injected ``adapter_registry``: skips the
|
|
204
|
-
registry rebuild (build arguments are not available), but still
|
|
205
|
-
the config
|
|
200
|
+
registry rebuild (build arguments are not available), but still invalidates
|
|
201
|
+
the config caches.
|
|
206
202
|
"""
|
|
207
203
|
if self._owns_registry and "adapter_registry" in self.__dict__:
|
|
208
204
|
self.adapter_registry.close()
|
|
209
205
|
del self.__dict__["adapter_registry"]
|
|
210
206
|
self.__dict__.pop("_relationship_context", None)
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
# Rebuild Project so its cached file probes re-check disk — a
|
|
208
|
+
# dataface.yml / _sources.yaml created after open() must show up.
|
|
209
|
+
self.project = Project(self.project.root)
|
|
213
210
|
|
|
214
211
|
def close(self) -> None:
|
|
215
212
|
"""Close the adapter registry iff we own it. The cache is the caller's to close."""
|
|
@@ -220,11 +217,11 @@ class Project:
|
|
|
220
217
|
# Read-only views: project lifecycle owns these; external writers go through refresh().
|
|
221
218
|
@property
|
|
222
219
|
def sources(self) -> ProjectSourcesConfig:
|
|
223
|
-
return self.
|
|
220
|
+
return self.project.sources
|
|
224
221
|
|
|
225
222
|
@property
|
|
226
223
|
def warnings_ignore(self) -> frozenset[str]:
|
|
227
|
-
return self.
|
|
224
|
+
return self.project.warnings_ignore
|
|
228
225
|
|
|
229
226
|
@cached_property
|
|
230
227
|
def _relationship_context(self) -> RelationshipContext | None:
|
|
@@ -234,7 +231,7 @@ class Project:
|
|
|
234
231
|
has no relationship data.
|
|
235
232
|
|
|
236
233
|
NOTE: load_relationship_context() reads target/super_schema.json relative
|
|
237
|
-
to cwd, not self.
|
|
234
|
+
to cwd, not self.project.root. Tests must chdir to the project root. The
|
|
238
235
|
follow-up task "load_relationship_context takes project_root (kill cwd
|
|
239
236
|
coupling)" will fix this upstream.
|
|
240
237
|
"""
|
|
@@ -249,20 +246,20 @@ class Project:
|
|
|
249
246
|
# ── Verb forwarders ──────────────────────────────────────────────────────
|
|
250
247
|
|
|
251
248
|
def validate(self, face_path: Path) -> ValidateResult:
|
|
252
|
-
result = _validate.validate(face_path, project_dir=self.
|
|
253
|
-
annotated = _validate.annotate_with_data_lint([result],
|
|
249
|
+
result = _validate.validate(face_path, project_dir=self.project.root)
|
|
250
|
+
annotated = _validate.annotate_with_data_lint([result], project_session=self)
|
|
254
251
|
return annotated[0]
|
|
255
252
|
|
|
256
253
|
def validate_paths(self, paths: list[Path] | None) -> list[ValidateResult]:
|
|
257
|
-
results = _validate.validate_paths(paths, project_dir=self.
|
|
258
|
-
return _validate.annotate_with_data_lint(results,
|
|
254
|
+
results = _validate.validate_paths(paths, project_dir=self.project.root)
|
|
255
|
+
return _validate.annotate_with_data_lint(results, project_session=self)
|
|
259
256
|
|
|
260
257
|
def _source_names(self) -> frozenset[str]:
|
|
261
258
|
"""Return the configured source names for /data/ alias validation.
|
|
262
259
|
|
|
263
260
|
Reads from the project config file — no adapter registry or DB connection needed.
|
|
264
261
|
"""
|
|
265
|
-
return frozenset(self.
|
|
262
|
+
return frozenset(self.sources.sources.keys())
|
|
266
263
|
|
|
267
264
|
@overload
|
|
268
265
|
def validate_query(
|
|
@@ -316,19 +313,19 @@ class Project:
|
|
|
316
313
|
)
|
|
317
314
|
|
|
318
315
|
def describe_face(self, path: Path) -> _describe.DescribeFaceResult:
|
|
319
|
-
return _describe.describe_face(path, project_dir=self.
|
|
316
|
+
return _describe.describe_face(path, project_dir=self.project.root)
|
|
320
317
|
|
|
321
318
|
def describe_paths(self, paths: list[Path]) -> list[_describe.DescribeFaceResult]:
|
|
322
|
-
return _describe.describe_paths(paths, project_dir=self.
|
|
319
|
+
return _describe.describe_paths(paths, project_dir=self.project.root)
|
|
323
320
|
|
|
324
321
|
def list_dashboards(
|
|
325
322
|
self,
|
|
326
323
|
directory: Path | None = None,
|
|
327
324
|
recursive: bool = True,
|
|
328
325
|
) -> _dashboards.ListDashboardsResult:
|
|
329
|
-
"""When ``directory`` is None, defaults to ``self.
|
|
326
|
+
"""When ``directory`` is None, defaults to ``self.project.root``. When provided, callers are responsible for passing an absolute path; relative paths resolve against the process working directory."""
|
|
330
327
|
return _dashboards.list_dashboards(
|
|
331
|
-
directory=directory if directory is not None else self.
|
|
328
|
+
directory=directory if directory is not None else self.project.root,
|
|
332
329
|
recursive=recursive,
|
|
333
330
|
)
|
|
334
331
|
|
|
@@ -338,7 +335,7 @@ class Project:
|
|
|
338
335
|
include_raw: bool = False,
|
|
339
336
|
) -> _dashboards.CompiledDashboard:
|
|
340
337
|
return _dashboards.get_dashboard(
|
|
341
|
-
path, include_raw=include_raw, project_dir=self.
|
|
338
|
+
path, include_raw=include_raw, project_dir=self.project.root
|
|
342
339
|
)
|
|
343
340
|
|
|
344
341
|
def lookup_face_query_sql(
|
|
@@ -347,7 +344,7 @@ class Project:
|
|
|
347
344
|
path: Path,
|
|
348
345
|
) -> _query.FaceQueryLookupResult:
|
|
349
346
|
return _query.lookup_face_query_sql(
|
|
350
|
-
name=name, path=path, project_dir=self.
|
|
347
|
+
name=name, path=path, project_dir=self.project.root
|
|
351
348
|
)
|
|
352
349
|
|
|
353
350
|
def query_face(
|
|
@@ -360,7 +357,7 @@ class Project:
|
|
|
360
357
|
return _query.query_face(
|
|
361
358
|
name,
|
|
362
359
|
path,
|
|
363
|
-
project_dir=self.
|
|
360
|
+
project_dir=self.project.root,
|
|
364
361
|
vars=vars,
|
|
365
362
|
limit=limit,
|
|
366
363
|
adapter_registry=self.adapter_registry,
|
|
@@ -415,8 +412,8 @@ class Project:
|
|
|
415
412
|
yaml_content=yaml_content,
|
|
416
413
|
variables=variables,
|
|
417
414
|
adapter_registry=self.adapter_registry,
|
|
418
|
-
project_dir=self.
|
|
419
|
-
|
|
415
|
+
project_dir=self.project.root,
|
|
416
|
+
project=self.project,
|
|
420
417
|
duckdb_cache=self.cache,
|
|
421
418
|
format=format,
|
|
422
419
|
use_cache=use_cache,
|