🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧
Writes the specified resource properties to the datapackage.json file.
This functions verifies resource_properties, and if a resource with that name is already present on the package, the properties of that resource are updated. The values in resource_properties overwrite preexisting values. Otherwise, resource_properties is added as a new resource.
Parameters
resource_properties:ResourceProperties
The resource properties to add. Use ResourceProperties to help create this object.
path:Path | None=None
The path to the datapackage.json file. Use PackagePath().properties() to help give the correct path. If no path is provided, this function looks for the datapackage.json file in the current working directory.
Returns
Path
The path to the updated datapackage.json file.
Raises
FileNotFound
If the datapackage.json file doesn’t exist.
ExceptionGroup
If there is an error in the properties. A group of CheckErrors, one error per failed check.
JSONDecodeError
If the datapackage.json file couldn’t be read.
Examples
import seedcase_sprout as spwith sp.ExamplePackage(): sp.write_resource_properties( resource_properties=sp.ResourceProperties( name="new-resource-name", title="New resource name", description="This is a new resource", ) )