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 |
| --- | --- | --- |
| [Binary](./readwrite/handlers/binary.py) | `bin` | [Python's `bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) |
| [Csv](./readwrite/handlers/csv.py) | `csv` | [`pandas`](https://pandas.pydata.org/) |
| [Excel](./readwrite/handlers/excel.py) | `xlsx` | [`pandas`](https://pandas.pydata.org/) |
| [Json](./readwrite/handlers/json.py) | `json` | [Python's `json`](https://docs.python.org/3/library/json.html) |
| [Parquet](./readwrite/handlers/parquet.py) | `parquet` | [`pandas`](https://pandas.pydata.org/) |
| [Pickle](./readwrite/handlers/pickle.py) | `pkl`, `pickle` | [Python's `pickle`](https://docs.python.org/3/library/pickle.html) or [`pandas`](https://pandas.pydata.org/) |
| [Toml](./readwrite/handlers/toml.py) | `toml` | [`toml`](https://pypi.org/project/toml/) |
| [Text](./readwrite/handlers/text.py) | `txt` | [Python's `str`](https://docs.python.org/3/library/stdtypes.html#str) |
| [Yaml](./readwrite/handlers/yaml.py) | `yml`, `yaml` | [`PyYAML`](https://pyyaml.org/) |
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/e2/f7/38432aef708b68880be93f3bac66a19675390b593ad8d15609fc0a0c34fd/readwrite-0.7.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 |\n| --- | --- | --- |\n| [Binary](./readwrite/handlers/binary.py) | `bin` | [Python's `bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) |\n| [Csv](./readwrite/handlers/csv.py) | `csv` | [`pandas`](https://pandas.pydata.org/) |\n| [Excel](./readwrite/handlers/excel.py) | `xlsx` | [`pandas`](https://pandas.pydata.org/) |\n| [Json](./readwrite/handlers/json.py) | `json` | [Python's `json`](https://docs.python.org/3/library/json.html) |\n| [Parquet](./readwrite/handlers/parquet.py) | `parquet` | [`pandas`](https://pandas.pydata.org/) |\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/) |\n| [Toml](./readwrite/handlers/toml.py) | `toml` | [`toml`](https://pypi.org/project/toml/) |\n| [Text](./readwrite/handlers/text.py) | `txt` | [Python's `str`](https://docs.python.org/3/library/stdtypes.html#str) |\n| [Yaml](./readwrite/handlers/yaml.py) | `yml`, `yaml` | [`PyYAML`](https://pyyaml.org/) |\n",
"bugtrack_url": null,
"license": null,
"summary": "readwrite - Quickly read/write file in common formats",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://github.com/crunchdao/readwrite"
},
"split_keywords": [
"package",
"development",
"template"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "105a86d7e0ebf3048dc7a6e6c90b7bf844985bdbc0efb963107089e192456ab7",
"md5": "e23574eb18c06010ed5ce9923a4010af",
"sha256": "95bb89591b44a20aa00ee44b3996c113c43ce168a854b3f2195dfd7570c93da6"
},
"downloads": -1,
"filename": "readwrite-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e23574eb18c06010ed5ce9923a4010af",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 15190,
"upload_time": "2024-04-12T12:46:19",
"upload_time_iso_8601": "2024-04-12T12:46:19.767663Z",
"url": "https://files.pythonhosted.org/packages/10/5a/86d7e0ebf3048dc7a6e6c90b7bf844985bdbc0efb963107089e192456ab7/readwrite-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e2f738432aef708b68880be93f3bac66a19675390b593ad8d15609fc0a0c34fd",
"md5": "1ce1ff36d005c5048335c0bf2eb04411",
"sha256": "eb41b3165c4f91998838c06677e29d5b2d4053c534c9f40cc2b14de6c1f8c6a0"
},
"downloads": -1,
"filename": "readwrite-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "1ce1ff36d005c5048335c0bf2eb04411",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 9795,
"upload_time": "2024-04-12T12:46:21",
"upload_time_iso_8601": "2024-04-12T12:46:21.837808Z",
"url": "https://files.pythonhosted.org/packages/e2/f7/38432aef708b68880be93f3bac66a19675390b593ad8d15609fc0a0c34fd/readwrite-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 12:46:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crunchdao",
"github_project": "readwrite",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "readwrite"
}