From 1c76aa07bb09e585fa3335e8cad3b85d73c562cb Mon Sep 17 00:00:00 2001 From: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:11:08 +0100 Subject: [PATCH] Fix __version__ handling (#6765) --- haystack/version.py | 9 +-------- releasenotes/notes/fix-version-47afaec913788a01.yaml | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/fix-version-47afaec913788a01.yaml diff --git a/haystack/version.py b/haystack/version.py index 5d9e899fa..68b18404f 100644 --- a/haystack/version.py +++ b/haystack/version.py @@ -1,13 +1,6 @@ from importlib import metadata -# haystack is distributed as a separate package called `haystack-ai`. -# We want to keep all preview dependencies separate from the current Haystack version, -# so imports in haystack must only import from haystack. -# Since we need to access __version__ in haystack without importing from -# haystack we must set it here too. -# When installing `haystack-ai` we want to use that package version though -# as `farm-haystack` might not be installed and cause this to fail. try: __version__ = str(metadata.version("haystack-ai")) except metadata.PackageNotFoundError: - __version__ = str(metadata.version("farm-haystack")) + __version__ = "main" diff --git a/releasenotes/notes/fix-version-47afaec913788a01.yaml b/releasenotes/notes/fix-version-47afaec913788a01.yaml new file mode 100644 index 000000000..9e657c7a5 --- /dev/null +++ b/releasenotes/notes/fix-version-47afaec913788a01.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fix Haystack imports failing when using local development environment that doesn't have `haystack-ai` installed.