path_package

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 🚧

core.path_package(package_id: int)

Get the path to a specific package in Sprout’s global location.

If you want to get the location of the global packages directory, see path_sprout_global().

Parameters

package_id : int

The ID of the package.

Returns

Path

The absolute path to the specified package found in SPROUT_GLOBAL.

Examples

import os
import tempfile
from pathlib import Path

import seedcase_sprout.core as sp

# Create a temporary directory for the example
with tempfile.TemporaryDirectory() as temp_dir:
    os.environ["SPROUT_GLOBAL"] = temp_dir

    # Create a package structure first
    sp.create_package_structure(path=sp.path_packages())

    # Get the path to the package
    sp.path_package(package_id=1)
[PosixPath('/tmp/tmp19zea6e_/packages/1/datapackage.json'),
 PosixPath('/tmp/tmp19zea6e_/packages/1/README.md'),
 PosixPath('/tmp/tmp19zea6e_/packages/1/resources')]
PosixPath('/tmp/tmp19zea6e_/packages/1')