{"library":"pooch","code":"import pooch\nimport os\n\n# A dummy URL for demonstration. In a real scenario, this would point to your hosted data.\n# For a runnable example, we'll use a small file from fatiando/pooch's actual data.\ndata_url = \"https://github.com/fatiando/pooch/raw/v1.9.0/pooch/tests/data/tiny-data.txt\"\ndata_hash = \"sha256:d48d4841b5d197607a9b0c7a522533c095311e3895e5330a9e25d2c510800b50\"\n\n# Configure a new Pooch instance\n# We use a temporary directory for this example to avoid cluttering the actual cache.\n# In a real application, you'd likely use pooch.os_cache(\"your_app_name\")\n\n# Create a temporary directory for the cache\n# This is a workaround for the quickstart to be self-contained and runnable without permissions issues.\n# In a real library, use pooch.os_cache() to get the system default cache dir.\ncache_dir = os.environ.get('POOCH_TEST_CACHE', None)\nif not cache_dir:\n    import tempfile\n    temp_dir = tempfile.TemporaryDirectory()\n    cache_dir = temp_dir.name\nelse:\n    temp_dir = None # Manage cleanup later if not using TemporaryDirectory\n\n\nregistry = {\"tiny-data.txt\": data_hash}\n\nmy_pooch = pooch.create(\n    path=cache_dir,\n    base_url=\"https://github.com/fatiando/pooch/raw/{version}/pooch/tests/data/\",\n    version=\"v1.9.0\", # Match the version of the data you want to fetch\n    registry=registry\n)\n\n# Fetch the data file\nfile_path = my_pooch.fetch(\"tiny-data.txt\")\n\nprint(f\"Data file downloaded to: {file_path}\")\n\nwith open(file_path, \"r\") as f:\n    content = f.read()\n    print(f\"Content of the file: {content.strip()}\")\n\n# Clean up the temporary directory if it was created\nif temp_dir:\n    temp_dir.cleanup()\n","lang":"python","description":"This quickstart demonstrates how to set up a `Pooch` instance, register a data file with its URL and SHA256 hash, and then fetch it. `Pooch` will automatically download the file if it's not present or if its hash doesn't match, otherwise it will return the path to the cached file. The example uses a temporary directory for the cache for demonstration purposes; in a production library, `pooch.os_cache('your_library_name')` is recommended for persistent caching.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}