From d312b9b287353c60f8a9f0377c6f95e564c898c9 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Wed, 3 Jul 2024 10:25:29 +0300 Subject: [PATCH 1/4] pyproject: hack around to make editable install work --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a1d6599..4bfda4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,10 @@ include = [ "modepy*", ] +[tool.setuptools.package-dir] +# https://github.com/Infleqtion/client-superstaq/pull/715 +"" = "." + [tool.setuptools.package-data] modepy = [ "py.typed", From 42d2ccf3d18b23bf577b13ce308f8797f4830b28 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Wed, 3 Jul 2024 11:18:20 +0300 Subject: [PATCH 2/4] pyproject: remove ruff version and line-length --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4bfda4e..5d1e574 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,9 +74,8 @@ modepy = [ [tool.ruff] target-version = "py38" -line-length = 85 - preview = true + [tool.ruff.lint] extend-select = [ "B", # flake8-bugbear From f31b4ee910b2e6a533726158522132bea114b828 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 3 Jul 2024 11:04:45 -0500 Subject: [PATCH 3/4] pyproject: drop redundant select/ignore for pydocstyle in ruff --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5d1e574..f699933 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,6 @@ preview = true extend-select = [ "B", # flake8-bugbear "C", # flake8-comprehensions - "D", # pydocstyle "E", # pycodestyle "F", # pyflakes "I", # flake8-isort @@ -91,7 +90,6 @@ extend-select = [ ] extend-ignore = [ "C90", # McCabe complexity - "D", # pydocstyle "E221", # multiple spaces before operator "E226", # missing whitespace around arithmetic operator "E241", # multiple spaces after comma From b0253a6423f025f310ecadae4b2ca748c43dc740 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 3 Jul 2024 11:05:07 -0500 Subject: [PATCH 4/4] Version-reading: get from importlib --- modepy/version.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modepy/version.py b/modepy/version.py index 006c4a5..e7d6757 100644 --- a/modepy/version.py +++ b/modepy/version.py @@ -1,2 +1,9 @@ -VERSION = (2024, 1) -VERSION_TEXT = ".".join(str(i) for i in VERSION) +import re +from importlib import metadata + + +VERSION_TEXT = metadata.version("modepy") +_match = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT) +assert _match is not None +VERSION_STATUS = _match.group(2) +VERSION = tuple(int(nr) for nr in _match.group(1).split("."))