🚧 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.create_resource_structure(path: Path)
Creates the directory structure of a new resource.
This is the first function to use to set up the structure for a data resource. It creates the paths for a new data resource in a specific (existing) package by creating the folder setup described in the Outputs section on the Sprout website. It creates two paths: the resources/<id>/ path and the resources/<id>/raw/ path. The output is a list of these two path objects.
Parameters
path:Path
Path to the resources directory in a package.
Returns
list[Path]
A list of the two created directories: - A path to the resource directory and - A path to the raw data directory.
Raises
NotADirectoryError
If path is not an existing directory.
Examples
import tempfilefrom pathlib import Pathimport seedcase_sprout.core as sp# Create a temporary directory for the examplewith tempfile.TemporaryDirectory() as temp_dir: temp_path = Path(temp_dir)# Create a package structure first sp.create_package_structure(path=temp_path)# Create a resource structure sp.create_resource_structure(path=temp_path /"1"/"resources")