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_properties(
        properties=sp.example_package_properties(),
        path=sp.path_packages()
    )

    # TODO: Update after converting to "local-first"
    # Get the path to the package
    # sp.path_package(package_id=1)
PosixPath('/tmp/tmpxjbi5vya/packages/datapackage.json')