feat: Updates to make Haystack compatible with python 3.14 by sjrl · Pull Request #10634 · deepset-ai/haystack · GitHub
Skip to content

feat: Updates to make Haystack compatible with python 3.14 - #10634

Merged
sjrl merged 15 commits into
mainfrom
python314-support
Mar 16, 2026
Merged

sjrl merged 15 commits into
mainfrom
python314-support

Conversation

@sjrl

@sjrl sjrl commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

Collect tests that should be skipped when using python 3.14+. These tests should eventually be removed when the min version of python becomes 3.14.

Made some minor adjustments to type checking when handling bare Union types. Previously we were relying on get_origin(typing.Union) to return None. Starting in python 3.14 get_origin(typing.Union) now returns typing.Union so I added specific checks for handling bare Union types.

How did you test it?

  • Ran unit tests locally using python 3.14
  • Also bumped our tests to use python 3.14 in this commit 349b505 (made sure to revert back to 3.10)

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@vercel

vercel Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

@sjrl sjrl changed the title Updating tests to pass with python 3.14 feat: Updates to make Haystack compatible with python 3.14 Mar 11, 2026
@sjrl
sjrl marked this pull request as ready for review March 13, 2026 12:35
@sjrl
sjrl requested a review from a team as a code owner March 13, 2026 12:35
@sjrl
sjrl requested review from davidsbatista and removed request for a team March 13, 2026 12:35
@coveralls

coveralls commented Mar 13, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 23136127991

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 92.885%

Files with Coverage Reduction New Missed Lines %
core/type_utils.py 3 96.69%
Totals Coverage Status
Change from base Build 23134893410: -0.004%
Covered Lines: 15770
Relevant Lines: 16978

💛 - Coveralls

@julian-risch

Copy link
Copy Markdown
Member

@sjrl Out of curiosity I tried Haystack with Python 3.14 and found two additional issues to address:

  • asyncio.get_event_loop() usage in InMemoryDocumentStore
  • test/components/extractors/test_named_entity_extractor.py‎ and e2e/pipelines/test_named_entity_extractor.py‎
    fail due to spacy incompatibility with Python 3.14
    I'd suggest you integrate the following changes or similar into your PR https://github.com/deepset-ai/haystack/pull/10826/changes

@sjrl

sjrl commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor Author

@sjrl Out of curiosity I tried Haystack with Python 3.14 and found two additional issues to address:

  • asyncio.get_event_loop() usage in InMemoryDocumentStore
  • test/components/extractors/test_named_entity_extractor.py‎ and e2e/pipelines/test_named_entity_extractor.py‎
    fail due to spacy incompatibility with Python 3.14
    I'd suggest you integrate the following changes or similar into your PR https://github.com/deepset-ai/haystack/pull/10826/changes

Hey @julian-risch any idea how these errors popped up for you? I ran all unit and integration tests using our CI with python 3.14.3 and they passed except for the two I mentioned in our e2e tests. So just curious how you identified the additional issues.

@sjrl

sjrl commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

@julian-risch made the changes! Would appreciate another review when you have the time.



@pytest.mark.parametrize("batch_size", [1, 3])
@skip_spacy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julian-risch I was able to update your code to only skip the spacy test. Also required a change in the pyproject.toml in the e2e test env

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sjrl
sjrl enabled auto-merge (squash) March 16, 2026 09:12
@sjrl
sjrl merged commit b970a64 into main Mar 16, 2026
24 checks passed
@sjrl
sjrl deleted the python314-support branch March 16, 2026 09:22
@julian-risch

Copy link
Copy Markdown
Member

@julian-risch julian-risch mentioned this pull request Mar 16, 2026
alvinttang pushed a commit to alvinttang/haystack that referenced this pull request Mar 18, 2026
…i#10634)

* start adding python 3.14 support in tests

* start updating tests

* Add reno

* Updates

* Collect tests that should be skipped in python 3.14+

* run tests using python 3.14

* Revert back to 3.10 for testing

* Fix flaky tests

* Skip only spacy tests if python 3.14+

* switch to get_running_loop
julian-risch added a commit that referenced this pull request Oct 10, 2026
Pipeline.run_async writes each sync component's outputs when its thread finishes, so variadic
inputs arrive in completion order. Six scenarios assumed the sync order; CI on Python 3.15 hit
three of them on every run. Follows the AnyOrder approach of the Python 3.14 PR (#10634).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Haystack (potentially) incompatible with Python 3.14

4 participants