%global _empty_manifest_terminate_build 0 Name: python-cached-path Version: 1.3.4 Release: 1 Summary: please add a summary manually as the author left a blank one License: Apache URL: https://github.com/allenai/cached_path Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2f/fa/d068e59abde0bb132dc96521953f483b7d63323f2adab86e8021b996e4e4/cached_path-1.3.4.tar.gz BuildArch: noarch Requires: python3-requests Requires: python3-rich Requires: python3-filelock Requires: python3-boto3 Requires: python3-google-cloud-storage Requires: python3-huggingface-hub Requires: python3-dataclasses Requires: python3-beaker-py Requires: python3-flake8 Requires: python3-mypy Requires: python3-black Requires: python3-isort Requires: python3-pytest Requires: python3-flaky Requires: python3-pytest-cov Requires: python3-coverage Requires: python3-codecov Requires: python3-twine Requires: python3-setuptools Requires: python3-wheel Requires: python3-responses Requires: python3-Sphinx Requires: python3-furo Requires: python3-myst-parser Requires: python3-sphinx-copybutton Requires: python3-sphinx-autobuild Requires: python3-sphinx-autodoc-typehints Requires: python3-packaging %description # [cached-path](https://cached-path.readthedocs.io/) A file utility library that provides a unified, simple interface for accessing both local and remote files. This can be used behind other APIs that need to access files agnostic to where they are located.

CI PyPI Documentation Status License

## Quick links - [Documentation](https://cached-path.readthedocs.io/) - [PyPI Package](https://pypi.org/project/cached-path/) - [Contributing](https://github.com/allenai/cached_path/blob/main/CONTRIBUTING.md) - [License](https://github.com/allenai/cached_path/blob/main/LICENSE) ## Installation **cached-path** requires Python 3.7 or later. ### Installing with `pip` **cached-path** is available [on PyPI](https://pypi.org/project/cached-path/). Just run ```bash pip install cached-path ``` ### Installing from source To install **cached-path** from source, first clone [the repository](https://github.com/allenai/cached_path): ```bash git clone https://github.com/allenai/cached_path.git cd cached_path ``` Then run ```bash pip install -e . ``` ## Usage ```python from cached_path import cached_path ``` Given something that might be a URL or local path, `cached_path()` determines which. If it's a remote resource, it downloads the file and caches it to the [cache directory](#cache-directory), and then returns the path to the cached file. If it's already a local path, it makes sure the file exists and returns the path. For URLs, `http://`, `https://`, `s3://` (AWS S3), `gs://` (Google Cloud Storage), and `hf://` (HuggingFace Hub) are all supported out-of-the-box. Optionally `beaker://` URLs in the form of `beaker://{user_name}/{dataset_name}/{file_path}` are supported, which requires [beaker-py](https://github.com/allenai/beaker-py) to be installed. For example, to download the PyTorch weights for the model `epwalsh/bert-xsmall-dummy` on HuggingFace, you could do: ```python cached_path("hf://epwalsh/bert-xsmall-dummy/pytorch_model.bin") ``` For paths or URLs that point to a tarfile or zipfile, you can also add a path to a specific file to the `url_or_filename` preceeded by a "!", and the archive will be automatically extracted (provided you set `extract_archive` to `True`), returning the local path to the specific file. For example: ```python cached_path("model.tar.gz!weights.th", extract_archive=True) ``` ### Cache directory By default the cache directory is `~/.cache/cached_path/`, however there are several ways to override this setting: - set the environment variable `CACHED_PATH_CACHE_ROOT`, - call `set_cache_dir()`, or - set the `cache_dir` argument each time you call `cached_path()`. ## Team **cached-path** is developed and maintained by the AllenNLP team, backed by [the Allen Institute for Artificial Intelligence (AI2)](https://allenai.org/). AI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering. To learn more about who specifically contributed to this codebase, see [our contributors](https://github.com/allenai/cached_path/graphs/contributors) page. ## License **cached-path** is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). A full copy of the license can be found [on GitHub](https://github.com/allenai/cached_path/blob/main/LICENSE). %package -n python3-cached-path Summary: please add a summary manually as the author left a blank one Provides: python-cached-path BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-cached-path # [cached-path](https://cached-path.readthedocs.io/) A file utility library that provides a unified, simple interface for accessing both local and remote files. This can be used behind other APIs that need to access files agnostic to where they are located.

CI PyPI Documentation Status License

