Quickly read and write file based on their extension.
[](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: |
| [H5ad](./readwrite/handlers/h5ad.py) | `h5ad` | [`scanpy`](https://scanpy.readthedocs.io/en/stable/) | :heavy_check_mark: | :x: |
| [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/de/10/d2d73790c094f0ce81ecaed4522363ddf6dd759d4e3c69a205e4b96792a7/readwrite-0.10.1.tar.gz",
"platform": null,
"description": "Quickly read and write file based on their extension.\n\n[](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| [H5ad](./readwrite/handlers/h5ad.py) | `h5ad` | [`scanpy`](https://scanpy.readthedocs.io/en/stable/) | :heavy_check_mark: | :x: |\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.10.1",
"project_urls": {
"Homepage": "https://github.com/crunchdao/readwrite"
},
"split_keywords": [
"package",
"development",
"template"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "19923d99d2d518c0b97aca704baebb973827d4e5cb88fc448652b8e16ddb7e6e",
"md5": "1e3ae18fdc753d080590eec59b876c61",
"sha256": "322ff8be9a2bd75b331b512df5cb63e9853aeebf7541f3360d44053bd38ae4e3"
},
"downloads": -1,
"filename": "readwrite-0.10.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e3ae18fdc753d080590eec59b876c61",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 17546,
"upload_time": "2025-02-08T22:24:38",
"upload_time_iso_8601": "2025-02-08T22:24:38.809377Z",
"url": "https://files.pythonhosted.org/packages/19/92/3d99d2d518c0b97aca704baebb973827d4e5cb88fc448652b8e16ddb7e6e/readwrite-0.10.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "de10d2d73790c094f0ce81ecaed4522363ddf6dd759d4e3c69a205e4b96792a7",
"md5": "2f01948b1adc8bd2b264d07618feb39d",
"sha256": "1c5963de3dd27055db3bcd5b391843dc39065b80775fc186922fa4167e5ceed7"
},
"downloads": -1,
"filename": "readwrite-0.10.1.tar.gz",
"has_sig": false,
"md5_digest": "2f01948b1adc8bd2b264d07618feb39d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 11164,
"upload_time": "2025-02-08T22:24:39",
"upload_time_iso_8601": "2025-02-08T22:24:39.856623Z",
"url": "https://files.pythonhosted.org/packages/de/10/d2d73790c094f0ce81ecaed4522363ddf6dd759d4e3c69a205e4b96792a7/readwrite-0.10.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-08 22:24:39",
"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"
}