Skip to content
Open
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
38 changes: 38 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
7 changes: 3 additions & 4 deletions src/thethingstore/thing_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def get(self, attr: str) -> Optional[Any]:
return None
return self._component_map[attr]()


def get_artifacts(self, artifact: Optional[str] = None) -> Union[str, List[str]]:
"""Retrieve node artifacts.

Expand Down Expand Up @@ -136,7 +135,6 @@ def get_artifacts(self, artifact: Optional[str] = None) -> Union[str, List[str]]
paths.append(_artifact)
return paths


def get_dataset(self) -> ds.Dataset:
"""Retrieve the node dataset.

Expand All @@ -151,7 +149,6 @@ def get_dataset(self) -> ds.Dataset:
raise NotImplementedError(self._log_header + "Dataset not a valid option.")
return self._ts.get_dataset(self.file_id)


def get_metadata(self) -> Mapping[str, Any]:
"""Retrieve the node metadata.

Expand Down Expand Up @@ -229,10 +226,12 @@ def __repr__(self) -> str:
# TODO: Represent this as a full fileid?
return f"ThingNode[{self.file_id}]"


def _get_graph(node: ThingNode) -> Tuple[List[str], List[Tuple[str, str]]]:
"""Make data structures for nodes and edges for a ThingNode graph."""
raise NotImplementedError("SAD")


def _build_component_map(
node: ThingNode, component_set: list[str]
) -> Mapping[str, Callable]:
Expand All @@ -253,4 +252,4 @@ def _build_component_map(
component_map[_attr] = node.get_embedding # pragma: no cover
elif _attr == "artifacts":
component_map[_attr] = node.get_artifacts
return component_map
return component_map
14 changes: 5 additions & 9 deletions src/thethingstore/thing_store_pa_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ def __init__(
super().__init__(
metadata_filesystem=metadata_filesystem, local_storage_folder=None
)
self._fs_metadata_file = managed_location + '/metadata.parquet'
self._fs_metadata_lockfile = managed_location + '/metadata-lock.parquet'
self._fs_output_location = managed_location + '/managed_files'
self._fs_metadata_file = managed_location + "/metadata.parquet"
self._fs_metadata_lockfile = managed_location + "/metadata-lock.parquet"
self._fs_output_location = managed_location + "/managed_files"
self._output_location = self._fs_output_location
if isinstance(metadata_filesystem, S3FileSystem):
if self._fs_metadata_file.startswith("/"):
Expand All @@ -409,11 +409,7 @@ def __init__(
schema=pa.schema({"USER": "str"}),
)

def _load(
self,
file_identifier: FileId,
**kwargs
) -> Union[Dataset, None]:
def _load(self, file_identifier: FileId, **kwargs) -> Union[Dataset, None]:
"""Convert a FileId to dataset.

This returns a representation of the dataset (Dataset)
Expand Down Expand Up @@ -556,7 +552,7 @@ def _list_artifacts(self, file_identifier: FileId) -> List[str]:
file_identifier,
str(_["FILE_VERSION"]),
"artifacts",
# Networking pathname accommodation.
# Networking pathname accommodation.
).replace("\\", "/")
try:
artifacts = self._metadata_fs.get_file_info(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_thing-store/test_api/test_torch.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Saves and loads PyTorch models.
# Saves and loads PyTorch models.
2 changes: 1 addition & 1 deletion tests/test_thing_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,4 @@
# node.get_artifacts("nope")
# # Ok, I *know* that get artifacts exists and works.
# assert node.get("artifacts") == [os.path.join(node._persist_dir, "silly.txt")]
# # Finally, what happens if I try to add
# # Finally, what happens if I try to add
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py39, flake8, bandit, black-check, mypy
envlist = py{310,311}, flake8, bandit, black-check, mypy
isolated_build = true
usedevelop=true

Expand Down