## Quick links - [Documentation](https://cached-path.readthedocs.io/) - [PyPI Package](https://pypi.org/project/cached-path/) - [Contributing](https://github.com/allenai/cached_path/blob/main/CONTRIBUTING.md) - [License](https://github.com/allenai/cached_path/blob/main/LICENSE) ## Installation **cached-path** requires Python 3.7 or later. ### Installing with `pip` **cached-path** is available [on PyPI](https://pypi.org/project/cached-path/). Just run ```bash pip install cached-path ``` ### Installing from source To install **cached-path** from source, first clone [the repository](https://github.com/allenai/cached_path): ```bash git clone https://github.com/allenai/cached_path.git cd cached_path ``` Then run ```bash pip install -e . ``` ## Usage ```python from cached_path import cached_path ``` Given something that might be a URL or local path, `cached_path()` determines which. If it's a remote resource, it downloads the file and caches it to the [cache directory](#cache-directory), and then returns the path to the cached file. If it's already a local path, it makes sure the file exists and returns the path. For URLs, `http://`, `https://`, `s3://` (AWS S3), `gs://` (Google Cloud Storage), and `hf://` (HuggingFace Hub) are all supported out-of-the-box. Optionally `beaker://` URLs in the form of `beaker://{user_name}/{dataset_name}/{file_path}` are supported, which requires [beaker-py](https://github.com/allenai/beaker-py) to be installed. For example, to download the PyTorch weights for the model `epwalsh/bert-xsmall-dummy` on HuggingFace, you could do: ```python cached_path("hf://epwalsh/bert-xsmall-dummy/pytorch_model.bin") ``` For paths or URLs that point to a tarfile or zipfile, you can also add a path to a specific file to the `url_or_filename` preceeded by a "!", and the archive will be automatically extracted (provided you set `extract_archive` to `True`), returning the local path to the specific file. For example: ```python cached_path("model.tar.gz!weights.th", extract_archive=True) ``` ### Cache directory By default the cache directory is `~/.cache/cached_path/`, however there are several ways to override this setting: - set the environment variable `CACHED_PATH_CACHE_ROOT`, - call `set_cache_dir()`, or - set the `cache_dir` argument each time you call `cached_path()`. ## Team **cached-path** is developed and maintained by the AllenNLP team, backed by [the Allen Institute for Artificial Intelligence (AI2)](https://allenai.org/). AI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering. To learn more about who specifically contributed to this codebase, see [our contributors](https://github.com/allenai/cached_path/graphs/contributors) page. ## License **cached-path** is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). A full copy of the license can be found [on GitHub](https://github.com/allenai/cached_path/blob/main/LICENSE). %package help Summary: Development documents and examples for cached-path Provides: python3-cached-path-doc %description help # [cached-path](https://cached-path.readthedocs.io/) A file utility library that provides a unified, simple interface for accessing both local and remote files. This can be used behind other APIs that need to access files agnostic to where they are located.

CI PyPI Documentation Status License

## Quick links - [Documentation](https://cached-path.readthedocs.io/) - [PyPI Package](https://pypi.org/project/cached-path/) - [Contributing](https://github.com/allenai/cached_path/blob/main/CONTRIBUTING.md) - [License](https://github.com/allenai/cached_path/blob/main/LICENSE) ## Installation **cached-path** requires Python 3.7 or later. ### Installing with `pip` **cached-path** is available [on PyPI](https://pypi.org/project/cached-path/). Just run ```bash pip install cached-path ``` ### Installing from source To install **cached-path** from source, first clone [the repository](https://github.com/allenai/cached_path): ```bash git clone https://github.com/allenai/cached_path.git cd cached_path ``` Then run ```bash pip install -e . ``` ## Usage ```python from cached_path import cached_path ``` Given something that might be a URL or local path, `cached_path()` determines which. If it's a remote resource, it downloads the file and caches it to the [cache directory](#cache-directory), and then returns the path to the cached file. If it's already a local path, it makes sure the file exists and returns the path. For URLs, `http://`, `https://`, `s3://` (AWS S3), `gs://` (Google Cloud Storage), and `hf://` (HuggingFace Hub) are all supported out-of-the-box. Optionally `beaker://` URLs in the form of `beaker://{user_name}/{dataset_name}/{file_path}` are supported, which requires [beaker-py](https://github.com/allenai/beaker-py) to be installed. For example, to download the PyTorch weights for the model `epwalsh/bert-xsmall-dummy` on HuggingFace, you could do: ```python cached_path("hf://epwalsh/bert-xsmall-dummy/pytorch_model.bin") ``` For paths or URLs that point to a tarfile or zipfile, you can also add a path to a specific file to the `url_or_filename` preceeded by a "!", and the archive will be automatically extracted (provided you set `extract_archive` to `True`), returning the local path to the specific file. For example: ```python cached_path("model.tar.gz!weights.th", extract_archive=True) ``` ### Cache directory By default the cache directory is `~/.cache/cached_path/`, however there are several ways to override this setting: - set the environment variable `CACHED_PATH_CACHE_ROOT`, - call `set_cache_dir()`, or - set the `cache_dir` argument each time you call `cached_path()`. ## Team **cached-path** is developed and maintained by the AllenNLP team, backed by [the Allen Institute for Artificial Intelligence (AI2)](https://allenai.org/). AI2 is a non-profit institute with the mission to contribute to humanity through high-impact AI research and engineering. To learn more about who specifically contributed to this codebase, see [our contributors](https://github.com/allenai/cached_path/graphs/contributors) page. ## License **cached-path** is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). A full copy of the license can be found [on GitHub](https://github.com/allenai/cached_path/blob/main/LICENSE). %prep %autosetup -n cached-path-1.3.4 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-cached-path -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed Apr 12 2023 Python_Bot - 1.3.4-1 - Package Spec generated