@@ -97,6 +97,7 @@ def _replace_relative_paths_for_remote_source(
9797def load_raw_resource_description (
9898 source : Union [dict , os .PathLike , IO , str , bytes , raw_nodes .URI , RawResourceDescription ],
9999 update_to_current_format : bool = True ,
100+ update_to_format : Optional [str ] = None ,
100101) -> RawResourceDescription :
101102 """load a raw python representation from a BioImage.IO resource description file (RDF).
102103 Use `load_resource_description` for a more convenient representation.
@@ -105,14 +106,17 @@ def load_raw_resource_description(
105106 source: resource description file (RDF)
106107 update_to_current_format: if True (default) attempt auto-conversion to latest format version
107108 (most bioimageio.core functionality expects the latest format version for each resource)
109+ update_to_format: update resource to specific major.minor format version; ignoring patch version.
108110
109111 Returns:
110112 raw BioImage.IO resource
111113 """
112114 if isinstance (source , RawResourceDescription ):
113115 return source
114116
115- raw_rd = spec .load_raw_resource_description (source , update_to_current_format = update_to_current_format )
117+ raw_rd = spec .load_raw_resource_description (
118+ source , update_to_current_format = update_to_current_format , update_to_format = update_to_format
119+ )
116120 raw_rd = _replace_relative_paths_for_remote_source (raw_rd , raw_rd .root_path )
117121 return raw_rd
118122
@@ -136,7 +140,7 @@ def load_resource_description(
136140 if isinstance (source , ResourceDescription ):
137141 return source
138142
139- raw_rd = load_raw_resource_description (source , update_to_current_format = True )
143+ raw_rd = load_raw_resource_description (source , update_to_format = "latest" )
140144
141145 if weights_priority_order is not None :
142146 for wf in weights_priority_order :
@@ -188,6 +192,7 @@ def export_resource_package(
188192 compression_level : int = 1 ,
189193 output_path : Optional [os .PathLike ] = None ,
190194 update_to_current_format : bool = False ,
195+ update_to_format : Optional [str ] = None ,
191196 weights_priority_order : Optional [Sequence [Union [str ]]] = None ,
192197) -> pathlib .Path :
193198 """Package a BioImage.IO resource as a zip file.
@@ -199,13 +204,16 @@ def export_resource_package(
199204 See https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile
200205 output_path: file path to write package to
201206 update_to_current_format: If True attempt auto-conversion to latest format version.
207+ update_to_format: update resource to specific major.minor format version; ignoring patch version.
202208 weights_priority_order: If given only the first weights format present in the model is included.
203209 If none of the prioritized weights formats is found all are included.
204210
205211 Returns:
206212 path to zipped BioImage.IO package in BIOIMAGEIO_CACHE_PATH or 'output_path'
207213 """
208- raw_rd = load_raw_resource_description (source , update_to_current_format = update_to_current_format )
214+ raw_rd = load_raw_resource_description (
215+ source , update_to_current_format = update_to_current_format , update_to_format = update_to_format
216+ )
209217 package_content = get_local_resource_package_content (raw_rd , weights_priority_order )
210218 if output_path is None :
211219 package_path = _get_tmp_package_path (raw_rd , weights_priority_order )
0 commit comments