From 45032157dd4c78647509b6e008be88b58f3c684d Mon Sep 17 00:00:00 2001 From: kompotkot Date: Wed, 24 Nov 2021 09:42:59 +0000 Subject: [PATCH] Version file for client and isort --- backend/.isort.cfg | 3 +++ clients/python/.isort.cfg | 3 +++ clients/python/moonstream/client.py | 10 ++++------ clients/python/moonstream/version.py | 1 + clients/python/setup.py | 5 ++++- 5 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 backend/.isort.cfg create mode 100644 clients/python/.isort.cfg create mode 100644 clients/python/moonstream/version.py diff --git a/backend/.isort.cfg b/backend/.isort.cfg new file mode 100644 index 00000000..81d54de1 --- /dev/null +++ b/backend/.isort.cfg @@ -0,0 +1,3 @@ +[settings] +profile = black +multi_line_output = 3 \ No newline at end of file diff --git a/clients/python/.isort.cfg b/clients/python/.isort.cfg new file mode 100644 index 00000000..81d54de1 --- /dev/null +++ b/clients/python/.isort.cfg @@ -0,0 +1,3 @@ +[settings] +profile = black +multi_line_output = 3 \ No newline at end of file diff --git a/clients/python/moonstream/client.py b/clients/python/moonstream/client.py index b2d0211f..341f228d 100644 --- a/clients/python/moonstream/client.py +++ b/clients/python/moonstream/client.py @@ -1,20 +1,18 @@ -from dataclasses import dataclass, field import logging import os +from dataclasses import dataclass, field from typing import Any, Dict, List, Optional import requests +from .version import MOONSTREAM_CLIENT_VERSION + logger = logging.getLogger(__name__) log_level = logging.INFO if os.environ.get("DEBUG", "").lower() in ["true", "1"]: log_level = logging.DEBUG logger.setLevel(log_level) - -# Keep this synchronized with the version in setup.py -CLIENT_VERSION = "0.0.2" - ENDPOINT_PING = "/ping" ENDPOINT_VERSION = "/version" ENDPOINT_NOW = "/now" @@ -100,7 +98,7 @@ class Moonstream: self.timeout = timeout self._session = requests.Session() self._session.headers.update( - {"User-Agent": f"Moonstream Python client (version {CLIENT_VERSION})"} + {"User-Agent": f"Moonstream Python client (version {MOONSTREAM_CLIENT_VERSION})"} ) def ping(self) -> Dict[str, Any]: diff --git a/clients/python/moonstream/version.py b/clients/python/moonstream/version.py new file mode 100644 index 00000000..bb2f8c6d --- /dev/null +++ b/clients/python/moonstream/version.py @@ -0,0 +1 @@ +MOONSTREAM_CLIENT_VERSION = "0.0.3" \ No newline at end of file diff --git a/clients/python/setup.py b/clients/python/setup.py index b12b4518..f75e6813 100644 --- a/clients/python/setup.py +++ b/clients/python/setup.py @@ -1,12 +1,14 @@ from setuptools import find_packages, setup +from moonstream.version import MOONSTREAM_CLIENT_VERSION + long_description = "" with open("README.md") as ifp: long_description = ifp.read() setup( name="moonstream", - version="0.0.2", + version=MOONSTREAM_CLIENT_VERSION, packages=find_packages(), package_data={"moonstream": ["py.typed"]}, install_requires=["requests", "dataclasses; python_version=='3.6'"], @@ -14,6 +16,7 @@ setup( "dev": [ "black", "mypy", + "isort", "wheel", "types-requests", "types-dataclasses",