Skip to content

Commit

Permalink
plots: load templates from package (iterative#6550)
Browse files Browse the repository at this point in the history
* plots: vega: make interactive linear default plot

* plots: stop dumping default templates

* plots: move templates to package initial

* plots: update default plots schema

* plots: write defaults on init

* templates: migrate to importlib.resources

* fixup

* fixup
  • Loading branch information
pared authored Oct 14, 2021
1 parent b8478a8 commit a1b1466
Show file tree
Hide file tree
Showing 15 changed files with 659 additions and 515 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include LICENSE
recursive-include requirements *.txt
recursive-include dvc/repo/plots/templates *.json
2 changes: 1 addition & 1 deletion dvc/render/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os.path
from typing import Dict, List

import dpath
import dpath.util


def get_files(data: Dict) -> List:
Expand Down
2 changes: 1 addition & 1 deletion dvc/render/vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _datapoints(self, props: Dict):
def get_vega(self) -> Optional[str]:
props = self._squash_props()

template = self.templates.load(props.get("template") or "default")
template = self.templates.load(props.get("template", None))

if not props.get("x") and template.has_anchor("x"):
props["append_index"] = True
Expand Down
2 changes: 1 addition & 1 deletion dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def modify(self, path, props=None, unset=None):
props = props or {}
template = props.get("template")
if template:
self.templates.get_template(template)
self.templates.load(template)

(out,) = self.repo.find_outs_by_path(path)
if not out.plot and unset is not None:
Expand Down
Loading

0 comments on commit a1b1466

Please sign in to comment.