Skip to content

Commit 33fac07

Browse files
authored
Merge pull request #485 from sanders41/version
Fix error when reading version outside of development
2 parents 87cac81 + 3642b3c commit 33fac07

File tree

5 files changed

+8
-24
lines changed

5 files changed

+8
-24
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from meilisearch_python_async._version import get_version
1+
from meilisearch_python_async._version import VERSION
22
from meilisearch_python_async.client import Client
33

4-
__version__ = get_version()
4+
__version__ = VERSION
55

66

77
__all__ = ["Client"]

meilisearch_python_async/_http_requests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Response,
1313
)
1414

15-
from meilisearch_python_async._version import get_version
15+
from meilisearch_python_async._version import VERSION
1616
from meilisearch_python_async.errors import (
1717
MeilisearchApiError,
1818
MeilisearchCommunicationError,
@@ -78,4 +78,4 @@ async def delete(self, path: str, body: dict | None = None) -> Response:
7878

7979
@lru_cache(maxsize=1)
8080
def user_agent() -> str:
81-
return f"Meilisearch Python Async (v{get_version()})"
81+
return f"Meilisearch Python Async (v{VERSION})"
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1 @@
1-
from __future__ import annotations
2-
3-
from functools import lru_cache
4-
from pathlib import Path
5-
6-
try:
7-
import tomli as tomllib # type: ignore
8-
except ModuleNotFoundError:
9-
import tomllib # type: ignore
10-
11-
12-
@lru_cache(maxsize=1)
13-
def get_version() -> str:
14-
pyproject = Path().absolute() / "pyproject.toml"
15-
with open(pyproject, "rb") as f:
16-
data = tomllib.load(f)
17-
return data["tool"]["poetry"]["version"]
1+
VERSION = "1.2.2"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "meilisearch-python-async"
3-
version = "1.2.1"
3+
version = "1.2.2"
44
description = "A Python async client for the Meilisearch API"
55
authors = ["Paul Sanders <[email protected]>"]
66
license = "MIT"

tests/test_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from meilisearch_python_async import __version__
44
from meilisearch_python_async._http_requests import user_agent
5-
from meilisearch_python_async._version import get_version
5+
from meilisearch_python_async._version import VERSION
66

77
try:
88
import tomli as tomllib # type: ignore
@@ -16,7 +16,7 @@ def test_versions_match():
1616
data = tomllib.load(f)
1717
pyproject_version = data["tool"]["poetry"]["version"]
1818

19-
assert get_version() == pyproject_version
19+
assert VERSION == pyproject_version
2020

2121

2222
def test_user_agent():

0 commit comments

Comments
 (0)