From 4ed8c12d0836879fd609dbab7f30f2f6558af3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csonk=C3=A1s=20Krist=C3=B3f=20Gyula?= Date: Fri, 26 Feb 2021 19:06:47 +0100 Subject: [PATCH] Reduce the count of locations where the version number must be updated to exactly one. See also https://github.com/python-poetry/poetry/pull/2366#issuecomment-652418094 for recommended practice --- poetry.lock | 19 +++++++++---------- pyproject.toml | 1 + sphinx_thrift/__init__.py | 8 +++++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index ffe2806..c17bdea 100644 --- a/poetry.lock +++ b/poetry.lock @@ -89,19 +89,18 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "importlib-metadata" -version = "3.7.0" +version = "1.7.0" description = "Read metadata from Python packages" -category = "dev" +category = "main" optional = false -python-versions = ">=3.6" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +docs = ["sphinx", "rst.linker"] +testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] [[package]] name = "isort" @@ -446,7 +445,7 @@ python-versions = "*" name = "zipp" version = "3.4.0" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -457,7 +456,7 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "0e18204cbcc9efba0dfc06ffff9dfda62142a8f314b78c7bd4e822f7a0ae98d3" +content-hash = "d261932ec53b78e23866c9eab00956c6b91f77953d8ef0a817238665b6bc108b" [metadata.files] alabaster = [ @@ -501,8 +500,8 @@ imagesize = [ {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, ] importlib-metadata = [ - {file = "importlib_metadata-3.7.0-py3-none-any.whl", hash = "sha256:c6af5dbf1126cd959c4a8d8efd61d4d3c83bddb0459a17e554284a077574b614"}, - {file = "importlib_metadata-3.7.0.tar.gz", hash = "sha256:24499ffde1b80be08284100393955842be4a59c7c16bbf2738aad0e464a8e0aa"}, + {file = "importlib_metadata-1.7.0-py2.py3-none-any.whl", hash = "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"}, + {file = "importlib_metadata-1.7.0.tar.gz", hash = "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83"}, ] isort = [ {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"}, diff --git a/pyproject.toml b/pyproject.toml index 8ed3c8a..0266050 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ authors = ["Csonkás Kristóf Gyula "] [tool.poetry.dependencies] python = "^3.7" sphinx = "^3.5.1" +importlib-metadata = { version = "^1.0", python = "<3.8" } [tool.poetry.dev-dependencies] pytest = "^3.0" diff --git a/sphinx_thrift/__init__.py b/sphinx_thrift/__init__.py index 96bcf1f..152ece1 100644 --- a/sphinx_thrift/__init__.py +++ b/sphinx_thrift/__init__.py @@ -1,8 +1,14 @@ +import sys from typing import Any, Dict from sphinx.application import Sphinx -__version__ = '0.1.0' +if sys.version_info >= (3, 8): + from importlib import metadata as importlib_metadata +else: + import importlib_metadata + +__version__ = importlib_metadata.version(__name__) def setup(app: Sphinx) -> Dict[str, Any]: