read_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 🚧

read_properties(path: Path | None = None)

Read in the properties from the datapackage.json file.

Reads the datapackage.json file, checks that it is correct, and then outputs a PackageProperties object.

Parameters

path : Path | None = None

The path to the datapackage.json file. Use PackagePath().properties() to help get the correct path. If no path is provided, this function looks for the datapackage.json file in the current working directory.

Returns

PackageProperties

Outputs a PackageProperties object with the properties from the datapackage.json file.

Examples

import seedcase_sprout as sp

with sp.ExamplePackage():
    sp.read_properties()
PackageProperties(name='example-package', id='3bcf4ac3-c30d-4f46-9ba7-dee79b1d1986', title='Example fake data package', description='Data from a fake data package on something.', homepage=None, version='0.1.0', created='2025-05-22T13:06:29+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=[ResourceProperties(name='example-resource', path='resources/example-resource/data.parquet', type=None, title='Example fake data resource', description='Data from a fake resource on something.', sources=None, licenses=None, format=None, mediatype=None, encoding=None, bytes=None, hash=None, schema=TableSchemaProperties(fields=[FieldProperties(name='id', title='ID', type='integer', format=None, description='Unique identifier for the record.', example=None, constraints=None, categories=None, categories_ordered=None, missing_values=None), FieldProperties(name='name', title='Name', type='string', format=None, description='Name of the record.', example=None, constraints=None, categories=None, categories_ordered=None, missing_values=None), FieldProperties(name='value', title='Value', type='number', format=None, description='Value of the record.', example=None, constraints=None, categories=None, categories_ordered=None, missing_values=None)], fields_match=None, primary_key=['id'], unique_keys=None, foreign_keys=None, missing_values=None))], sources=None)

Raises

FileNotFound

If the datapackage.json file doesn’t exist.

JSONDecodeError

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