Metadata-Version: 2.1
Name: readwrite
Version: 0.5.0
Summary: readwrite - Quickly read/write file in common formats
Home-page: https://github.com/crunchdao/readwrite
Author: Enzo CACERES
Author-email: enzo.caceres@crunchdao.com
Keywords: package development template
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3
Description-Content-Type: text/markdown
Requires-Dist: click
Requires-Dist: pyreadline3; platform_system == "Windows"
Requires-Dist: pandas
Requires-Dist: pytest
Requires-Dist: pyarrow
Requires-Dist: tqdm
Requires-Dist: pyyaml
Requires-Dist: toml
Requires-Dist: openpyxl

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) |
| [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/) |
