|
| 1 | +# Migration Guide |
| 2 | + |
| 3 | +This document is meant to provide a guide for migrating from Haystack v2.X to v3.0. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## How to Document a Breaking Change |
| 8 | + |
| 9 | +When you merge a breaking change into the v3 branch, add an entry to this file under the appropriate section below. |
| 10 | +Follow this structure: |
| 11 | + |
| 12 | +### Entry template |
| 13 | + |
| 14 | +```markdown |
| 15 | +### <Short title describing what changed> |
| 16 | + |
| 17 | +**What changed:** One or two sentences describing the change — what was removed, renamed, or altered. |
| 18 | + |
| 19 | +**Why:** Brief motivation (e.g. simplification, API consistency, dependency reduction). |
| 20 | + |
| 21 | +**How to migrate:** |
| 22 | + |
| 23 | +Before (v2.x): |
| 24 | +\`\`\`python |
| 25 | +# example using the old API |
| 26 | +from haystack.components.foo import OldComponent |
| 27 | +component = OldComponent(old_param="value") |
| 28 | +\`\`\` |
| 29 | + |
| 30 | +After (v3.0): |
| 31 | +\`\`\`python |
| 32 | +# example using the new API |
| 33 | +from haystack.components.foo import NewComponent |
| 34 | +component = NewComponent(new_param="value") |
| 35 | +\`\`\` |
| 36 | +``` |
| 37 | + |
| 38 | +### Tips |
| 39 | + |
| 40 | +- **One entry per breaking change.** Don't bundle unrelated changes into a single entry. |
| 41 | +- **Include a working code example** for every rename, removal, or signature change. |
| 42 | +- **Link to the PR** when extra context would help (e.g. `See [#1234](https://github.com/deepset-ai/haystack/pull/1234)`). |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Breaking Changes |
| 47 | + |
| 48 | +<!-- Add entries here as v3 development progresses. Example below shows the expected format. --> |
| 49 | + |
| 50 | +### Example entry: `Document.dataframe` field removed |
| 51 | + |
| 52 | +**What changed:** The `dataframe` field on `Document` and the `ExtractedTableAnswer` dataclass have been removed. `pandas` is no longer a required dependency. |
| 53 | + |
| 54 | +**Why:** Reduces the default installation footprint. Components that need `pandas` will raise an informative error prompting the user to install it explicitly. |
| 55 | + |
| 56 | +**How to migrate:** |
| 57 | + |
| 58 | +Before (v2.x): |
| 59 | +```python |
| 60 | +from haystack.dataclasses import Document |
| 61 | +import pandas as pd |
| 62 | + |
| 63 | +doc = Document(content=pd.DataFrame({"col": [1, 2, 3]})) |
| 64 | +``` |
| 65 | + |
| 66 | +After (v3.0): |
| 67 | +```python |
| 68 | +# Store tabular data as plain content or create a custom component that returns pandas DataFrames as needed. |
| 69 | +from haystack.dataclasses import Document |
| 70 | + |
| 71 | +doc = Document(content="col\n1\n2\n3") |
| 72 | +``` |
0 commit comments