diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d67d9a8..e93723d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: poetry run python tests/test_fake_gcs.py - name: Run pytest - run: poetry run coverage run -m pytest tests/tests.py + run: poetry run coverage run -m pytest -v tests/tests.py - name: Run Coverage run: poetry run coverage report -m diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9a0c7..b78ebf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [1.0.0](https://github.com/snakemake/snakemake-storage-plugin-gcs/compare/v0.1.4...v1.0.0) (2024-04-26) + + +### ⚠ BREAKING CHANGES + +* expect correct google cloud storage abbreviation in query scheme (gcs://) ([#39](https://github.com/snakemake/snakemake-storage-plugin-gcs/issues/39)) + +### Bug Fixes + +* expect correct google cloud storage abbreviation in query scheme (gcs://) ([#39](https://github.com/snakemake/snakemake-storage-plugin-gcs/issues/39)) ([0ebf52c](https://github.com/snakemake/snakemake-storage-plugin-gcs/commit/0ebf52cc6131fe092f638306f104e4c37a88aac4)) +* fix directory support ([#38](https://github.com/snakemake/snakemake-storage-plugin-gcs/issues/38)) ([ce3d165](https://github.com/snakemake/snakemake-storage-plugin-gcs/commit/ce3d165f94e2d9d8f9469434d88edc0fe1b7f2a1)) + + +### Documentation + +* add intro, fix link ([6ec568a](https://github.com/snakemake/snakemake-storage-plugin-gcs/commit/6ec568a092aa6b636549a48fc09f0f1ba07b6f00)) + ## [0.1.4](https://github.com/snakemake/snakemake-storage-plugin-gcs/compare/v0.1.3...v0.1.4) (2024-03-08) diff --git a/README.md b/README.md index 05dd5cc..9c9e1ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Snakemake storage plugin: gcs A snakemake storage plugin for Google Cloud Storage. -For documentation and usage instructions, see the [Snakemake plugin catalog](https://snakemake.github.io/snakemake-plugin-catalog/plugins/storage/s3.html). +For documentation and usage instructions, see the [Snakemake plugin catalog](https://snakemake.github.io/snakemake-plugin-catalog/plugins/storage/gcs.html). ## Testing Set up a fake gcs server from [fake-gcs-server](https://github.com/fsouza/fake-gcs-server). diff --git a/docs/intro.md b/docs/intro.md new file mode 100644 index 0000000..12fcef3 --- /dev/null +++ b/docs/intro.md @@ -0,0 +1 @@ +A Snakemake storage plugin that reads and writes from [Google cloud storage (GCS)](https://cloud.google.com/storage). \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fe74e37..2b56617 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "snakemake-storage-plugin-gcs" -version = "0.1.4" +version = "1.0.0" description = "A Snakemake storage plugin for Google Cloud Storage" authors = [ "Vanessa Sochat ", diff --git a/snakemake_storage_plugin_gcs/__init__.py b/snakemake_storage_plugin_gcs/__init__.py index 17d245a..6a1b15c 100644 --- a/snakemake_storage_plugin_gcs/__init__.py +++ b/snakemake_storage_plugin_gcs/__init__.py @@ -192,11 +192,11 @@ def is_valid_query(cls, query: str) -> StorageQueryValidationResult: valid=False, reason=f"cannot be parsed as URL ({e})", ) - if parsed.scheme != "gs": + if parsed.scheme != "gcs": return StorageQueryValidationResult( query=query, valid=False, - reason="must start with gs (gs://...)", + reason="must start with gcs scheme (gcs://...)", ) return StorageQueryValidationResult( query=query, @@ -210,7 +210,7 @@ def example_queries(cls) -> List[ExampleQuery]: """ return [ ExampleQuery( - query="gs://mybucket/myfile.txt", + query="gcs://mybucket/myfile.txt", type=QueryType.ANY, description="A file in an google storage (GCS) bucket", ) @@ -341,7 +341,11 @@ def get_mtime(blob): return blob.updated.timestamp() if self.is_directory(): - return max(get_mtime(blob) for blob in self.directory_entries()) + entries = list(self.directory_entries()) + assert ( + entries + ), f"bug: mtime called but directory does not seem to exist: {self.query}" + return max(get_mtime(blob) for blob in entries) else: return get_mtime(self.blob) diff --git a/tests/tests.py b/tests/tests.py index 69362df..b17f882 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -20,14 +20,15 @@ class TestStorage(TestStorageBase): __test__ = True + files_only = False def get_query(self, tmp_path) -> str: - return "gs://snakemake-test-bucket/test-file.txt" + return "gcs://snakemake-test-bucket/test-file.txt" def get_query_not_existing(self, tmp_path) -> str: bucket = uuid.uuid4().hex key = uuid.uuid4().hex - return f"gs://{bucket}/{key}" + return f"gcs://{bucket}/{key}" def get_storage_provider_cls(self) -> Type[StorageProviderBase]: # Return the StorageProvider class of this plugin