diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..9ce1d0f --- /dev/null +++ b/.github/workflows/python-app.yml @@ -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 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8a9ecc2 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/src/thethingstore/thing_node.py b/src/thethingstore/thing_node.py index f2e7167..281f5fe 100644 --- a/src/thethingstore/thing_node.py +++ b/src/thethingstore/thing_node.py @@ -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. @@ -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. @@ -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. @@ -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]: @@ -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 \ No newline at end of file + return component_map diff --git a/src/thethingstore/thing_store_pa_fs.py b/src/thethingstore/thing_store_pa_fs.py index 608e13c..5e4e54b 100644 --- a/src/thethingstore/thing_store_pa_fs.py +++ b/src/thethingstore/thing_store_pa_fs.py @@ -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("/"): @@ -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) @@ -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( diff --git a/tests/test_thing-store/test_api/test_torch.py b/tests/test_thing-store/test_api/test_torch.py index 553bdc6..b452151 100644 --- a/tests/test_thing-store/test_api/test_torch.py +++ b/tests/test_thing-store/test_api/test_torch.py @@ -1 +1 @@ -# Saves and loads PyTorch models. \ No newline at end of file +# Saves and loads PyTorch models. diff --git a/tests/test_thing_node.py b/tests/test_thing_node.py index 0751235..90f2ef5 100644 --- a/tests/test_thing_node.py +++ b/tests/test_thing_node.py @@ -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 \ No newline at end of file +# # Finally, what happens if I try to add diff --git a/tox.ini b/tox.ini index 63dc4f1..1bd6d87 100644 --- a/tox.ini +++ b/tox.ini @@ -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