From cbd92913b581fa03416810465d85b7ccff33109b Mon Sep 17 00:00:00 2001 From: Auguste Baum Date: Tue, 14 Jan 2025 11:27:02 +0100 Subject: [PATCH] docs: Add ADR about typing --- docs/design/0003-use-union-rather-than-pipe.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/design/0003-use-union-rather-than-pipe.md diff --git a/docs/design/0003-use-union-rather-than-pipe.md b/docs/design/0003-use-union-rather-than-pipe.md new file mode 100644 index 000000000..ddbb2c772 --- /dev/null +++ b/docs/design/0003-use-union-rather-than-pipe.md @@ -0,0 +1,17 @@ +--- +date: 2025-01-14 +decision-makers: ["@augustebaum", "@thomass-dev"] +--- + +# Use `typing.Union` rather than `|` in type hints + +## Context and Problem Statement + +This ADR originates from a discussion in [this PR comment](https://github.com/probabl-ai/skore/pull/1084#discussion_r1914402895). + +Writing a union type using `|` is [only available from Python 3.10](https://docs.python.org/3.12/library/typing.html#typing.Union), while we currently intend to support Python 3.9. +Even though we do not formally check type-hints using automatic tools like `mypy`, we still strive for consistency for style issues of this kind. + +## Decision Outcome + +Use `typing.Union` rather than `|` in type hints.