From a7b623eb61418b8bfa8a66c13823c15b358468fe Mon Sep 17 00:00:00 2001 From: paul fisher Date: Mon, 9 Jan 2023 18:58:25 -0500 Subject: [PATCH] Add `py.typed` marker file for downstream type checking. (#72) In order for mypy to use the types in an installed package's code for type-checking purposes, it needs this marker file. See, for example, https://github.com/python/mypy/blob/master/mypy/py.typed --- python-spec/pyproject.toml | 7 +++++-- python-spec/src/somacore/py.typed | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 python-spec/src/somacore/py.typed diff --git a/python-spec/pyproject.toml b/python-spec/pyproject.toml index 88c9f3c6..98f25e2b 100644 --- a/python-spec/pyproject.toml +++ b/python-spec/pyproject.toml @@ -13,8 +13,11 @@ requires-python = "~=3.7" [project.optional-dependencies] dev = ["black", "isort", "setuptools-scm"] -[tool.setuptools.dynamic] -version = { attr = "somacore._version.version" } +[tool.setuptools] +packages.find.where = ["src"] +package-data.somacore = ["py.typed"] +dynamic.version.attr = "somacore._version.version" + [tool.isort] profile = "black" diff --git a/python-spec/src/somacore/py.typed b/python-spec/src/somacore/py.typed new file mode 100644 index 00000000..288a150d --- /dev/null +++ b/python-spec/src/somacore/py.typed @@ -0,0 +1,2 @@ +# Marker file to indicate that this package contains Python typing information, +# and that mypy can use it to typecheck client code.