Quickly read and write file based on their extension.
[![PyTest](https://github.com/crunchdao/readwrite/actions/workflows/pytest.yml/badge.svg)](https://github.com/crunchdao/readwrite/actions/workflows/pytest.yml)
- [Install](#install)
- [CLI Usage](#cli-usage)
- [Code Usage](#code-usage)
- [Supported Extensions](#supported-extensions)
## Install
```
python3 -m pip install --upgrade readwrite
```
## CLI Usage
```bash
readf [FILE-PATHS...]
```
or
```bash
readfile <EXTENSION> [EXTENSION-SPECIFIC-OPTIONS] [FILE-PATHS...]
```
## Code Usage
```python
import readwrite as rw
# will use pandas.read_csv(...)
df = rw.read("data.csv")
# will use pandas.to_parquet(...)
rw.write(df, "data.parquet")
```
## Supported Extensions
| Handler | Extensions | Backend | Read | Write |
| --- | --- | --- |:---:|:---:|
| [Binary](./readwrite/handlers/binary.py) | `bin` | [Python's `bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) | :heavy_check_mark: | :heavy_check_mark: |
| [Csv](./readwrite/handlers/csv.py) | `csv` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |
| [Excel](./readwrite/handlers/excel.py) | `xlsx` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |
| [Joblib](./readwrite/handlers/joblib.py) | `joblib` | [`joblib`](https://joblib.readthedocs.io/) | :heavy_check_mark: | :heavy_check_mark: |
| [Json](./readwrite/handlers/json.py) | `json` | [Python's `json`](https://docs.python.org/3/library/json.html) | :heavy_check_mark: | :heavy_check_mark: |
| [Parquet](./readwrite/handlers/parquet.py) | `parquet` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |
| [Pickle](./readwrite/handlers/pickle.py) | `pkl`, `pickle` | [Python's `pickle`](https://docs.python.org/3/library/pickle.html) or [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |
| [Toml](./readwrite/handlers/toml.py) | `toml` | [`toml`](https://pypi.org/project/toml/) | :heavy_check_mark: | :heavy_check_mark: |
| [Tar](./readwrite/handlers/tar.py) | `tar` | [Python's `tarfile`](https://docs.python.org/3/library/tarfile.html) | :heavy_check_mark: | :x: |
| [Text](./readwrite/handlers/text.py) | `txt` | [Python's `str`](https://docs.python.org/3/library/stdtypes.html#str) | :heavy_check_mark: | :heavy_check_mark: |
| [Yaml](./readwrite/handlers/yaml.py) | `yml`, `yaml` | [`PyYAML`](https://pyyaml.org/) | :heavy_check_mark: | :heavy_check_mark: |
| [Zarr](./readwrite/handlers/zarr.py) | `zarr` | [`SpatialData`](https://spatialdata.scverse.org/en/stable/) | :heavy_check_mark: | :x: |
| [Zip](./readwrite/handlers/zip.py) | `zip` | [Python's `zipfile`](https://docs.python.org/3/library/zipfile.html) | :heavy_check_mark: | :x: |
Raw data
{
"_id": null,
"home_page": "https://github.com/crunchdao/readwrite",
"name": "readwrite",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": null,
"keywords": "package development template",
"author": "Enzo CACERES",
"author_email": "enzo.caceres@crunchdao.com",
"download_url": "https://files.pythonhosted.org/packages/77/f5/db95cbf1766e62d47a9a1ca9b72626a74758a3df54606e6c7e67da9a2fcb/readwrite-0.9.0.tar.gz",
"platform": null,
"description": "Quickly read and write file based on their extension.\n\n[![PyTest](https://github.com/crunchdao/readwrite/actions/workflows/pytest.yml/badge.svg)](https://github.com/crunchdao/readwrite/actions/workflows/pytest.yml)\n\n- [Install](#install)\n- [CLI Usage](#cli-usage)\n- [Code Usage](#code-usage)\n- [Supported Extensions](#supported-extensions)\n\n## Install\n\n```\npython3 -m pip install --upgrade readwrite\n```\n\n## CLI Usage\n\n```bash\nreadf [FILE-PATHS...]\n```\n\nor\n\n```bash\nreadfile <EXTENSION> [EXTENSION-SPECIFIC-OPTIONS] [FILE-PATHS...]\n```\n\n## Code Usage\n\n```python\nimport readwrite as rw\n\n# will use pandas.read_csv(...)\ndf = rw.read(\"data.csv\")\n\n# will use pandas.to_parquet(...)\nrw.write(df, \"data.parquet\")\n```\n\n## Supported Extensions\n\n| Handler | Extensions | Backend | Read | Write |\n| --- | --- | --- |:---:|:---:|\n| [Binary](./readwrite/handlers/binary.py) | `bin` | [Python's `bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) | :heavy_check_mark: | :heavy_check_mark: |\n| [Csv](./readwrite/handlers/csv.py) | `csv` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Excel](./readwrite/handlers/excel.py) | `xlsx` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Joblib](./readwrite/handlers/joblib.py) | `joblib` | [`joblib`](https://joblib.readthedocs.io/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Json](./readwrite/handlers/json.py) | `json` | [Python's `json`](https://docs.python.org/3/library/json.html) | :heavy_check_mark: | :heavy_check_mark: |\n| [Parquet](./readwrite/handlers/parquet.py) | `parquet` | [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Pickle](./readwrite/handlers/pickle.py) | `pkl`, `pickle` | [Python's `pickle`](https://docs.python.org/3/library/pickle.html) or [`pandas`](https://pandas.pydata.org/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Toml](./readwrite/handlers/toml.py) | `toml` | [`toml`](https://pypi.org/project/toml/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Tar](./readwrite/handlers/tar.py) | `tar` | [Python's `tarfile`](https://docs.python.org/3/library/tarfile.html) | :heavy_check_mark: | :x: |\n| [Text](./readwrite/handlers/text.py) | `txt` | [Python's `str`](https://docs.python.org/3/library/stdtypes.html#str) | :heavy_check_mark: | :heavy_check_mark: |\n| [Yaml](./readwrite/handlers/yaml.py) | `yml`, `yaml` | [`PyYAML`](https://pyyaml.org/) | :heavy_check_mark: | :heavy_check_mark: |\n| [Zarr](./readwrite/handlers/zarr.py) | `zarr` | [`SpatialData`](https://spatialdata.scverse.org/en/stable/) | :heavy_check_mark: | :x: |\n| [Zip](./readwrite/handlers/zip.py) | `zip` | [Python's `zipfile`](https://docs.python.org/3/library/zipfile.html) | :heavy_check_mark: | :x: |\n",
"bugtrack_url": null,
"license": null,
"summary": "readwrite - Quickly read/write file in common formats",
"version": "0.9.0",
"project_urls": {
"Homepage": "https://github.com/crunchdao/readwrite"
},
"split_keywords": [
"package",
"development",
"template"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "acae5702e298f9f544eeea0536fdf7c84f58c4a3cbb5b5da497c5445cc3c4a05",
"md5": "0faa002faa34e6a586d4fb6fca124351",
"sha256": "2941bb206325ee53d7a588b462bee95a6aaccf9b6ba3de3982a3c4698fcb8c36"
},
"downloads": -1,
"filename": "readwrite-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0faa002faa34e6a586d4fb6fca124351",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 17090,
"upload_time": "2024-12-29T16:43:01",
"upload_time_iso_8601": "2024-12-29T16:43:01.715344Z",
"url": "https://files.pythonhosted.org/packages/ac/ae/5702e298f9f544eeea0536fdf7c84f58c4a3cbb5b5da497c5445cc3c4a05/readwrite-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77f5db95cbf1766e62d47a9a1ca9b72626a74758a3df54606e6c7e67da9a2fcb",
"md5": "a7ae9f4145ab74cfaded983f692a2a20",
"sha256": "478802375cc98137c82f12e8131f31d1be2a249e166631552c3771f3baae993c"
},
"downloads": -1,
"filename": "readwrite-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "a7ae9f4145ab74cfaded983f692a2a20",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 10874,
"upload_time": "2024-12-29T16:43:02",
"upload_time_iso_8601": "2024-12-29T16:43:02.878348Z",
"url": "https://files.pythonhosted.org/packages/77/f5/db95cbf1766e62d47a9a1ca9b72626a74758a3df54606e6c7e67da9a2fcb/readwrite-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-29 16:43:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crunchdao",
"github_project": "readwrite",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": []
},
{
"name": "pyreadline3",
"specs": []
},
{
"name": "pandas",
"specs": []
},
{
"name": "pytest",
"specs": []
},
{
"name": "pyarrow",
"specs": []
},
{
"name": "tqdm",
"specs": []
},
{
"name": "pyyaml",
"specs": []
},
{
"name": "toml",
"specs": []
},
{
"name": "openpyxl",
"specs": []
},
{
"name": "joblib",
"specs": []
}
],
"lcname": "readwrite"
}