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 🚧

Function reference

Data package functions

Functions to work with and manage data packages, but not the data resources within them.

as_readme_text Create a human-readable version of the properties as a README string.
write_file Write the string to a file at the specified path.

Data resource functions

Functions to work with and manage data resources found within a data package.

extract_resource_properties Extract resource properties from a Polars DataFrame.
join_resource_batches Join all the batch resource DataFrames into a single (Polars) DataFrame.
read_resource_batches Read all the batch resource file(s) into a list of (Polars) DataFrames.
write_resource_batch Write the tidied data into the resource’s batch data folder.
write_resource_data Check and write the resource data into a file.

Package property dataclasses

Dataclasses to help create properties at the package level.

ContributorProperties The people or organizations who contributed to this data package.
LicenseProperties The license(s) under which the package or resource is provided.
PackageProperties Properties for a data package.
SourceProperties The raw sources for this data package.

Resource property dataclasses

Dataclasses to help create properties at the resource level.

ConstraintsProperties A dataclass that expresses constraints for validating field values.
FieldProperties A field in a table schema.
ReferenceProperties The destination part of a foreign key.
ResourceProperties A data resource.
TableSchemaForeignKeyProperties A foreign key in a table schema.
TableSchemaProperties A table schema for a data resource.

Property functions

Functions used to work with properties.

check_data Check that the DataFrame matches the requirements in the resource properties.
check_properties Check that all properties match Sprout’s requirements.
check_package_properties Check PackageProperties (not ResourceProperties) against the requirements.
check_resource_properties Checks that only the resource properties match Sprout’s requirements.
create_properties_script Create a properties script with default values.
create_resource_properties_script Create a script using the resource properties template.
read_properties Read in the properties from the datapackage.json file.
write_properties Write the properties to the datapackage.json file.

Path functions

Functions to support providing the correct file paths to files and folders in a data package for other functions.

PackagePath Get the absolute path to a specific file or folder in a data package.

Helper functions

Functions to support working with data packages and running code within Seedcase Sprout.

example_package_properties Generate an example package properties object.
example_resource_properties Generate an example resource properties object.
example_resource_properties_all_types Generate an example resource properties object with all Data Package data types.
example_data Generate an example Polars data frame.
example_data_all_types Generate an example Polars data frame with all Data Package data types.
ExamplePackage Create a temporary data package with optional resources for demoing or testing.