From 6bb0bffc2829d706b78c50783e5407a6fc1480df Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 6 Mar 2024 09:31:57 +0100 Subject: [PATCH 1/2] Drop pint higher-bound Signed-off-by: Cristian Le --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d28627af6e..a8f45c4f0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: - "docutils>=0.16" # 0.16 is the current one available for RHEL9 - "fmf>=1.3.0" - "jinja2>=2.11.3" # 3.1.2 / 3.1.2 - - "pint>=0.16.1,<0.20" # 0.16.1 / 0.19.x TODO: Pint 0.20 requires larger changes to tmt.hardware + - "pint>=0.16.1" # 0.16.1 - "pygments>=2.7.4" # 2.7.4 is the current one available for RHEL9 - "requests>=2.25.1" # 2.28.2 / 2.31.0 - "ruamel.yaml>=0.16.6" # 0.17.32 / 0.17.32 @@ -81,7 +81,7 @@ repos: - "docutils>=0.16" # 0.16 is the current one available for RHEL9 - "fmf>=1.3.0" - "jinja2>=2.11.3" # 3.1.2 / 3.1.2 - - "pint>=0.16.1,<0.20" # 0.16.1 / 0.19.x TODO: Pint 0.20 requires larger changes to tmt.hardware + - "pint>=0.16.1" # 0.16.1 / 0.19.x TODO: Pint 0.20 requires larger changes to tmt.hardware - "pygments>=2.7.4" # 2.7.4 is the current one available for RHEL9 - "requests>=2.25.1" # 2.28.2 / 2.31.0 - "ruamel.yaml>=0.16.6" # 0.17.32 / 0.17.32 diff --git a/pyproject.toml b/pyproject.toml index 9c6587aa1e..4fe58e62ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ # F39 / PyPI "docutils>=0.16", # 0.16 is the current one available for RHEL9 "fmf>=1.3.0", "jinja2>=2.11.3", # 3.1.2 / 3.1.2 - "pint>=0.16.1,<0.20", # 0.16.1 / 0.19.x TODO: Pint 0.20 requires larger changes to tmt.hardware + "pint>=0.16.1", # 0.16.1 "pygments>=2.7.4", # 2.7.4 is the current one available for RHEL9 "requests>=2.25.1", # 2.28.2 / 2.31.0 "ruamel.yaml>=0.16.6", # 0.17.32 / 0.17.32 From 0704b23d9263629f9f0271df56ae8cad462533fb Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 6 Mar 2024 11:39:45 +0100 Subject: [PATCH 2/2] Drop pint type-hinting until it is properly supported Signed-off-by: Cristian Le --- pyproject.toml | 3 ++- tmt/hardware.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4fe58e62ab..f815aafcef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -249,7 +249,8 @@ ignore = [ "tmt/convert.py", "tmt/lint.py", "tmt/queue.py", - "tmt/utils.py" + "tmt/utils.py", + "tmt/hardware.py", # pyright does not pick up pint's _typing.py or something :/ ] pythonVersion = "3.9" diff --git a/tmt/hardware.py b/tmt/hardware.py index fa8bb0fa34..916fe73062 100644 --- a/tmt/hardware.py +++ b/tmt/hardware.py @@ -64,7 +64,9 @@ from typing_extensions import TypeAlias #: A type of values describing sizes of things like storage or RAM. - Size: TypeAlias = 'Quantity[int]' + # Note: type-hinting is a bit wonky with pyright + # https://github.com/hgrecco/pint/issues/1166 + Size: TypeAlias = Quantity #: Unit registry, used and shared by all code. UNITS = pint.UnitRegistry()