🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧
PackagePath(self, path: Path |None=None)
Gets the absolute path to a specific file or folder in a data package.
The functions in this class are used to get the absolute path to a specific file or folder in a data package. They are intended as convenience functions to provide easy and quick access to required files and folders within a data package. These functions have these characteristics in common:
All of these functions output a Path object.
The base class has an optional path argument that defaults to the current working directory available from the base class.
If the wrong resource_name is given, an error message will include a list of all the actual resource_name’s for a specific package.
Outputs a PackagePath object representing the structure of a data package.
Parameters
path:Path | None=None
Provide a path to the package directory. Defaults to the current working directory.
Examples
from pathlib import Pathimport seedcase_sprout as sp# With default pathsp.PackagePath().properties()sp.PackagePath().readme()# With custom pathmy_path = Path("my/path")sp.PackagePath(my_path).properties()sp.PackagePath(my_path).readme()