Skip to content

Commit

Permalink
single source for "version"
Browse files Browse the repository at this point in the history
  • Loading branch information
theorm committed Oct 11, 2024
1 parent 763bebe commit 15225ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions impresso/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from impresso.client import connect # noqa
from impresso.client import connect, version # noqa
from impresso.api_models import * # noqa
from impresso.structures import ( # noqa
TermSet,
Expand All @@ -11,4 +11,4 @@
Partial,
)

__version__ = "0.9.0"
__version__ = version
5 changes: 4 additions & 1 deletion impresso/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Impresso Python client library."""

import getpass
import importlib.metadata
import logging
import os
from urllib.parse import urlparse
Expand All @@ -14,6 +15,8 @@

logger = logging.getLogger(__name__)

version = importlib.metadata.version("impresso")


def _is_localhost_netloc(netloc: str) -> bool:
return netloc.startswith("localhost") or netloc.startswith("127.0.0.1")
Expand Down Expand Up @@ -45,7 +48,7 @@ def __init__(self, api_url: str, api_bearer_token: str):
token=self._api_bearer_token,
headers={
"Accept": "application/json",
"User-Agent": "impresso-py/0.1.0",
"User-Agent": f"impresso-py/${version}",
},
raise_on_unexpected_status=True,
httpx_args={
Expand Down

0 comments on commit 15225ab

Please sign in to comment.