Metadata-Version: 2.4
Name: datacook-app
Version: 2.13.0
Summary: Qt desktop tool for pandas data analysis that records every transformation as replayable Python code
Keywords: data analysis,data science,dataframe,gui,pandas,qt,statistics
Author: Philipp Temminghoff
Author-email: Philipp Temminghoff <philipptemminghoff@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Dist: pyside6
Requires-Dist: cutepandas>=0.6.2
Requires-Dist: epregistry>=2.0.5
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: platformdirs
Requires-Dist: prettyqt>=1.65.0
Requires-Dist: psutil>=7.2.2
Requires-Dist: pyarrow>=26.0.1
Requires-Dist: pydantic
Requires-Dist: openpyxl>=3.1.5 ; extra == 'excel'
Requires-Dist: scikit-learn>=1.9 ; extra == 'sklearn'
Maintainer: Philipp Temminghoff
Maintainer-email: Philipp Temminghoff <philipptemminghoff@gmail.com>
Requires-Python: >=3.14
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/datacook
Project-URL: Documentation, https://phil65.github.io/datacook/
Project-URL: Issues, https://github.com/phil65/datacook/issues
Project-URL: Source, https://github.com/phil65/datacook
Provides-Extra: excel
Provides-Extra: sklearn
Description-Content-Type: text/markdown

# DataCook

DataCook is a desktop tool for exploring and transforming tables. Every operation you apply is
recorded as a step in a tree, so an analysis can be branched, replayed, saved as a project or
exported as a Python script (and the script can be edited and read back).

> **Status: being rebuilt** (phase 3 of the plan done: the new app). The new Qt app runs on
> a Qt-free engine (`datacook.engine`): a tree of typed operation records, frames computed
> on demand under a memory budget (pandas 3 with pyarrow dtypes), code generated from the
> records and parsed back. The op catalogue is a starter set (24 ops, basic readers and
> writers); porting the rest of the old catalogue in [`legacy/`](legacy/README.md) is next.

## The app

```bash
uv sync --all-extras
uv run datacook                       # or: uv run python -m datacook.app
uv run datacook project.datacook      # open a project
uv run datacook data.csv              # open a data file (reader dialog)
uv run python tools/demo_data.py demo # sample data + a demo project in ./demo
```

**Concept.** A project is a tree of *steps*. A root step reads a file; every other step is one
operation (filter, rename, group, merge, ...) applied to its parent(s). Adding a step to a step
that already has children creates a *branch*; a merge takes a second table as its other input.
The steps are stored as typed records (operation + parameters), not as data: tables are
computed when you look at them and kept in a cache under a memory budget, so a long tree of a
large table does not cost a copy per step. The **code** of every step is generated from its
record; the whole tree (or the path to one step) exports as a plain pandas script.

**Docks** (all follow the selected step; View menu to show / hide them):

| Dock | What |
|---|---|
| Steps (left) | the tree: name, shape, size; badges for in memory / in use / computing / error. Right-click: rename, comment, branch, delete |
| Data (center) | the table of the selected step, or the preview of the step being edited. Header click = display-only sort (a row order, no copy); "Add as sort step" turns it into a real step |
| Parameters (right) | form of the step being added or edited, with a **live preview** of the first rows; Apply commits, Cancel / Esc discards |
| Columns (right, tab) | columns of the shown table (type, missing values, size) and statistics of the selected column |
| Code (bottom) | the generated script; the selected step's lines are highlighted |
| Messages (bottom, tab) | errors of failing steps (click: go to the step), loads, exports, log |
| Status bar | memory: frame cache / budget and process RSS; click for the cached steps and "Free memory" |

**Memory model.** Only the selected step and its inputs are *pinned* (kept in memory while
shown); every other computed table stays in the LRU cache until the budget (25 % of RAM by
default) needs the room or you free it. Views never copy a table: the data view reads windows
of the cached frame, previews hold only their first rows, the column statistics are computed
on a worker. Undo / redo recompute what they need.

**Keyboard shortcuts.**

| Keys | Action |
|---|---|
| Ctrl+Shift+P | command palette: every operation by name |
| Ctrl+E | edit the selected step (parameters + preview) |
| Esc | cancel the preview |
| F2 / Del (in the tree) | rename / delete the selected step (with its subtree) |
| Ctrl+Z / Ctrl+Shift+Z | undo / redo |
| Ctrl+N / Ctrl+O / Ctrl+S / Ctrl+Shift+S | new / open / save / save as project |
| Ctrl+Shift+O | open a data file |

The UI is available in English and German (View > Language, switches at runtime).

## Engine example

```python
from datacook.engine import Session
from datacook.engine.ops import missing, rows, sources

with Session() as session:
    data = {"a": [3, None, 1], "b": [4, 5, 6]}
    src = session.add(sources.InlineData.record(data=data), name="raw")
    filled = session.add(missing.FillForward.record(), [src])
    branch = session.add(rows.SortRows.record(by=["a"]), [filled])
    other = session.add(rows.Head.record(n=2), [filled])  # a second branch

    print(session.materialize(branch.id))  # computed on demand, cached
    print(session.code())  # the script for the whole tree
    session.update(filled.id, params=missing.FillForward.Params(limit=1))
    # -> `filled`, `branch` and `other` are invalidated and recomputed on request
```

`session.import_script(text)` parses a script back into nodes (statements it does not
recognise become "custom code" steps); `datacook.engine.project` saves and loads the tree as
JSON, and `datacook.engine.formats.FormatRegistry` maps file extensions to readers and
writers.

## Development

```bash
git clone https://github.com/phil65/datacook
cd datacook
uv sync --all-extras    # Python 3.14
uv run pytest
uv run ruff check . && uv run ty check
```

`uv run pytest` runs the app tests offscreen (`QT_QPA_PLATFORM=offscreen`), including a smoke
test of the whole window (`tests/app/test_smoke.py`). See [AGENTS.md](AGENTS.md) for the
layout and the rebuild status, [`src/datacook/app/README.md`](src/datacook/app/README.md) for
the app's internals. [`docs/feature-inventory.md`](docs/feature-inventory.md) lists every
feature of the old app (git tag `pre-rework`) and where it went in the rework.
