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 🚧

core.edit_package_properties

core.edit_package_properties

Functions

Name Description
edit_package_properties Edits the properties of an existing package.

edit_package_properties

core.edit_package_properties.edit_package_properties(path, properties)

Edits the properties of an existing package.

Use this any time you want to edit the package’s properties and particularly after using create_package_structure(). Because create_package_structure() also creates an empty datapackage.json file, edit_package_properties() is used to fill in the properties file with details specific for the package.

When you need to edit the datapackage.json properties, use this function to ensure the properties are correctly structured and written. It only edits the properties of the package itself, not on the data resources contained within the package.

If the values in properties are well-formed, they will overwrite any preexisting values within the original package properties.

Parameters

path : Path

The path to the datapackage.json file. Use path_package_properties() to provide the correct path.

properties : dict

The new package properties to update from the original. Use PackageProperties to provide a correctly structured properties dictionary. See help(PackageProperties) for details on how to use it.

Returns

: dict

The updated package properties as a Python dictionary that mimicks the

: dict

JSON structure. Use write_package_properties() to save it back to the

: dict

datapackage.json file.

Raises

: FileNotFound

If the datapackage.json file doesn’t exist.

: NotPropertiesError

If the new package properties are not correct or the current package properties are not well-formed.

: JSONDecodeError

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