Skip to content

Commit

Permalink
Merge branch 'main' into list_candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester authored Apr 26, 2024
2 parents 8b72349 + 30175aa commit 6f116ef
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
1 change: 1 addition & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A Snakemake storage plugin that reads and writes from [Google cloud storage (GCS)](https://cloud.google.com/storage).
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
12 changes: 8 additions & 4 deletions snakemake_storage_plugin_gcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
)
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f116ef

Please sign in to comment.