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

Core functions

Core functions that support the creation and management of data packages and data resources.

Data package functions

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

write_package_properties Writes the specified package properties to the datapackage.json file.
update_package_properties Updates the properties of an existing package.
as_readme_text Creates a string containing the README text based on the properties.

Data resource functions

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

create_resource_structure Creates the directory structure of a new resource.
join_resource_batches Joins all batch resource DataFrames into a single (Polars) DataFrame.
read_resource_batches Reads all the batch resource file(s) into a list of (Polars) DataFrames.
write_resource_batch Writes the tidied, original data into the resource’s batch data folder.
write_resource_data Check and write the resource data into a file.
write_resource_properties Writes the specified resource properties to the datapackage.json file.

Property dataclasses

Dataclasses that support creating correct data package properties.

ConstraintsProperties A dataclass that expresses constraints for validating field values.
ContributorProperties The people or organizations who contributed to this data package.
FieldProperties A field in a table schema.
LicenseProperties The license(s) under which the package or resource is provided.
MissingValueProperties Values that, when encountered in the source, should be considered as not present.
PackageProperties Properties for a data package.
ReferenceProperties The destination part of a foreign key.
ResourceProperties A data resource.
SourceProperties The raw sources for this data package.
TableSchemaForeignKeyProperties A foreign key in a table schema.
TableSchemaProperties A table schema for a data resource.

Property functions

Functions used to work with properties.

read_properties Read in the properties from 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 Gets 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 Sprout Core.

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 types.
example_data Generate an example Polars data frame.
example_data_all_types Generate an example Polars data frame with all data types.
ExamplePackage Create a temporary data package with optional resources for demoing or testing.
write_file Writes a file to the given path with the given content.