# s3-reader
[![test](https://github.com/rcmdnk/s3-reader/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/s3-reader/actions/workflows/test.yml)
[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/s3-reader/tree/coverage)
Python library to read S3 file as local file.
## Requirement
- Python 3.9, 3.10, 3.11
## Installation
```bash
$ pip install s3-reader
```
## Usage
```
from s3_reader import File
def check_s3_file(path):
file = File(path)
with open(file.path) as f:
...
check_s3_file('s3://<bucket>/path/to/file')
```
In this example, the S3 file is downloaded when `file = File(path)` is
executed, and it is stored as a temporary file.
`file.path` refers to the path of the locally stored temporary file.
At the end of the `check_s3_file` function, the file object is deleted, and
consequently, the temporary file is also deleted.
If path refers to a local file instead of an S3 file, File simply copies the
path, and you can use the File object in the same manner.
Raw data
{
"_id": null,
"home_page": "https://github.com/rcmdnk/s3-reader",
"name": "s3-reader",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "rcmdnk",
"author_email": "rcmdnk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/59/8a/c81a39083cf126cca6b5cb08ce63a75ee36c34690ebc2d746468ffac33f0/s3_reader-0.2.3.tar.gz",
"platform": null,
"description": "# s3-reader\n\n[![test](https://github.com/rcmdnk/s3-reader/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/s3-reader/actions/workflows/test.yml)\n[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/s3-reader/tree/coverage)\n\nPython library to read S3 file as local file.\n\n## Requirement\n\n- Python 3.9, 3.10, 3.11\n\n## Installation\n\n```bash\n$ pip install s3-reader\n```\n\n## Usage\n\n```\nfrom s3_reader import File\n\n\ndef check_s3_file(path):\n file = File(path)\n\n with open(file.path) as f:\n ...\n\ncheck_s3_file('s3://<bucket>/path/to/file')\n\n```\n\nIn this example, the S3 file is downloaded when `file = File(path)` is\nexecuted, and it is stored as a temporary file.\n\n`file.path` refers to the path of the locally stored temporary file.\n\nAt the end of the `check_s3_file` function, the file object is deleted, and\nconsequently, the temporary file is also deleted.\n\nIf path refers to a local file instead of an S3 file, File simply copies the\npath, and you can use the File object in the same manner.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python library to read S3 file as local file.",
"version": "0.2.3",
"project_urls": {
"Homepage": "https://github.com/rcmdnk/s3-reader",
"Repository": "https://github.com/rcmdnk/s3-reader"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3d59fe39eca9c132fff9251546bdc1bbb86cfc5ff5807bd5e563c6fde5aa1f2a",
"md5": "bbf1c593a0d87e2c25e8d467add7a5b4",
"sha256": "f9d0ff40508ef09f5f2dde48d5a27540d80081eeaf1a6a8e46ae7357492347cf"
},
"downloads": -1,
"filename": "s3_reader-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bbf1c593a0d87e2c25e8d467add7a5b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 7385,
"upload_time": "2024-01-09T10:59:15",
"upload_time_iso_8601": "2024-01-09T10:59:15.676543Z",
"url": "https://files.pythonhosted.org/packages/3d/59/fe39eca9c132fff9251546bdc1bbb86cfc5ff5807bd5e563c6fde5aa1f2a/s3_reader-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "598ac81a39083cf126cca6b5cb08ce63a75ee36c34690ebc2d746468ffac33f0",
"md5": "96871351d28b7faec595827be3f4b657",
"sha256": "dffd37ef905fbd00c96ac8183c2738fe9badd0a47bd2711397475a7ee99ed9d9"
},
"downloads": -1,
"filename": "s3_reader-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "96871351d28b7faec595827be3f4b657",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 7381,
"upload_time": "2024-01-09T10:59:16",
"upload_time_iso_8601": "2024-01-09T10:59:16.884994Z",
"url": "https://files.pythonhosted.org/packages/59/8a/c81a39083cf126cca6b5cb08ce63a75ee36c34690ebc2d746468ffac33f0/s3_reader-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-09 10:59:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rcmdnk",
"github_project": "s3-reader",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "s3-reader"
}