{"id":13578026,"url":"https://github.com/allenai/cached_path","last_synced_at":"2025-10-13T15:55:53.616Z","repository":{"id":37088065,"uuid":"401615574","full_name":"allenai/cached_path","owner":"allenai","description":"A file utility for accessing both local and remote files through a unified interface.","archived":false,"fork":false,"pushed_at":"2025-09-30T17:19:17.000Z","size":518,"stargazers_count":44,"open_issues_count":19,"forks_count":18,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-30T18:28:45.357Z","etag":null,"topics":["caching","downloader","python","python3"],"latest_commit_sha":null,"homepage":"https://cached-path.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allenai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-31T07:41:00.000Z","updated_at":"2025-09-30T17:19:20.000Z","dependencies_parsed_at":"2024-01-09T22:30:45.574Z","dependency_job_id":"b7a5a7da-edfc-4931-aadc-dd9a46666551","html_url":"https://github.com/allenai/cached_path","commit_stats":{"total_commits":177,"total_committers":6,"mean_commits":29.5,"dds":0.5932203389830508,"last_synced_commit":"150db50e29c0155c41e58a3acee0fa2787256482"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":"allenai/python-package-template","purl":"pkg:github/allenai/cached_path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenai%2Fcached_path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenai%2Fcached_path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenai%2Fcached_path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenai%2Fcached_path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allenai","download_url":"https://codeload.github.com/allenai/cached_path/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allenai%2Fcached_path/sbom","scorecard":{"id":185270,"data":{"date":"2025-08-11","repo":{"name":"github.com/allenai/cached_path","commit":"4b7f801e21424ce3078ad70f347d2ac38a217523"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 4/18 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/pr_checks.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":1,"reason":"dependency not pinned by hash detected -- score normalized to 1","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:137: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:142: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:157: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:171: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:85: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:120: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr_checks.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/allenai/cached_path/pr_checks.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:74","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:96","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:148","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:149","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   5 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.7.3 not signed: https://api.github.com/repos/allenai/cached_path/releases/217096267","Warn: release artifact v1.7.2 not signed: https://api.github.com/repos/allenai/cached_path/releases/212933829","Warn: release artifact v1.7.1 not signed: https://api.github.com/repos/allenai/cached_path/releases/205145796","Warn: release artifact v1.7.0 not signed: https://api.github.com/repos/allenai/cached_path/releases/205142689","Warn: release artifact v1.6.7 not signed: https://api.github.com/repos/allenai/cached_path/releases/194760318","Warn: release artifact v1.7.3 does not have provenance: https://api.github.com/repos/allenai/cached_path/releases/217096267","Warn: release artifact v1.7.2 does not have provenance: https://api.github.com/repos/allenai/cached_path/releases/212933829","Warn: release artifact v1.7.1 does not have provenance: https://api.github.com/repos/allenai/cached_path/releases/205145796","Warn: release artifact v1.7.0 does not have provenance: https://api.github.com/repos/allenai/cached_path/releases/205142689","Warn: release artifact v1.6.7 does not have provenance: https://api.github.com/repos/allenai/cached_path/releases/194760318"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T19:42:01.000Z","repository_id":37088065,"created_at":"2025-08-16T19:42:01.000Z","updated_at":"2025-08-16T19:42:01.000Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015939,"owners_count":26085777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caching","downloader","python","python3"],"created_at":"2024-08-01T15:01:26.404Z","updated_at":"2025-10-13T15:55:53.610Z","avatar_url":"https://github.com/allenai.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# [cached-path](https://cached-path.readthedocs.io/)\n\n\u003c!-- start tagline --\u003e\n\nA file utility library that provides a unified, simple interface for accessing both local and remote files.\nThis can be used behind other APIs that need to access files agnostic to where they are located.\n\n\u003c!-- end tagline --\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/allenai/cached_path/actions\"\u003e\n        \u003cimg alt=\"CI\" src=\"https://github.com/allenai/cached_path/workflows/CI/badge.svg?event=push\u0026branch=main\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/cached_path/\"\u003e\n        \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/cached_path\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cached-path.readthedocs.io/en/latest/?badge=latest\"\u003e\n        \u003cimg src=\"https://readthedocs.org/projects/cached-path/badge/?version=latest\" alt=\"Documentation Status\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/allenai/cached_path/blob/main/LICENSE\"\u003e\n        \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/allenai/cached_path.svg?color=blue\u0026cachedrop\"\u003e\n    \u003c/a\u003e\n    \u003cbr/\u003e\n\u003c/p\u003e\n\n## Quick links\n\n- [Documentation](https://cached-path.readthedocs.io/)\n- [PyPI Package](https://pypi.org/project/cached-path/)\n- [Contributing](https://github.com/allenai/cached_path/blob/main/CONTRIBUTING.md)\n- [License](https://github.com/allenai/cached_path/blob/main/LICENSE)\n\n## Installation\n\n\u003c!-- start py version --\u003e\n\n**cached-path** requires Python 3.7 or later.\n\n\u003c!-- end py version --\u003e\n\n### Installing with `pip`\n\n\u003c!-- start install pip --\u003e\n\n**cached-path** is available [on PyPI](https://pypi.org/project/cached-path/). Just run\n\n```bash\npip install cached-path\n```\n\n\u003c!-- end install pip --\u003e\n\n### Installing from source\n\n\u003c!-- start install source --\u003e\n\nTo install **cached-path** from source, first clone [the repository](https://github.com/allenai/cached_path):\n\n```bash\ngit clone https://github.com/allenai/cached_path.git\ncd cached_path\n```\n\nThen run\n\n```bash\npip install -e .\n```\n\n\u003c!-- end install source --\u003e\n\n## Usage\n\n```python\nfrom cached_path import cached_path\n```\n\nGiven something that might be a URL or local path, `cached_path()` determines which.\nIf it's a remote resource, it downloads the file and caches it to the [cache directory](#cache-directory), and\nthen returns the path to the cached file. If it's already a local path,\nit makes sure the file exists and returns the path.\n\nFor URLs, `http://`, `https://`, `s3://` (AWS S3), `gs://` (Google Cloud Storage), and `hf://` (HuggingFace Hub) are all supported out-of-the-box.\nOptionally `beaker://` URLs in the form of `beaker://{user_name}/{dataset_name}/{file_path}` are supported, which requires [beaker-py](https://beaker-py-docs.allen.ai) to be installed.\n\nFor example, to download the PyTorch weights for the model `epwalsh/bert-xsmall-dummy`\non HuggingFace, you could do:\n\n```python\ncached_path(\"hf://epwalsh/bert-xsmall-dummy/pytorch_model.bin\")\n```\n\nFor paths or URLs that point to a tarfile or zipfile, you can also add a path\nto a specific file to the `url_or_filename` preceeded by a \"!\", and the archive will\nbe automatically extracted (provided you set `extract_archive` to `True`),\nreturning the local path to the specific file. For example:\n\n```python\ncached_path(\"model.tar.gz!weights.th\", extract_archive=True)\n```\n\n### Using custom headers for HTTP requests\n\nYou can provide custom headers for HTTP requests, which is useful for accessing private resources that require authentication:\n\n```python\n# Using an API token for private resources (e.g. Hugging Face)\nheaders = {\"Authorization\": f\"Bearer {hf_token}\"}\ncached_path(\"https://huggingface.co/api/models/private-model/resolve/main/model.bin\", headers=headers)\n```\n\nThis is particularly useful for downloading private files from services like Hugging Face, GitHub, or any other API that uses Bearer token authentication.\n\n### Cache directory\n\nBy default the cache directory is `~/.cache/cached_path/`, however there are several ways to override this setting:\n- set the environment variable `CACHED_PATH_CACHE_ROOT`,\n- call `set_cache_dir()`, or\n- set the `cache_dir` argument each time you call `cached_path()`.\n\n## Team\n\n\u003c!-- start team --\u003e\n\n**cached-path** is developed and maintained by the AllenNLP team, backed by [the Allen Institute for Artificial Intelligence (AI2)](https://allenai.org/).\nAI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering.\nTo learn more about who specifically contributed to this codebase, see [our contributors](https://github.com/allenai/cached_path/graphs/contributors) page.\n\n\u003c!-- end team --\u003e\n\n## License\n\n\u003c!-- start license --\u003e\n\n**cached-path** is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).\nA full copy of the license can be found [on GitHub](https://github.com/allenai/cached_path/blob/main/LICENSE).\n\n\u003c!-- end license --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenai%2Fcached_path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallenai%2Fcached_path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenai%2Fcached_path/lists"}