🚧 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)
Get the absolute path to a specific file or folder in a data package.
Use the functions in this class to get the absolute path to a specific file or folder in your data package. They are intended as convenience functions to provide you with easy and quick access to required files and folders within your 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()