Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Changelog

All notable changes to this project are listed here. Versions follow [Semantic Versioning](https://semver.org/); until 1.0.0, minor versions may change CLI behaviour.

## [0.8.0] - 2026-10-14

### Added

- `-t, --to json|yaml|csv|ndjson` on every shaping command (`select`, `pick`, `omit`, `rename`, `flatten`, `unflatten`, `filter`, `sort`, `unique`, `head`, `tail`, `group-by`, `count`, `stats`, `join`), so results can be written as YAML, CSV, or NDJSON without a second `to-*` step.
- This changelog.

### Changed

- When `--to` is not given, shaping commands pick the output format from the `--output` file extension (for example `-o out.csv` writes CSV). Before, they always wrote JSON whatever the file name. Unknown extensions and stdout still get JSON.
- Writing a non-list result as CSV now fails with a message that points to `--to json` or `--to yaml`.

## [0.7.0] - 2026-10-12

### Added

- `join KEY --with RIGHT_FILE [file]` with `--how inner|left` and `--right-from` to join two arrays of objects on a top-level key.

## [0.6.0] - 2026-10-10

### Added

- `stats FIELD` for count / sum / min / max / avg of a numeric field, on a list or on `group-by` output.

## [0.5.0] - 2026-09-30

### Added

- `group-by KEY`, `count [KEY]`, and `unflatten` (with `--sep`).

## [0.4.0] - 2026-09-28

### Added

- `rename OLD NEW ...`, `flatten` (with `--sep`), `head N`, and `tail N`.

## [0.3.0] - 2026-09-24

### Added

- `filter KEY OP VALUE`, `sort KEY` (with `--desc`), and `unique [KEY]`.

## [0.2.0] - 2026-09-21

### Added

- NDJSON / JSON Lines input and output (`to-ndjson`, `.ndjson` / `.jsonl` detection).
- `select`, `pick`, and `omit`.

## [0.1.0] - 2026-09-11

### Added

- Python implementation of the CLI: `to-json`, `to-yaml`, `to-csv`, `pretty`, and `minify` with format detection for JSON, YAML, and CSV.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,45 @@ After install, the `data-transform` console script is on your `PATH`.
- `[file]` — input path; omit or use `-` for stdin
- `-o, --output <file>` — write to a file instead of stdout
- `-f, --from <format>` — force input format: `json` | `yaml` | `csv` | `ndjson`
- `--minify` — compact JSON output (`to-json`, `select`, `pick`, `omit`, `rename`, `flatten`, `unflatten`, `filter`, `sort`, `unique`, `head`, `tail`, `group-by`, `count`, `stats`, `join`)
- `-t, --to <format>` — output format for the shaping commands (everything except `to-*`, `pretty`, and `minify`): `json` | `yaml` | `csv` | `ndjson`. Defaults to the `--output` file extension, else JSON. See [Output formats](#output-formats)
- `--minify` — compact JSON output (`to-json` and the shaping commands); ignored when the output format is not JSON
- `--desc` — reverse sort order (`sort` only)
- `--sep <text>` — separator between nested keys (`flatten` and `unflatten`, default `.`)
- `-w, --with <file>`, `--how inner|left`, `--right-from <format>` — right-hand file, join type, and right file format (`join` only)

Format is taken from `--from`, else the file extension (`.ndjson` / `.jsonl` → ndjson), else simple content heuristics.

### Output formats

Shaping commands (`select`, `pick`, `omit`, `rename`, `flatten`, `unflatten`, `filter`, `sort`, `unique`, `head`, `tail`, `group-by`, `count`, `stats`, `join`) print JSON by default. Use `-t` / `--to` to write YAML, CSV, or NDJSON directly instead of piping into a `to-*` command.

- The format comes from `--to`, else the `--output` file extension (`.json`, `.yaml` / `.yml`, `.csv`, `.ndjson` / `.jsonl`), else JSON. `--to` always wins, and an unknown extension stays JSON.
- JSON is pretty-printed unless `--minify` is set. `--minify` does nothing for YAML, CSV, or NDJSON (NDJSON is always one compact value per line).
- CSV needs a list result. A number, object, or `group-by` result is an error (exit code 1) that suggests `--to json` or `--to yaml` instead.
- YAML output keeps key order and keeps YAML-only values such as dates, which JSON can't represent.

```bash
# Filter a CSV and write CSV back out
data-transform filter age ge 30 people.csv -t csv
# → name,age
# Ada,36

# Format picked from the output file name (events.json is an array of objects)
data-transform flatten events.json -o events-flat.csv
data-transform pick id name users.json -o users.yaml

# Unknown extension: name the format with --to
data-transform sort id users.json -t ndjson -o users.out

# Per-team counts as YAML
data-transform count team people.json -t yaml
# → core: 1
# web: 1

# Join JSON against CSV and emit CSV
data-transform join id --with teams.csv users.json -t csv -o report.csv
```

## Usage examples

```bash
Expand Down Expand Up @@ -331,6 +363,10 @@ NDJSON (also known as JSON Lines / `.jsonl`) is one JSON value per non-empty lin

CSV support is intentionally small and robust (RFC 4180-ish) via the Python standard library `csv` module: quoted fields, escaped quotes (`""`), and newlines inside quotes. Object arrays use a header row; all cell values are strings when parsed from CSV.

## Changelog

See [CHANGELOG.md](./CHANGELOG.md).

## Development

```bash
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "data-transform-cli"
version = "0.7.0"
version = "0.8.0"
description = "CLI for YAML ↔ JSON ↔ CSV ↔ NDJSON transforms for pipelines and shell use"
readme = "README.md"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion src/data_transform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
"join_rows",
]

__version__ = "0.7.0"
__version__ = "0.8.0"
Loading
Loading