Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
545 changes: 351 additions & 194 deletions qtapp/main.py

Large diffs are not rendered by default.

1,253 changes: 1,253 additions & 0 deletions qtapp/views.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/projspec/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ def list(json_out):
print(f"{proj.text_summary(bare=True)}")


@library.command("clear")
def clear():
from projspec.library import ProjectLibrary

ProjectLibrary().clear()


@library.command("delete")
@click.argument("url")
def delete(url):
Expand Down
2 changes: 1 addition & 1 deletion src/projspec/content/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ def to_dict(self, compact=False):
dic["klass"] = ["content", self.snake_name()]
for k in list(dic):
if isinstance(dic[k], Enum):
dic[k] = dic[k].value
dic[k] = dic[k].to_dict(compact=False)
return dic
4 changes: 3 additions & 1 deletion src/projspec/proj/hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def parse(self) -> None:
meta = txt.split("---\n")[1]
try:
meta = yaml.safe_load(StringIO(meta))
except yaml.YAMLError:
except Exception as e:
raise ParseFailed from e
if not isinstance(meta, dict):
raise ParseFailed
if {
"dataset_info",
Expand Down
10 changes: 3 additions & 7 deletions src/projspec/proj/published.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def parse(self) -> None:

with self.proj.fs.open(self.proj.basenames["CITATION.cff"], "rt") as f:
meta = yaml.safe_load(f)
self.contents["descriptive_metadata"] = DescriptiveMetadata(
proj=self.proj, meta=meta
)
self.contents["descriptive_metadata"] = Citation(proj=self.proj, meta=meta)


class Zenodo(ProjectExtra):
Expand All @@ -31,11 +29,9 @@ def match(self):
return ".zenodo.json" in self.proj.basenames

def parse(self) -> None:
from projspec.content.metadata import DescriptiveMetadata
from projspec.content.metadata import Citation

with self.proj.fs.open(self.proj.basenames[".zenodo.json"], "rt") as f:
meta = yaml.safe_load(f)
# TODO: extract known contents such as license.
self.contents["descriptive_metadata"] = DescriptiveMetadata(
proj=self.proj, meta=meta
)
self.contents["descriptive_metadata"] = Citation(proj=self.proj, meta=meta)
29 changes: 15 additions & 14 deletions src/projspec/proj/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ def parse(self):
self.contents["desciptive_metadata"] = DescriptiveMetadata(
proj=self.proj, meta=meta.get("package")
)
bin = AttrDict()
bin["debug"] = FileArtifact(
proj=self.proj,
cmd=["cargo", "build"],
# extension is platform specific
fn=f"{self.proj.url}/target/debug/{meta['package']['name']}.*",
)
bin["release"] = FileArtifact(
proj=self.proj,
cmd=["cargo", "build", "--release"],
# extension is platform specific
fn=f"{self.proj.url}/target/release/{meta['package']['name']}.*",
)
self.artifacts["file"] = bin
if "package" in meta:
bin = AttrDict()
bin["debug"] = FileArtifact(
proj=self.proj,
cmd=["cargo", "build"],
# extension is platform specific
fn=f"{self.proj.url}/target/debug/{meta['package']['name']}.*",
)
bin["release"] = FileArtifact(
proj=self.proj,
cmd=["cargo", "build", "--release"],
# extension is platform specific
fn=f"{self.proj.url}/target/release/{meta['package']['name']}.*",
)
self.artifacts["file"] = bin

@staticmethod
def _create(path: str) -> None:
Expand Down
4 changes: 3 additions & 1 deletion src/projspec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def from_dict(dic, proj=None):
return Project.from_dict(dic)
category, name = dic.pop("klass")
cls = get_cls(name, category)
if category == "enum":
return cls(dic["value"])
obj = object.__new__(cls)
obj.proj = proj
obj.__dict__.update({k: from_dict(v, proj=proj) for k, v in dic.items()})
Expand Down Expand Up @@ -375,7 +377,7 @@ def spec_class_qnames(registry="proj"):
for cls in reg.values()
)
):
print(" ", s),
(print(" ", s),)
for s in sorted(
(
".. autoclass:: " + ".".join([cls.__module__, cls.__name__])
Expand Down
2 changes: 2 additions & 0 deletions vsextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ code window to the library, show details (and search) any library entry,
open a new Code window for a given library entry or "make" any
artifact.

To run: open the directory vsextension/ in vscode and press F5!

![screenshot](./im.png)

Like the qt-app, this is POC experimental only.
Expand Down
Loading