Linter check UP045 [0] was recently stabilized in ruff 0.12 [1]. UP045 suggests using the `X | Y` syntax for files that perform: from __future__ import annotations This import drives the Python interpreter to store type annotations as strings and defers their evaluation [2] making the new syntax "safe". See also [3] for a brief history. For now, disable the UP045 linter warnings like we do UP007 [4] for the sake of consistency within the bindings so there is no mixed usage of `Union[X, Y]` and `Optional[X]` vs `X | Y` until the bindings minimally target Python 3.10 and can move to the latter syntax. [0]: https://docs.astral.sh/ruff/rules/non-pep604-annotation-optional/ [1]: https://github.com/astral-sh/ruff/commit/de4fc5b171d8b4a9dfd44ef9b551f1257661ab60 [2]: https://peps.python.org/pep-0563/#implementation [3]: https://peps.python.org/pep-0649/#a-history-of-annotations [4]: https://docs.astral.sh/ruff/rules/non-pep604-annotation-union/ Signed-off-by: Vincent Fazio <vfazio@xxxxxxxxx> --- bindings/python/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index f0f8c29..3217412 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -73,6 +73,7 @@ ignore=[ "E501", # Ignore new Union (|) syntax until we require 3.10+ "UP007", + "UP045", ] [tool.ruff.lint.per-file-ignores] -- 2.43.0