From 72db0ca8b39e79c6657a45d0ca20988802b4c774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 04:30:41 +0100 Subject: [PATCH 01/17] Do not modify MANIFEST.in on install --- MANIFEST.in | 5 ----- setup.py | 18 +++++++++++++----- src/lightning/MANIFEST.in | 2 ++ src/lightning/__setup__.py | 22 +--------------------- src/lightning_app/MANIFEST.in | 6 ++++++ src/lightning_app/__setup__.py | 22 +--------------------- src/lightning_lite/MANIFEST.in | 3 +++ src/lightning_lite/__setup__.py | 21 +-------------------- src/pytorch_lightning/MANIFEST.in | 8 ++++++++ src/pytorch_lightning/__setup__.py | 20 +------------------- 10 files changed, 36 insertions(+), 91 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 src/lightning/MANIFEST.in create mode 100644 src/lightning_app/MANIFEST.in create mode 100644 src/lightning_lite/MANIFEST.in create mode 100644 src/pytorch_lightning/MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index a8dbcff69b631..0000000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -exclude *.toml # project config -exclude requirements.txt -exclude __pycache__ -include .actions/setup_tools.py -include *.cff # citation info diff --git a/setup.py b/setup.py index ce2505223302c..9e2d73064f68c 100755 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType -from setuptools import setup +import setuptools _PACKAGE_NAME = os.environ.get("PACKAGE_NAME") _PACKAGE_MAPPING = { @@ -69,6 +69,13 @@ def _load_py_module(name: str, location: str) -> ModuleType: return py +def _set_manifest_path(manifest_dir: str) -> None: + # TODO: support mirror package. context manager with aggregation + manifest_path = os.path.join(manifest_dir, "MANIFEST.in") + assert os.path.exists(manifest_path) + setuptools.command.egg_info.manifest_maker.template = manifest_path + + if __name__ == "__main__": setup_tools = _load_py_module(name="setup_tools", location=os.path.join(".actions", "setup_tools.py")) @@ -86,13 +93,14 @@ def _load_py_module(name: str, location: str) -> ModuleType: # should have included only the relevant files of the package to install possible_packages = _PACKAGE_MAPPING.values() if _PACKAGE_NAME is None else [_PACKAGE_MAPPING[_PACKAGE_NAME]] for pkg in possible_packages: - pkg_setup = os.path.join(_PATH_SRC, pkg, "__setup__.py") + pkg_path = os.path.join(_PATH_SRC, pkg) + pkg_setup = os.path.join(pkg_path, "__setup__.py") if os.path.exists(pkg_setup): print(f"{pkg_setup} exists. Running `setuptools.setup`") + _set_manifest_path(pkg_path) setup_module = _load_py_module(name=f"{pkg}_setup", location=pkg_setup) - setup_module._adjust_manifest(pkg_name=pkg) - setup_args = setup_module._setup_args(pkg_name=pkg) - setup(**setup_args) + setup_args = setup_module._setup_args() + setuptools.setup(**setup_args) break else: raise RuntimeError(f"Something's wrong, no package was installed. Package name: {_PACKAGE_NAME}") diff --git a/src/lightning/MANIFEST.in b/src/lightning/MANIFEST.in new file mode 100644 index 0000000000000..d2d18d0cc9e7b --- /dev/null +++ b/src/lightning/MANIFEST.in @@ -0,0 +1,2 @@ +include src/lightning_lite/CHANGELOG.md +recursive-include requirements/lite *.txt diff --git a/src/lightning/__setup__.py b/src/lightning/__setup__.py index 58f0ee426076b..7d56c15dcba47 100644 --- a/src/lightning/__setup__.py +++ b/src/lightning/__setup__.py @@ -24,27 +24,7 @@ def _load_py_module(name: str, location: str) -> ModuleType: _SETUP_TOOLS = _load_py_module("setup_tools", os.path.join(_PROJECT_ROOT, ".actions", "setup_tools.py")) -def _adjust_manifest(**kwargs: Any) -> None: - # todo: consider rather aggregation of particular manifest adjustments - manifest_path = os.path.join(_PROJECT_ROOT, "MANIFEST.in") - assert os.path.isfile(manifest_path) - with open(manifest_path) as fp: - lines = [ln.rstrip() for ln in fp.readlines()] - lines += [ - "recursive-include src/lightning *.md", - "recursive-include requirements *.txt", - "recursive-include src/lightning/app/ui *", - "recursive-include src/lightning/cli/*-template *", # Add templates as build-in - # fixme: this is strange, this shall work with setup find package - include - "prune src/lightning_app", - "prune src/lightning_lite", - "prune src/pytorch_lightning", - ] - with open(manifest_path, "w") as fp: - fp.writelines([ln + os.linesep for ln in lines]) - - -def _setup_args(**kwargs: Any) -> Dict[str, Any]: +def _setup_args() -> Dict[str, Any]: _about = _load_py_module("about", os.path.join(_PACKAGE_ROOT, "__about__.py")) _version = _load_py_module("version", os.path.join(_PACKAGE_ROOT, "__version__.py")) _long_description = _SETUP_TOOLS.load_readme_description( diff --git a/src/lightning_app/MANIFEST.in b/src/lightning_app/MANIFEST.in new file mode 100644 index 0000000000000..477503e2a00bc --- /dev/null +++ b/src/lightning_app/MANIFEST.in @@ -0,0 +1,6 @@ +include src/lightning_app/CHANGELOG.md +recursive-include requirements/app *.txt +include .actions/setup_tools.py +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 * diff --git a/src/lightning_app/__setup__.py b/src/lightning_app/__setup__.py index af5d7582cd2e5..130079afdf381 100644 --- a/src/lightning_app/__setup__.py +++ b/src/lightning_app/__setup__.py @@ -41,27 +41,7 @@ def _prepare_extras() -> Dict[str, Any]: return extras -def _adjust_manifest(**__: Any) -> None: - manifest_path = os.path.join(_PROJECT_ROOT, "MANIFEST.in") - assert os.path.isfile(manifest_path) - with open(manifest_path) as fp: - lines = fp.readlines() - lines += [ - "recursive-exclude src *.md" + os.linesep, - "recursive-exclude requirements *.txt" + os.linesep, - "recursive-include src/lightning_app *.md" + os.linesep, - "recursive-include requirements/app *.txt" + os.linesep, - "recursive-include src/lightning_app/cli/*-template *" + os.linesep, # Add templates - ] - - # TODO: remove this once lightning-ui package is ready as a dependency - lines += ["recursive-include src/lightning_app/ui *" + os.linesep] - - with open(manifest_path, "w") as fp: - fp.writelines(lines) - - -def _setup_args(**__: Any) -> Dict[str, Any]: +def _setup_args() -> Dict[str, Any]: _path_setup_tools = os.path.join(_PROJECT_ROOT, ".actions", "setup_tools.py") _setup_tools = _load_py_module("setup_tools", _path_setup_tools) _about = _load_py_module("about", os.path.join(_PACKAGE_ROOT, "__about__.py")) diff --git a/src/lightning_lite/MANIFEST.in b/src/lightning_lite/MANIFEST.in new file mode 100644 index 0000000000000..a379129b22a3e --- /dev/null +++ b/src/lightning_lite/MANIFEST.in @@ -0,0 +1,3 @@ +include src/lightning_lite/CHANGELOG.md +recursive-include requirements/lite *.txt +include .actions/setup_tools.py diff --git a/src/lightning_lite/__setup__.py b/src/lightning_lite/__setup__.py index 09ec662df873d..746ed201cb52a 100644 --- a/src/lightning_lite/__setup__.py +++ b/src/lightning_lite/__setup__.py @@ -41,26 +41,7 @@ def _prepare_extras() -> Dict[str, Any]: return extras -def _adjust_manifest(**__: Any) -> None: - manifest_path = os.path.join(_PROJECT_ROOT, "MANIFEST.in") - assert os.path.isfile(manifest_path) - with open(manifest_path) as fp: - lines = fp.readlines() - lines += [ - "recursive-exclude src *.md" + os.linesep, - "recursive-exclude requirements *.txt" + os.linesep, - "recursive-include requirements/lite *.txt" + os.linesep, - "recursive-include src/lightning_lite *.md" + os.linesep, - ] - - # TODO: remove this once lightning-ui package is ready as a dependency - lines += ["recursive-include src/lightning_app/ui *" + os.linesep] - - with open(manifest_path, "w") as fp: - fp.writelines(lines) - - -def _setup_args(**__: Any) -> Dict[str, Any]: +def _setup_args() -> Dict[str, Any]: _path_setup_tools = os.path.join(_PROJECT_ROOT, ".actions", "setup_tools.py") _setup_tools = _load_py_module("setup_tools", _path_setup_tools) _about = _load_py_module("about", os.path.join(_PACKAGE_ROOT, "__about__.py")) diff --git a/src/pytorch_lightning/MANIFEST.in b/src/pytorch_lightning/MANIFEST.in new file mode 100644 index 0000000000000..28bb6cc815ae9 --- /dev/null +++ b/src/pytorch_lightning/MANIFEST.in @@ -0,0 +1,8 @@ +# distibute the lite source code inside PL +include src/lightning_lite/CHANGELOG.md +recursive-include requirements/lite *.txt +include src/pytorch_lightning/CHANGELOG.md +recursive-include requirements/pytorch *.txt +include .actions/setup_tools.py +include *.cff # citation info +include src/pytorch_lightning/py.typed # marker file for PEP 561 diff --git a/src/pytorch_lightning/__setup__.py b/src/pytorch_lightning/__setup__.py index 442bda630b884..3eea21cf0c7b0 100644 --- a/src/pytorch_lightning/__setup__.py +++ b/src/pytorch_lightning/__setup__.py @@ -44,25 +44,7 @@ def _prepare_extras() -> Dict[str, Any]: return extras -def _adjust_manifest(**__: Any) -> None: - manifest_path = os.path.join(_PROJECT_ROOT, "MANIFEST.in") - assert os.path.isfile(manifest_path) - with open(manifest_path) as fp: - lines = fp.readlines() - lines += [ - "recursive-exclude src *.md" + os.linesep, - "recursive-exclude requirements *.txt" + os.linesep, - "recursive-include requirements/lite *.txt" + os.linesep, - "recursive-include src/lightning_lite *.md" + os.linesep, - "recursive-include src/pytorch_lightning *.md" + os.linesep, - "recursive-include requirements/pytorch *.txt" + os.linesep, - "include src/pytorch_lightning/py.typed" + os.linesep, # marker file for PEP 561 - ] - with open(manifest_path, "w") as fp: - fp.writelines(lines) - - -def _setup_args(**__: Any) -> Dict[str, Any]: +def _setup_args() -> Dict[str, Any]: _path_setup_tools = os.path.join(_PROJECT_ROOT, ".actions", "setup_tools.py") _setup_tools = _load_py_module("setup_tools", _path_setup_tools) _about = _load_py_module("about", os.path.join(_PACKAGE_ROOT, "__about__.py")) From 45e400bd86ef791b0e843b3254e5b407076319ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 04:30:51 +0100 Subject: [PATCH 02/17] Do not modify MANIFEST.in on install --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9e2d73064f68c..f26d802cb6179 100755 --- a/setup.py +++ b/setup.py @@ -70,7 +70,7 @@ def _load_py_module(name: str, location: str) -> ModuleType: def _set_manifest_path(manifest_dir: str) -> None: - # TODO: support mirror package. context manager with aggregation + # FIXME: support mirror package. context manager with aggregation manifest_path = os.path.join(manifest_dir, "MANIFEST.in") assert os.path.exists(manifest_path) setuptools.command.egg_info.manifest_maker.template = manifest_path From be3c3bc6777027a2906fe826b6fe3b491c28bba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 04:32:46 +0100 Subject: [PATCH 03/17] checkout --- .github/workflows/docs-checks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index c4c97fd91667b..da9c4a93cc42f 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -75,7 +75,6 @@ jobs: if: ${{ matrix.pkg-name == 'app' }} run: | pip install -e . -U -f https://download.pytorch.org/whl/cpu/torch_stable.html -f pypi - git checkout -- MANIFEST.in - name: Adjust docs refs if: ${{ matrix.pkg-name == 'app' }} From aeae1ba728de1e06b78150a1c222a8cda9e7fe4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 04:43:51 +0100 Subject: [PATCH 04/17] Fix import --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f26d802cb6179..2bc04c90a71de 100755 --- a/setup.py +++ b/setup.py @@ -44,6 +44,7 @@ from types import ModuleType import setuptools +import setuptools.command.egg_info _PACKAGE_NAME = os.environ.get("PACKAGE_NAME") _PACKAGE_MAPPING = { From f2b13d78cbbe9c11ee908fa26cf7983ff0021796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 04:57:09 +0100 Subject: [PATCH 05/17] relpath --- setup.py | 2 ++ src/lightning/MANIFEST.in | 2 -- src/lightning_app/MANIFEST.in | 1 + src/lightning_lite/MANIFEST.in | 1 + src/pytorch_lightning/MANIFEST.in | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2bc04c90a71de..ca0db25db627d 100755 --- a/setup.py +++ b/setup.py @@ -73,6 +73,8 @@ def _load_py_module(name: str, location: str) -> ModuleType: def _set_manifest_path(manifest_dir: str) -> None: # FIXME: support mirror package. context manager with aggregation manifest_path = os.path.join(manifest_dir, "MANIFEST.in") + # avoid error: setup script specifies an absolute path + manifest_path = os.path.relpath(manifest_path, _PATH_ROOT) assert os.path.exists(manifest_path) setuptools.command.egg_info.manifest_maker.template = manifest_path diff --git a/src/lightning/MANIFEST.in b/src/lightning/MANIFEST.in index d2d18d0cc9e7b..e69de29bb2d1d 100644 --- a/src/lightning/MANIFEST.in +++ b/src/lightning/MANIFEST.in @@ -1,2 +0,0 @@ -include src/lightning_lite/CHANGELOG.md -recursive-include requirements/lite *.txt diff --git a/src/lightning_app/MANIFEST.in b/src/lightning_app/MANIFEST.in index 477503e2a00bc..c6898cfd5e909 100644 --- a/src/lightning_app/MANIFEST.in +++ b/src/lightning_app/MANIFEST.in @@ -1,4 +1,5 @@ include src/lightning_app/CHANGELOG.md +include src/lightning_app/README.md recursive-include requirements/app *.txt include .actions/setup_tools.py recursive-include src/lightning_app/cli/*-template * diff --git a/src/lightning_lite/MANIFEST.in b/src/lightning_lite/MANIFEST.in index a379129b22a3e..3e6f58d3303e5 100644 --- a/src/lightning_lite/MANIFEST.in +++ b/src/lightning_lite/MANIFEST.in @@ -1,3 +1,4 @@ include src/lightning_lite/CHANGELOG.md +include src/lightning_lite/README.md recursive-include requirements/lite *.txt include .actions/setup_tools.py diff --git a/src/pytorch_lightning/MANIFEST.in b/src/pytorch_lightning/MANIFEST.in index 28bb6cc815ae9..5652c6cadc583 100644 --- a/src/pytorch_lightning/MANIFEST.in +++ b/src/pytorch_lightning/MANIFEST.in @@ -2,6 +2,7 @@ include src/lightning_lite/CHANGELOG.md recursive-include requirements/lite *.txt include src/pytorch_lightning/CHANGELOG.md +include src/pytorch_lightning/README.md recursive-include requirements/pytorch *.txt include .actions/setup_tools.py include *.cff # citation info From 95a30bdbd09a943a33abbd0ae337f5bd1a7ab64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:18:48 +0100 Subject: [PATCH 06/17] MANIFEST aggregation --- setup.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index ca0db25db627d..381ff63a17fd3 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,9 @@ b) with a parameterization build desired packages in to standard `dist/` folder c) validate packages and publish to PyPI """ +import contextlib import os +import tempfile from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType @@ -70,13 +72,28 @@ def _load_py_module(name: str, location: str) -> ModuleType: return py -def _set_manifest_path(manifest_dir: str) -> None: - # FIXME: support mirror package. context manager with aggregation - manifest_path = os.path.join(manifest_dir, "MANIFEST.in") +@contextlib.contextmanager +def _set_manifest_path(manifest_dir: str, aggregate: bool = False): + if aggregate: + # aggregate all MANIFEST.in contents into a single temporary file + fp = tempfile.NamedTemporaryFile(mode="w", dir=manifest_dir, delete=True) + manifest_path = fp.name + packages = [v for v in _PACKAGE_MAPPING.values() if v != "lightning"] + for pkg in packages: + with open(os.path.join(_PATH_SRC, pkg, "MANIFEST.in")) as fh: + lines = fh.readlines() + fp.writelines(lines) + fp.flush() + else: + manifest_path = os.path.join(manifest_dir, "MANIFEST.in") + assert os.path.exists(manifest_path) # avoid error: setup script specifies an absolute path manifest_path = os.path.relpath(manifest_path, _PATH_ROOT) - assert os.path.exists(manifest_path) setuptools.command.egg_info.manifest_maker.template = manifest_path + yield + setuptools.command.egg_info.manifest_maker.template = "MANIFEST.in" + if aggregate: + fp.close() if __name__ == "__main__": @@ -103,7 +120,8 @@ def _set_manifest_path(manifest_dir: str) -> None: _set_manifest_path(pkg_path) setup_module = _load_py_module(name=f"{pkg}_setup", location=pkg_setup) setup_args = setup_module._setup_args() - setuptools.setup(**setup_args) + with _set_manifest_path(pkg_path, aggregate=pkg == "lightning"): + setuptools.setup(**setup_args) break else: raise RuntimeError(f"Something's wrong, no package was installed. Package name: {_PACKAGE_NAME}") From c80aafe9d1a0fdef4a91e82dc4361367212e104f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:24:34 +0100 Subject: [PATCH 07/17] Update setup.py --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 381ff63a17fd3..1ede1f2f78d2e 100755 --- a/setup.py +++ b/setup.py @@ -44,6 +44,7 @@ import tempfile from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType +from typing import Generator import setuptools import setuptools.command.egg_info @@ -73,7 +74,7 @@ def _load_py_module(name: str, location: str) -> ModuleType: @contextlib.contextmanager -def _set_manifest_path(manifest_dir: str, aggregate: bool = False): +def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: if aggregate: # aggregate all MANIFEST.in contents into a single temporary file fp = tempfile.NamedTemporaryFile(mode="w", dir=manifest_dir, delete=True) @@ -92,8 +93,6 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False): setuptools.command.egg_info.manifest_maker.template = manifest_path yield setuptools.command.egg_info.manifest_maker.template = "MANIFEST.in" - if aggregate: - fp.close() if __name__ == "__main__": From 007f286e41e0c60724d4c6007cb3ac33dff6d2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:29:54 +0100 Subject: [PATCH 08/17] Avoid manifest in wheel install --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1ede1f2f78d2e..5534cd269dd87 100755 --- a/setup.py +++ b/setup.py @@ -119,8 +119,13 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: _set_manifest_path(pkg_path) setup_module = _load_py_module(name=f"{pkg}_setup", location=pkg_setup) setup_args = setup_module._setup_args() - with _set_manifest_path(pkg_path, aggregate=pkg == "lightning"): + if _PACKAGE_NAME is None: + # we are installing a wheel, no need for MANIFEST.in things setuptools.setup(**setup_args) + else: + # we are installing from source, set the correct manifest path + with _set_manifest_path(pkg_path, aggregate=pkg == "lightning"): + setuptools.setup(**setup_args) break else: raise RuntimeError(f"Something's wrong, no package was installed. Package name: {_PACKAGE_NAME}") From 983377377780947681925efed7e502b8500a99dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:43:20 +0100 Subject: [PATCH 09/17] Windows support --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5534cd269dd87..9e2c2b17e77a7 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ import tempfile from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType -from typing import Generator +from typing import Generator, Optional import setuptools import setuptools.command.egg_info @@ -73,12 +73,20 @@ def _load_py_module(name: str, location: str) -> ModuleType: return py +def _named_temporary_file(directory: Optional[str] = None) -> str: + # `tempfile.NamedTemporaryFile` has issues in Windows + # https://github.com/deepchem/deepchem/issues/707#issuecomment-556002823 + if directory is None: + directory = tempfile.gettempdir() + return os.path.join(directory, os.urandom(24).hex()) + + @contextlib.contextmanager def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: if aggregate: # aggregate all MANIFEST.in contents into a single temporary file - fp = tempfile.NamedTemporaryFile(mode="w", dir=manifest_dir, delete=True) - manifest_path = fp.name + manifest_path = _named_temporary_file(manifest_dir) + fp = open(manifest_path, mode="w") packages = [v for v in _PACKAGE_MAPPING.values() if v != "lightning"] for pkg in packages: with open(os.path.join(_PATH_SRC, pkg, "MANIFEST.in")) as fh: From e97ceea58eaa9635a9df11adbe12ea78ff2ddf00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:43:46 +0100 Subject: [PATCH 10/17] Check no local unstaged changes --- .github/actions/pkg-check/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pkg-check/action.yml b/.github/actions/pkg-check/action.yml index 6680f945d589d..a8da0979592a4 100644 --- a/.github/actions/pkg-check/action.yml +++ b/.github/actions/pkg-check/action.yml @@ -33,9 +33,9 @@ runs: - name: Check package run: | + git diff --exit-code || exit $? # make sure there are no local unstaged changes ls -l dist/ twine check dist/* - # python setup.py clean shell: bash - name: Unzip packages From f19aea493fe1fdacd09802c74a639b2da76b491d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 05:45:48 +0100 Subject: [PATCH 11/17] Dupe --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 9e2c2b17e77a7..7254b64c85368 100755 --- a/setup.py +++ b/setup.py @@ -124,7 +124,6 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: pkg_setup = os.path.join(pkg_path, "__setup__.py") if os.path.exists(pkg_setup): print(f"{pkg_setup} exists. Running `setuptools.setup`") - _set_manifest_path(pkg_path) setup_module = _load_py_module(name=f"{pkg}_setup", location=pkg_setup) setup_args = setup_module._setup_args() if _PACKAGE_NAME is None: From 86017c41aa19926613c4641ce208b9063ae0cef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sat, 5 Nov 2022 06:16:06 +0100 Subject: [PATCH 12/17] Delete and replace --- setup.py | 19 ++++++++++++++----- src/pytorch_lightning/MANIFEST.in | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 7254b64c85368..0e502600c340d 100755 --- a/setup.py +++ b/setup.py @@ -86,12 +86,17 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: if aggregate: # aggregate all MANIFEST.in contents into a single temporary file manifest_path = _named_temporary_file(manifest_dir) - fp = open(manifest_path, mode="w") - packages = [v for v in _PACKAGE_MAPPING.values() if v != "lightning"] - for pkg in packages: + mapping = _PACKAGE_MAPPING.copy() + del mapping["lightning"] + lines = [] + for pkg in mapping.values(): with open(os.path.join(_PATH_SRC, pkg, "MANIFEST.in")) as fh: - lines = fh.readlines() - fp.writelines(lines) + lines.extend(fh.readlines()) + # convert lightning_foo to lightning/foo + for new, old in mapping.items(): + lines = [line.replace(old, f"lightning/{new}") for line in lines] + fp = open(manifest_path, mode="w") + fp.writelines(lines) fp.flush() else: manifest_path = os.path.join(manifest_dir, "MANIFEST.in") @@ -100,7 +105,11 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: manifest_path = os.path.relpath(manifest_path, _PATH_ROOT) setuptools.command.egg_info.manifest_maker.template = manifest_path yield + # cleanup setuptools.command.egg_info.manifest_maker.template = "MANIFEST.in" + if aggregate: + fp.close() + os.remove(manifest_path) if __name__ == "__main__": diff --git a/src/pytorch_lightning/MANIFEST.in b/src/pytorch_lightning/MANIFEST.in index 5652c6cadc583..7bff81b73bc8e 100644 --- a/src/pytorch_lightning/MANIFEST.in +++ b/src/pytorch_lightning/MANIFEST.in @@ -1,4 +1,4 @@ -# distibute the lite source code inside PL +# distribute the lite source code inside PL include src/lightning_lite/CHANGELOG.md recursive-include requirements/lite *.txt include src/pytorch_lightning/CHANGELOG.md From 12502c8552c89fb7cab22a92529a39bfa3732fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Tue, 8 Nov 2022 13:58:10 +0100 Subject: [PATCH 13/17] Update setup.py Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com> --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 0e502600c340d..f5abaf77df8ed 100755 --- a/setup.py +++ b/setup.py @@ -95,9 +95,8 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: # convert lightning_foo to lightning/foo for new, old in mapping.items(): lines = [line.replace(old, f"lightning/{new}") for line in lines] - fp = open(manifest_path, mode="w") - fp.writelines(lines) - fp.flush() + with open(manifest_path, mode="w") as fp: + fp.writelines(lines) else: manifest_path = os.path.join(manifest_dir, "MANIFEST.in") assert os.path.exists(manifest_path) @@ -108,7 +107,6 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: # cleanup setuptools.command.egg_info.manifest_maker.template = "MANIFEST.in" if aggregate: - fp.close() os.remove(manifest_path) From 471c8dab9182a490d9cf0c1a5aea0c6ba8368298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Wed, 9 Nov 2022 14:34:23 +0100 Subject: [PATCH 14/17] Add assistant --- src/lightning_app/MANIFEST.in | 1 + src/lightning_lite/MANIFEST.in | 1 + src/pytorch_lightning/MANIFEST.in | 1 + 3 files changed, 3 insertions(+) diff --git a/src/lightning_app/MANIFEST.in b/src/lightning_app/MANIFEST.in index c6898cfd5e909..ca57b0ca8fdb9 100644 --- a/src/lightning_app/MANIFEST.in +++ b/src/lightning_app/MANIFEST.in @@ -2,6 +2,7 @@ include src/lightning_app/CHANGELOG.md include src/lightning_app/README.md recursive-include requirements/app *.txt include .actions/setup_tools.py +include .actions/assistant.py 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 * diff --git a/src/lightning_lite/MANIFEST.in b/src/lightning_lite/MANIFEST.in index 3e6f58d3303e5..118c0aa952d9a 100644 --- a/src/lightning_lite/MANIFEST.in +++ b/src/lightning_lite/MANIFEST.in @@ -2,3 +2,4 @@ include src/lightning_lite/CHANGELOG.md include src/lightning_lite/README.md recursive-include requirements/lite *.txt include .actions/setup_tools.py +include .actions/assistant.py diff --git a/src/pytorch_lightning/MANIFEST.in b/src/pytorch_lightning/MANIFEST.in index 7bff81b73bc8e..5ff4ceab4c089 100644 --- a/src/pytorch_lightning/MANIFEST.in +++ b/src/pytorch_lightning/MANIFEST.in @@ -5,5 +5,6 @@ include src/pytorch_lightning/CHANGELOG.md include src/pytorch_lightning/README.md recursive-include requirements/pytorch *.txt include .actions/setup_tools.py +include .actions/assistant.py include *.cff # citation info include src/pytorch_lightning/py.typed # marker file for PEP 561 From 5f8938b2747b949878667adf850aabb5b6781f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Wed, 9 Nov 2022 19:08:11 +0100 Subject: [PATCH 15/17] skip --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 00d8f406dca56..b190063fd02a0 100755 --- a/setup.py +++ b/setup.py @@ -92,9 +92,10 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: for pkg in mapping.values(): with open(os.path.join(_PATH_SRC, pkg, "MANIFEST.in")) as fh: lines.extend(fh.readlines()) + # TODO: this makes e2e examples tests hang # convert lightning_foo to lightning/foo - for new, old in mapping.items(): - lines = [line.replace(old, f"lightning/{new}") for line in lines] + # for new, old in mapping.items(): + # lines = [line.replace(old, f"lightning/{new}") for line in lines] with open(manifest_path, mode="w") as fp: fp.writelines(lines) else: From 3cca997214c213c1473b2c3c39c2b8ba334bcfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Wed, 9 Nov 2022 19:32:07 +0100 Subject: [PATCH 16/17] Revert "skip" This reverts commit 5f8938b2747b949878667adf850aabb5b6781f34. --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index b190063fd02a0..00d8f406dca56 100755 --- a/setup.py +++ b/setup.py @@ -92,10 +92,9 @@ def _set_manifest_path(manifest_dir: str, aggregate: bool = False) -> Generator: for pkg in mapping.values(): with open(os.path.join(_PATH_SRC, pkg, "MANIFEST.in")) as fh: lines.extend(fh.readlines()) - # TODO: this makes e2e examples tests hang # convert lightning_foo to lightning/foo - # for new, old in mapping.items(): - # lines = [line.replace(old, f"lightning/{new}") for line in lines] + for new, old in mapping.items(): + lines = [line.replace(old, f"lightning/{new}") for line in lines] with open(manifest_path, mode="w") as fp: fp.writelines(lines) else: From 9c567ced67b1ba96cde01297c5ff99faa5d34e6b Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 11 Nov 2022 10:22:11 +0100 Subject: [PATCH 17/17] resolve --- src/lightning_app/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lightning_app/MANIFEST.in b/src/lightning_app/MANIFEST.in index ca57b0ca8fdb9..4fad4ff25a317 100644 --- a/src/lightning_app/MANIFEST.in +++ b/src/lightning_app/MANIFEST.in @@ -6,3 +6,4 @@ include .actions/assistant.py 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