Skip to content

Commit

Permalink
clean up version_nr vs sem_ver
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Feb 29, 2024
1 parent 04e4cf1 commit 2914f06
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions backoffice/utils/remote_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def publish(self) -> PublishedVersion:
else:
next_version = max(map(int, versions)) + 1

logger.debug("Publishing {} as version {}", self.folder, next_version)
logger.debug("Publishing {} as version nr {}", self.folder, next_version)

assert next_version not in versions, (next_version, versions)

Expand All @@ -262,7 +262,7 @@ def publish(self) -> PublishedVersion:
rdf_data = self.client.load_file(staged_rdf_path)
rdf = yaml.load(rdf_data)

sem_ver = rdf.get("sem_ver")
sem_ver = rdf.get("version")
if sem_ver is not None and sem_ver in {v["sem_ver"] for v in versions.values()}:
raise RuntimeError(f"Trying to publish {sem_ver} again!")

Expand Down
5 changes: 4 additions & 1 deletion backoffice/utils/s3_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class VersionDetails(TypedDict):
sem_ver: Optional[str]


Versions = dict[int, VersionDetails]
VersionNr = int
"""the n-th published version"""

Versions = dict[VersionNr, VersionDetails]
"""info about published resource versions at `<id>/versions.json`"""

LogCategory = Literal[
Expand Down
10 changes: 5 additions & 5 deletions backoffice/validate_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ def validate_format(staged: StagedVersion):

rd = rd_latest
rd.validation_summary.status = "passed" # passed in 'discover' mode
if not isinstance(rd, InvalidDescr) and rd.sem_ver is not None:
if not isinstance(rd, InvalidDescr) and rd.version is not None:
published = staged.get_published_versions()
if str(rd.sem_ver) in {v["sem_ver"] for v in published.values()}:
if str(rd.version) in {v["sem_ver"] for v in published.values()}:
error = ErrorEntry(
loc=("sem_ver",),
msg=f"Trying to publish semantic version {rd.sem_ver} again!",
loc=("version",),
msg=f"Trying to publish version {rd.version} again!",
type="error",
)
else:
error = None

rd.validation_summary.add_detail(
ValidationDetail(
name="Enforce that RDF has unpublished semantic version (field `sem_ver`)",
name="Enforce that RDF has unpublished semantic `version`",
status="passed" if error is None else "failed",
errors=[] if error is None else [error],
)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
],
packages=find_packages(exclude=["tests"]),
install_requires=[
"bioimageio.core @ git+https://github.com/bioimage-io/core-bioimage-io-python@40aae1005e6caea4a3ad6104f54deba8582d0f87", # TODO: change to released version
"bioimageio.spec @ git+https://github.com/bioimage-io/spec-bioimage-io@b9714ba8d8214c67e9377a8cd24f6ba65ed1b981", # TODO: change to released version
"bioimageio.core @ git+https://github.com/bioimage-io/core-bioimage-io-python@569666b426cb089503f2ee3bb5651e124d8740e8", # TODO: change to released version
"bioimageio.spec @ git+https://github.com/bioimage-io/spec-bioimage-io@06e6b0f77c696e7c5192fa1340482f97b2df98fc", # TODO: change to released version
"fire",
"loguru",
"minio==7.2.4",
Expand Down

0 comments on commit 2914f06

Please sign in to comment.