From 3d7360a8d4b83f5901f423055ea794d9f42ab3af Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 27 Apr 2023 07:24:43 -0500 Subject: [PATCH] Lightning: make type hints public (#17100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add missing MANIFESTs * move * one more * Ignore version.info properly * move * manifest --------- Co-authored-by: Carlos Mocholí Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com> Co-authored-by: Jirka Co-authored-by: Adrian Wälchli --- .gitignore | 8 ++++---- setup.py | 6 +++++- src/lightning/py.typed | 0 src/lightning_app/MANIFEST.in | 1 + src/lightning_app/py.typed | 0 src/lightning_fabric/MANIFEST.in | 1 + src/lightning_fabric/py.typed | 0 7 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 src/lightning/py.typed create mode 100644 src/lightning_app/py.typed create mode 100644 src/lightning_fabric/py.typed diff --git a/.gitignore b/.gitignore index 375d77d5ef..17c18b06ee 100644 --- a/.gitignore +++ b/.gitignore @@ -53,9 +53,9 @@ wheels/ .installed.cfg *.egg src/*/version.info -src/lightning_app/ -src/lightning_fabric/ -src/pytorch_lightning/ +src/lightning_app/* +src/lightning_fabric/* +src/pytorch_lightning/* !src/*/__about__.py !src/*/__main__.py !src/*/__setup__.py @@ -63,7 +63,7 @@ src/pytorch_lightning/ !src/*/MANIFEST.in !src/*/py.typed !src/*/README.md -!src/*/*.info +!src/*/shell-folder_code-lives-lightning.info # PyInstaller # Usually these files are written by a python script from a template diff --git a/setup.py b/setup.py index 5b4e9b5caa..e2dfc48d08 100755 --- a/setup.py +++ b/setup.py @@ -87,7 +87,11 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False, mapping: Mapp if aggregate: # aggregate all MANIFEST.in contents into a single temporary file manifest_path = _named_temporary_file(manifest_dir) - lines = ["include src/lightning/version.info\n", "include requirements/base.txt\n"] + lines = [ + "include src/lightning/version.info\n", + "include src/lightning/py.typed\n", + "include requirements/base.txt\n", + ] # load manifest and aggregated all manifests for pkg in mapping.values(): pkg_manifest = os.path.join(_PATH_SRC, pkg, "MANIFEST.in") diff --git a/src/lightning/py.typed b/src/lightning/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lightning_app/MANIFEST.in b/src/lightning_app/MANIFEST.in index 45aea6f8bd..a8e251508b 100644 --- a/src/lightning_app/MANIFEST.in +++ b/src/lightning_app/MANIFEST.in @@ -8,3 +8,4 @@ recursive-include src/lightning_app/cli/*-template * # TODO: remove this once lightning-ui package is ready as a dependency recursive-include src/lightning_app/ui * include src/lightning_app/components/serve/catimage.png +include src/lightning_app/py.typed # marker file for PEP 561 diff --git a/src/lightning_app/py.typed b/src/lightning_app/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lightning_fabric/MANIFEST.in b/src/lightning_fabric/MANIFEST.in index 4cff43c8fd..3c33b95ae9 100644 --- a/src/lightning_fabric/MANIFEST.in +++ b/src/lightning_fabric/MANIFEST.in @@ -4,3 +4,4 @@ include src/lightning_fabric/CHANGELOG.md include src/lightning_fabric/README.md recursive-include requirements/fabric *.txt include .actions/assistant.py +include src/lightning_fabric/py.typed # marker file for PEP 561 diff --git a/src/lightning_fabric/py.typed b/src/lightning_fabric/py.typed new file mode 100644 index 0000000000..e69de29bb2