Warning

🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧

write_resource_properties

core.write_resource_properties(path: Path, resource_properties: dict)

Writes the specified resource properties to the datapackage.json file.

This functions verifies resource_properties, and if a resource with that ID is already present on the package, the properties of the resource with that ID are updated, with values in resource_properties overwriting preexisting values. Otherwise, resource_properties is added as a new resource.

Parameters

path : Path

The path to the datapackage.json file.

resource_properties : dict

The resource properties to add.

Returns

: Path

The path to the updated datapackage.json file.

Raises

: FileNotFound

If the datapackage.json file doesn’t exist.

: NotPropertiesError

If the resource or package properties are not correct, i.e., they are incomplete or don’t follow the Data Package specification.

: JSONDecodeError

If the datapackage.json file couldn’t be read.