update_package_properties

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 🚧

update_package_properties(
    current_properties: PackageProperties,
    update_properties: PackageProperties,
)

Updates the properties of an existing package.

Use this any time you want to update the package’s properties. When you need to update the datapackage.json file, use this function to ensure the properties are correctly structured before they’re written. It only updates the properties of the package itself, not of the data resources contained within the package.

If the properties in the update_properties argument are correct (i.e., they pass the properties checks), they will overwrite any pre-existing properties within the current properties.

Parameters

current_properties : PackageProperties

The current properties found in the datapackage.json file. Use read_properties() to get the current properties.

update_properties : PackageProperties

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

Returns

PackageProperties

The updated package properties as a PackageProperties object. Use

PackageProperties

write_package_properties() to save it back to the datapackage.json

PackageProperties

file.

Raises

ExceptionGroup

If there is an error in the current, incoming, or resulting package properties. A group of CheckErrors, one error for each failed check.

Examples

import seedcase_sprout as sp

sp.update_package_properties(
    current_properties=sp.example_package_properties(),
    update_properties=sp.PackageProperties(
        title="New Package Title",
        name="new-package-name",
        description="New Description",
    ),
)
PackageProperties(name='new-package-name', id='b2a1e73f-bb56-4b88-b13b-3af56d64fdc1', title='New Package Title', description='New Description', homepage=None, version='0.1.0', created='2025-05-22T13:06:58+00:00', contributors=[ContributorProperties(title='Jamie Jones', path=None, email='jamie_jones@example.com', given_name=None, family_name=None, organization=None, roles=['creator'])], keywords=None, image=None, licenses=[LicenseProperties(name='ODC-BY-1.0', path='https://opendatacommons.org/licenses/by', title='Open Data Commons Attribution License 1.0')], resources=None, sources=None)