{"id":1768,"library":"unearth","title":"Unearth Package Fetcher","description":"Unearth is a utility library for fetching and downloading Python packages from various sources, including PyPI, local files, and version control systems (Git). It's currently at version 0.18.2 and maintains an active release cadence with frequent bug fixes and minor features.","status":"active","version":"0.18.2","language":"en","source_language":"en","source_url":"https://github.com/frostming/unearth","tags":["package management","dependency resolution","packaging","pypi"],"install":[{"cmd":"pip install unearth","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Unearth","correct":"from unearth import Unearth"}],"quickstart":{"code":"import tempfile\nfrom pathlib import Path\nfrom unearth import Unearth\n\n# Create a temporary directory for caching resolved packages\nwith tempfile.TemporaryDirectory() as cache_dir_str:\n    cache_dir = Path(cache_dir_str)\n\n    # Instantiate Unearth to search for packages on PyPI\n    finder = Unearth(\n        index_urls=[\"https://pypi.org/simple\"],\n        cache_dir=cache_dir\n    )\n\n    # Find matches for a specific package, e.g., 'requests'\n    matches = finder.find_matches(\"requests\")\n\n    # Get the best matching distribution\n    best_match = matches.best_match\n\n    if best_match:\n        print(f\"Found best match: {best_match.name} {best_match.version} from {best_match.link.url}\")\n        # To actually download, you would process best_match.link.url\n        # Unearth primarily provides the links, not direct download functionality\n    else:\n        print(\"No matches found for requests.\")","lang":"python","description":"This example demonstrates how to initialize `Unearth` and use it to find the best match for a Python package from PyPI, using a temporary cache directory."},"warnings":[{"fix":"Ensure your Python environment is 3.9 or newer. If you must use Python 3.8, pin `unearth<0.18.0`. For Python 3.7 or older, pin `unearth<0.17.2`.","message":"Unearth dropped support for Python 3.8 in version 0.18.0. Earlier, Python 3.7 and below were dropped in version 0.17.2. Users on affected Python versions will encounter errors.","severity":"breaking","affected_versions":"<0.18.0 (for 3.8), <0.17.2 (for <=3.7)"},{"fix":"Always use the latest `unearth` version (0.18.2+) to ensure robust and correct parsing and fetching from Git URLs that include branches or specific commit references.","message":"Handling of Git URLs, especially with branches and specific revisions, has been refined across several versions. A regression in earlier 0.18.x versions might have prevented correct parsing of Git URLs with branches.","severity":"gotcha","affected_versions":"<0.18.2 (for branches), <0.18.0 (for refs)"},{"fix":"Verify that your `.netrc` file is correctly formatted and has appropriate file permissions (e.g., `chmod 600 ~/.netrc`). Warnings were made less verbose in 0.17.1 and 0.17.2.","message":"Starting from version 0.17.0, `unearth` became more explicit with warnings related to parsing `.netrc` files. Users might see warnings if their `.netrc` is malformed, has incorrect permissions, or if authentication fails.","severity":"gotcha","affected_versions":"0.17.0+"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}