Skip to content

Commit

Permalink
Release 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
christiam committed Jul 24, 2024
1 parent bcab560 commit f03e4a0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cff-version: "1.2.0"
message: "If you use this software, please cite it using these metadata."
title: ElasticBLAST
version: "1.3.0"
date-released: 2024-07-17
version: "1.3.1"
date-released: 2024-07-24
license: "NCBI Public Domain"
repository-code: "https://github.com/ncbi/elastic-blast/"
url: "https://blast.ncbi.nlm.nih.gov/doc/elastic-blast/"
Expand Down
1 change: 1 addition & 0 deletions bin/create-blastdb-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class BlastDbMetadata:

def to_json(self, pretty = False):
"""Serialize the object as JSON"""
self.files.sort()
output = json.dumps(self, cls=BlastDbMetadataEncoder, sort_keys=False)
#rename '_' to '-' in keys
dict = json.loads(output)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = elastic_blast
description = ElasticBLAST speeds up your work by distributing your BLAST+ searches across multiple cloud instances. The ability to scale resources in this way allows larger numbers of queries to be searched in a shorter time than you could with BLAST+ on a single host. Use of the cloud also allows you to collaborate with colleagues, allowing the sharing of results, datasets and pipelines on a common platform. The National Center for Biotechnology Information ([NCBI](https://www.ncbi.nlm.nih.gov)), part of the National Library of Medicine at the NIH, developed and maintains ElasticBLAST.
description = ElasticBLAST runs BLAST searches faster by distributing its work to multiple cloud instances. This allows larger numbers of queries to be searched in less time compared to BLAST+ on a single host. Use of the cloud facilitates collaboration, sharing of results, datasets and pipelines on a common platform. The National Center for Biotechnology Information ([NCBI](https://www.ncbi.nlm.nih.gov)), part of the National Library of Medicine at the NIH, developed and maintains ElasticBLAST.
long_description = file:README.md
long_description_content_type = text/markdown
maintainer = NCBI
Expand Down
5 changes: 4 additions & 1 deletion src/elastic_blast/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,10 @@ def check_prerequisites() -> None:
version_data = json.loads(p.stdout.decode())
kubectl_version = version_data["clientVersion"]["major"] + "."
kubectl_version += version_data["clientVersion"]["minor"]
if is_newer_version(kubectl_version, "1.25") and shutil.which("gke-gcloud-auth-plugin") is None:
is_newer_than_1_25 = True
try : is_newer_than_1_25 = is_newer_version(kubectl_version, "1.25")
except ValueError: pass # ignore version parsing errors
if is_newer_than_1_25 and shutil.which("gke-gcloud-auth-plugin") is None:
message = f"Missing dependency 'gke-gcloud-auth-plugin', "
message += "for more information, please see "
message += "https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke"
Expand Down
8 changes: 6 additions & 2 deletions src/elastic_blast/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,15 @@ def is_newer_version(version1: str, version2: str) -> bool:
Returns:
bool: True if version1 is newer than version2, False otherwise.
Throws: ValueError if any of the arguments cannot be parsed
"""
def parse_and_remove_trailing_plus(version_str: str) -> list[str]:
return [part[:-1] if re.search(r'\D$', part) else part for part in version_str.split('.')]

# Split version strings into lists of integers
v1_parts = [int(part) for part in version1.split('.')]
v2_parts = [int(part) for part in version2.split('.')]
v1_parts = [int(part) for part in parse_and_remove_trailing_plus(version1)]
v2_parts = [int(part) for part in parse_and_remove_trailing_plus(version2)]

# Compare each part of the version numbers
for v1, v2 in zip_longest(v1_parts, v2_parts, fillvalue=0):
Expand Down
19 changes: 19 additions & 0 deletions tests/util/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ def test_is_newer_version():
assert is_newer_version("0.3", "1.0") is False
assert is_newer_version("1.5", "1.2.3") is True
assert is_newer_version("1.5", "1.7.3") is False
assert is_newer_version("1.27+", "1.25") is True
assert is_newer_version("1.27-", "1.25") is True
assert is_newer_version("1.34a", "1.25") is True
assert is_newer_version("1a.34B", "1.25") is True

with pytest.raises(ValueError):
is_newer_version("1a.hello", "1.25")
with pytest.raises(ValueError):
is_newer_version("1a.3hello", "1.25")
with pytest.raises(ValueError):
is_newer_version("invalid_version_string", "1.25")
with pytest.raises(ValueError):
is_newer_version("1.1", "invalid_version_string")
with pytest.raises(ValueError):
is_newer_version("", "1.0")
with pytest.raises(ValueError):
is_newer_version("0.5", "")
with pytest.raises(ValueError):
is_newer_version("", "")

assert is_newer_version("1.0", "1.0") is False
assert is_newer_version("1.0", "1.0.0") is False
Expand Down

0 comments on commit f03e4a0

Please sign in to comment.