2019-03-31 00:50:32 +00:00
|
|
|
#!/usr/bin/env python
|
2020-04-07 19:42:19 +00:00
|
|
|
# Copyright The Lightning AI team.
|
2020-08-20 02:03:22 +00:00
|
|
|
#
|
2019-08-05 20:19:55 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
2019-08-08 09:17:23 +00:00
|
|
|
# you may not use this file except in compliance with the License.
|
2020-08-06 11:12:47 +00:00
|
|
|
# You may obtain a copy of the License at
|
2020-08-20 02:03:22 +00:00
|
|
|
#
|
2019-08-08 17:06:20 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2020-08-20 02:03:22 +00:00
|
|
|
#
|
2020-04-07 21:30:48 +00:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
2019-08-08 09:17:23 +00:00
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2022-06-27 13:34:18 +00:00
|
|
|
"""This is the main and only one setup entry point for installing each package as stand-alone as well as joint
|
|
|
|
installation for all packages.
|
2019-03-31 00:50:32 +00:00
|
|
|
|
2022-06-27 13:34:18 +00:00
|
|
|
There are considered three main scenarios for installing this project:
|
|
|
|
|
2024-07-05 11:56:29 +00:00
|
|
|
1. Using PyPI registry when you can install `pytorch-lightning`, etc. or `lightning` for all.
|
2022-06-27 13:34:18 +00:00
|
|
|
|
|
|
|
2. Installation from source code after cloning repository.
|
|
|
|
In such case we recommend to use command `pip install .` or `pip install -e .` for development version
|
|
|
|
(development ver. do not copy python files to your pip file system, just create links, so you can edit here)
|
|
|
|
In case you want to install just one package you need to export env. variable before calling `pip`
|
|
|
|
|
|
|
|
- for `pytorch-lightning` use `export PACKAGE_NAME=pytorch ; pip install .`
|
2023-01-04 15:57:18 +00:00
|
|
|
- for `lightning-fabric` use `export PACKAGE_NAME=fabric ; pip install .`
|
2022-06-27 13:34:18 +00:00
|
|
|
|
|
|
|
3. Building packages as sdist or binary wheel and installing or publish to PyPI afterwords you use command
|
|
|
|
`python setup.py sdist` or `python setup.py bdist_wheel` accordingly.
|
2022-11-12 15:36:36 +00:00
|
|
|
In case you want to build just a particular package you want to set an environment variable:
|
2024-07-05 11:56:29 +00:00
|
|
|
`PACKAGE_NAME=lightning|pytorch|fabric python setup.py sdist|bdist_wheel`
|
2022-06-27 13:34:18 +00:00
|
|
|
|
|
|
|
4. Automated releasing with GitHub action is natural extension of 3) is composed of three consecutive steps:
|
|
|
|
a) determine which packages shall be released based on version increment in `__version__.py` and eventually
|
|
|
|
compared against PyPI registry
|
|
|
|
b) with a parameterization build desired packages in to standard `dist/` folder
|
|
|
|
c) validate packages and publish to PyPI
|
2023-08-09 14:44:20 +00:00
|
|
|
|
2022-06-27 13:34:18 +00:00
|
|
|
"""
|
2024-02-15 18:39:17 +00:00
|
|
|
|
2022-11-26 22:27:28 +00:00
|
|
|
import contextlib
|
2022-12-21 08:58:32 +00:00
|
|
|
import glob
|
Lightning Dataset (including optimized dataloading of s3 buckets) (#17743)
* Lightning DataLoader
* lightning dataloader
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* init
* example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* env var
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/__init__.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* remove unused functions
* extra reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/fileio.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports work now! yay
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* missing import
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* error handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update creds for local use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* recursive get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clean up get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update imagenet example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* example cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* changelog
* reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* requirements
* expose LightningDataset too
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* expost LightningDataset at top level
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused private methods from init
* remove private imports
* upper bound on extra requirements
* review comments
* loosen req
* deps
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test updating fabric base req
* remove version pin on s3fs to test
* recover missing function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* update
* random
* torchdata >= 0.3.0
* update torchdata version
* remove torchdata version to test
* try rem torch version pin
* req
* update bucket in test
* req
* skips
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* import
* update structure to lightning.data
* base.txt for data reqs
* fix imports
* rename to LightningS3Dataset
* new workflow
* dont need to test warnings
* reqs
* req
* revert data folder in pytorch
* test import
* tests
* req
* req
* req
* torch version
* req
* req
* open dep
* reformatted
* pin strict
* pin strict extra
* req
* modify workflow, no cache
* try
* patch
* import
* fix
* dataset test
* update getattr
* pin everything to test
* remove torch preinstall from workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* print
* skip test for now
* update path join
* revert app dep version bump
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow updates
* app base req
* req
* window test failure
* add data req to assistant
* try
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add missing comma
* updates
* update
* typo
* requirements
* try widening req
* older torch version
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* update
* update
* cleanup tests
* typo again
* update
* remove unnecessary line
* Update .github/CODEOWNERS
* Discard changes to requirements/pytorch/base.txt
* Discard changes to requirements/fabric/base.txt
* Discard changes to requirements/app/base.txt
* requirements
* requirements
* one line
* app workflow pick only app reqs
* rename package
* undo
* don't use cache
* examples CI
* pytorch and fabric CI
* try remove cache
* Apply suggestions from code review
* jirka playing
* jirka playing
* jirka playing
* blah
* flatten LightningDataset
* cleans up dataset class
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* extra
* fix dataset test
* update checkgroups
* Luca's review comments
* val error fix
* unskip test
* min
* fix precommit warning
* cpu
* docstrings
* req
* 2.0.1
* add return type
* typing errors
* req
* return types with quotations
* import for type-checking
* no botocore in cloudagnostic code
* exit args
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* backends typing
* remove oldest from data tests
* typing
* typing
* typing
* types
* type
* typing
* typing
* typing
* import fix
* Changelog
---------
Co-authored-by: Noha Alon <nohaalon@Nohas-MacBook-Air.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Justus Schock <justus.schock@posteo.de>
2023-06-13 10:44:41 +00:00
|
|
|
import logging
|
2019-10-28 22:41:13 +00:00
|
|
|
import os
|
2022-11-26 22:27:28 +00:00
|
|
|
import tempfile
|
2021-04-28 21:45:09 +00:00
|
|
|
from importlib.util import module_from_spec, spec_from_file_location
|
2022-06-15 00:54:55 +00:00
|
|
|
from types import ModuleType
|
2023-02-01 05:29:16 +00:00
|
|
|
from typing import Generator, Mapping, Optional
|
2021-03-22 12:39:19 +00:00
|
|
|
|
2022-11-26 22:27:28 +00:00
|
|
|
import setuptools
|
|
|
|
import setuptools.command.egg_info
|
2019-04-03 16:40:03 +00:00
|
|
|
|
2022-12-21 08:58:32 +00:00
|
|
|
_PACKAGE_NAME = os.environ.get("PACKAGE_NAME")
|
2022-11-04 16:51:03 +00:00
|
|
|
_PACKAGE_MAPPING = {
|
|
|
|
"lightning": "lightning",
|
|
|
|
"pytorch": "pytorch_lightning",
|
2023-01-04 15:57:18 +00:00
|
|
|
"fabric": "lightning_fabric",
|
2022-11-04 16:51:03 +00:00
|
|
|
}
|
2019-10-28 22:41:13 +00:00
|
|
|
# https://packaging.python.org/guides/single-sourcing-package-version/
|
2019-04-03 16:40:03 +00:00
|
|
|
# http://blog.ionelmc.ro/2014/05/25/python-packaging/
|
2021-03-22 12:39:19 +00:00
|
|
|
_PATH_ROOT = os.path.dirname(__file__)
|
2022-07-29 12:37:33 +00:00
|
|
|
_PATH_SRC = os.path.join(_PATH_ROOT, "src")
|
2022-08-01 13:08:43 +00:00
|
|
|
_PATH_REQUIRE = os.path.join(_PATH_ROOT, "requirements")
|
2023-03-21 19:26:47 +00:00
|
|
|
_FREEZE_REQUIREMENTS = os.environ.get("FREEZE_REQUIREMENTS", "0").lower() in ("1", "true")
|
2022-06-27 13:34:18 +00:00
|
|
|
|
|
|
|
|
2022-06-15 00:54:55 +00:00
|
|
|
def _load_py_module(name: str, location: str) -> ModuleType:
|
|
|
|
spec = spec_from_file_location(name, location)
|
2022-07-01 12:36:33 +00:00
|
|
|
assert spec, f"Failed to load module {name} from {location}"
|
2021-04-28 21:45:09 +00:00
|
|
|
py = module_from_spec(spec)
|
2022-07-01 12:36:33 +00:00
|
|
|
assert spec.loader, f"ModuleSpec.loader is None for {name} from {location}"
|
2021-04-28 21:45:09 +00:00
|
|
|
spec.loader.exec_module(py)
|
|
|
|
return py
|
|
|
|
|
|
|
|
|
2022-11-26 22:27:28 +00:00
|
|
|
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
|
2023-02-01 05:29:16 +00:00
|
|
|
def _set_manifest_path(manifest_dir: str, aggregate: bool = False, mapping: Mapping = _PACKAGE_MAPPING) -> Generator:
|
2022-11-26 22:27:28 +00:00
|
|
|
if aggregate:
|
|
|
|
# aggregate all MANIFEST.in contents into a single temporary file
|
|
|
|
manifest_path = _named_temporary_file(manifest_dir)
|
Lightning Dataset (including optimized dataloading of s3 buckets) (#17743)
* Lightning DataLoader
* lightning dataloader
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* init
* example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* env var
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/__init__.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* remove unused functions
* extra reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/fileio.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports work now! yay
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* missing import
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* error handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update creds for local use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* recursive get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clean up get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update imagenet example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* example cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* changelog
* reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* requirements
* expose LightningDataset too
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* expost LightningDataset at top level
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused private methods from init
* remove private imports
* upper bound on extra requirements
* review comments
* loosen req
* deps
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test updating fabric base req
* remove version pin on s3fs to test
* recover missing function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* update
* random
* torchdata >= 0.3.0
* update torchdata version
* remove torchdata version to test
* try rem torch version pin
* req
* update bucket in test
* req
* skips
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* import
* update structure to lightning.data
* base.txt for data reqs
* fix imports
* rename to LightningS3Dataset
* new workflow
* dont need to test warnings
* reqs
* req
* revert data folder in pytorch
* test import
* tests
* req
* req
* req
* torch version
* req
* req
* open dep
* reformatted
* pin strict
* pin strict extra
* req
* modify workflow, no cache
* try
* patch
* import
* fix
* dataset test
* update getattr
* pin everything to test
* remove torch preinstall from workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* print
* skip test for now
* update path join
* revert app dep version bump
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow updates
* app base req
* req
* window test failure
* add data req to assistant
* try
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add missing comma
* updates
* update
* typo
* requirements
* try widening req
* older torch version
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* update
* update
* cleanup tests
* typo again
* update
* remove unnecessary line
* Update .github/CODEOWNERS
* Discard changes to requirements/pytorch/base.txt
* Discard changes to requirements/fabric/base.txt
* Discard changes to requirements/app/base.txt
* requirements
* requirements
* one line
* app workflow pick only app reqs
* rename package
* undo
* don't use cache
* examples CI
* pytorch and fabric CI
* try remove cache
* Apply suggestions from code review
* jirka playing
* jirka playing
* jirka playing
* blah
* flatten LightningDataset
* cleans up dataset class
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* extra
* fix dataset test
* update checkgroups
* Luca's review comments
* val error fix
* unskip test
* min
* fix precommit warning
* cpu
* docstrings
* req
* 2.0.1
* add return type
* typing errors
* req
* return types with quotations
* import for type-checking
* no botocore in cloudagnostic code
* exit args
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* backends typing
* remove oldest from data tests
* typing
* typing
* typing
* types
* type
* typing
* typing
* typing
* import fix
* Changelog
---------
Co-authored-by: Noha Alon <nohaalon@Nohas-MacBook-Air.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Justus Schock <justus.schock@posteo.de>
2023-06-13 10:44:41 +00:00
|
|
|
lines = []
|
2022-12-21 08:58:32 +00:00
|
|
|
# load manifest and aggregated all manifests
|
2022-11-26 22:27:28 +00:00
|
|
|
for pkg in mapping.values():
|
2022-12-21 08:58:32 +00:00
|
|
|
pkg_manifest = os.path.join(_PATH_SRC, pkg, "MANIFEST.in")
|
|
|
|
if os.path.isfile(pkg_manifest):
|
|
|
|
with open(pkg_manifest) as fh:
|
|
|
|
lines.extend(fh.readlines())
|
2022-11-26 22:27:28 +00:00
|
|
|
# convert lightning_foo to lightning/foo
|
|
|
|
for new, old in mapping.items():
|
2023-01-09 14:01:47 +00:00
|
|
|
if old == "lightning":
|
|
|
|
continue # avoid `lightning` -> `lightning/lightning`
|
|
|
|
lines = [ln.replace(old, f"lightning/{new}") for ln in lines]
|
2022-12-21 08:58:32 +00:00
|
|
|
lines = sorted(set(filter(lambda ln: not ln.strip().startswith("#"), lines)))
|
Lightning Dataset (including optimized dataloading of s3 buckets) (#17743)
* Lightning DataLoader
* lightning dataloader
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* init
* example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* env var
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/__init__.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* remove unused functions
* extra reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/fileio.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports work now! yay
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* missing import
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* error handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update creds for local use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* recursive get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clean up get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update imagenet example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* example cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* changelog
* reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* requirements
* expose LightningDataset too
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* expost LightningDataset at top level
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused private methods from init
* remove private imports
* upper bound on extra requirements
* review comments
* loosen req
* deps
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test updating fabric base req
* remove version pin on s3fs to test
* recover missing function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* update
* random
* torchdata >= 0.3.0
* update torchdata version
* remove torchdata version to test
* try rem torch version pin
* req
* update bucket in test
* req
* skips
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* import
* update structure to lightning.data
* base.txt for data reqs
* fix imports
* rename to LightningS3Dataset
* new workflow
* dont need to test warnings
* reqs
* req
* revert data folder in pytorch
* test import
* tests
* req
* req
* req
* torch version
* req
* req
* open dep
* reformatted
* pin strict
* pin strict extra
* req
* modify workflow, no cache
* try
* patch
* import
* fix
* dataset test
* update getattr
* pin everything to test
* remove torch preinstall from workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* print
* skip test for now
* update path join
* revert app dep version bump
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow updates
* app base req
* req
* window test failure
* add data req to assistant
* try
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add missing comma
* updates
* update
* typo
* requirements
* try widening req
* older torch version
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* update
* update
* cleanup tests
* typo again
* update
* remove unnecessary line
* Update .github/CODEOWNERS
* Discard changes to requirements/pytorch/base.txt
* Discard changes to requirements/fabric/base.txt
* Discard changes to requirements/app/base.txt
* requirements
* requirements
* one line
* app workflow pick only app reqs
* rename package
* undo
* don't use cache
* examples CI
* pytorch and fabric CI
* try remove cache
* Apply suggestions from code review
* jirka playing
* jirka playing
* jirka playing
* blah
* flatten LightningDataset
* cleans up dataset class
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* extra
* fix dataset test
* update checkgroups
* Luca's review comments
* val error fix
* unskip test
* min
* fix precommit warning
* cpu
* docstrings
* req
* 2.0.1
* add return type
* typing errors
* req
* return types with quotations
* import for type-checking
* no botocore in cloudagnostic code
* exit args
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* backends typing
* remove oldest from data tests
* typing
* typing
* typing
* types
* type
* typing
* typing
* typing
* import fix
* Changelog
---------
Co-authored-by: Noha Alon <nohaalon@Nohas-MacBook-Air.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Justus Schock <justus.schock@posteo.de>
2023-06-13 10:44:41 +00:00
|
|
|
logging.debug(f"aggregated manifest consists of: {lines}")
|
2022-11-26 22:27:28 +00:00
|
|
|
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)
|
|
|
|
# avoid error: setup script specifies an absolute path
|
|
|
|
manifest_path = os.path.relpath(manifest_path, _PATH_ROOT)
|
Lightning Dataset (including optimized dataloading of s3 buckets) (#17743)
* Lightning DataLoader
* lightning dataloader
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* init
* example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* env var
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/__init__.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* remove unused functions
* extra reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update src/lightning/pytorch/utilities/data/fileio.py
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports work now! yay
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* imports
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* missing import
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* error handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update creds for local use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* recursive get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clean up get index
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update imagenet example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* example cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* changelog
* reqs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* codeowners
* requirements
* expose LightningDataset too
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* expost LightningDataset at top level
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused private methods from init
* remove private imports
* upper bound on extra requirements
* review comments
* loosen req
* deps
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test updating fabric base req
* remove version pin on s3fs to test
* recover missing function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tests
* update
* random
* torchdata >= 0.3.0
* update torchdata version
* remove torchdata version to test
* try rem torch version pin
* req
* update bucket in test
* req
* skips
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* import
* update structure to lightning.data
* base.txt for data reqs
* fix imports
* rename to LightningS3Dataset
* new workflow
* dont need to test warnings
* reqs
* req
* revert data folder in pytorch
* test import
* tests
* req
* req
* req
* torch version
* req
* req
* open dep
* reformatted
* pin strict
* pin strict extra
* req
* modify workflow, no cache
* try
* patch
* import
* fix
* dataset test
* update getattr
* pin everything to test
* remove torch preinstall from workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* workflow
* req
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow
* print
* skip test for now
* update path join
* revert app dep version bump
* Update .github/workflows/ci-tests-data.yml
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
* workflow updates
* app base req
* req
* window test failure
* add data req to assistant
* try
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add missing comma
* updates
* update
* typo
* requirements
* try widening req
* older torch version
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* update
* update
* cleanup tests
* typo again
* update
* remove unnecessary line
* Update .github/CODEOWNERS
* Discard changes to requirements/pytorch/base.txt
* Discard changes to requirements/fabric/base.txt
* Discard changes to requirements/app/base.txt
* requirements
* requirements
* one line
* app workflow pick only app reqs
* rename package
* undo
* don't use cache
* examples CI
* pytorch and fabric CI
* try remove cache
* Apply suggestions from code review
* jirka playing
* jirka playing
* jirka playing
* blah
* flatten LightningDataset
* cleans up dataset class
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* jirka playing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* extra
* fix dataset test
* update checkgroups
* Luca's review comments
* val error fix
* unskip test
* min
* fix precommit warning
* cpu
* docstrings
* req
* 2.0.1
* add return type
* typing errors
* req
* return types with quotations
* import for type-checking
* no botocore in cloudagnostic code
* exit args
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* backends typing
* remove oldest from data tests
* typing
* typing
* typing
* types
* type
* typing
* typing
* typing
* import fix
* Changelog
---------
Co-authored-by: Noha Alon <nohaalon@Nohas-MacBook-Air.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
Co-authored-by: Justus Schock <justus.schock@posteo.de>
2023-06-13 10:44:41 +00:00
|
|
|
logging.info("Set manifest path to", manifest_path)
|
2022-11-26 22:27:28 +00:00
|
|
|
setuptools.command.egg_info.manifest_maker.template = manifest_path
|
|
|
|
yield
|
|
|
|
# cleanup
|
|
|
|
setuptools.command.egg_info.manifest_maker.template = "MANIFEST.in"
|
|
|
|
if aggregate:
|
|
|
|
os.remove(manifest_path)
|
|
|
|
|
|
|
|
|
2022-06-15 00:54:55 +00:00
|
|
|
if __name__ == "__main__":
|
2022-11-08 18:52:24 +00:00
|
|
|
assistant = _load_py_module(name="assistant", location=os.path.join(_PATH_ROOT, ".actions", "assistant.py"))
|
2022-11-04 16:51:03 +00:00
|
|
|
|
2022-12-21 08:58:32 +00:00
|
|
|
if os.path.isdir(_PATH_SRC):
|
2022-11-12 15:36:36 +00:00
|
|
|
# copy the version information to all packages
|
2022-12-13 14:47:35 +00:00
|
|
|
assistant.distribute_version(_PATH_SRC)
|
2022-12-21 08:58:32 +00:00
|
|
|
print(f"Requested package: '{_PACKAGE_NAME}'") # requires `-v` to appear
|
|
|
|
|
|
|
|
local_pkgs = [
|
|
|
|
os.path.basename(p)
|
|
|
|
for p in glob.glob(os.path.join(_PATH_SRC, "*"))
|
|
|
|
if os.path.isdir(p) and not p.endswith(".egg-info")
|
|
|
|
]
|
|
|
|
print(f"Local package candidates: {local_pkgs}")
|
|
|
|
is_source_install = len(local_pkgs) > 2
|
|
|
|
print(f"Installing from source: {is_source_install}")
|
|
|
|
if is_source_install:
|
|
|
|
if _PACKAGE_NAME is not None and _PACKAGE_NAME not in _PACKAGE_MAPPING:
|
|
|
|
raise ValueError(
|
|
|
|
f"Unexpected package name: {_PACKAGE_NAME}. Possible choices are: {list(_PACKAGE_MAPPING)}"
|
|
|
|
)
|
|
|
|
package_to_install = _PACKAGE_MAPPING.get(_PACKAGE_NAME, "lightning")
|
2023-02-01 05:29:16 +00:00
|
|
|
if package_to_install == "lightning":
|
2022-12-21 08:58:32 +00:00
|
|
|
# merge all requirements files
|
2023-02-01 18:22:42 +00:00
|
|
|
assistant._load_aggregate_requirements(_PATH_REQUIRE, _FREEZE_REQUIREMENTS)
|
2023-02-02 14:10:29 +00:00
|
|
|
else:
|
|
|
|
# replace imports and copy the code
|
|
|
|
assistant.create_mirror_package(_PATH_SRC, _PACKAGE_MAPPING)
|
2022-11-04 16:51:03 +00:00
|
|
|
else:
|
2022-12-21 08:58:32 +00:00
|
|
|
assert len(local_pkgs) > 0
|
2023-01-04 15:57:18 +00:00
|
|
|
# PL as a package is distributed together with Fabric, so in such case there are more than one candidate
|
2022-12-21 08:58:32 +00:00
|
|
|
package_to_install = "pytorch_lightning" if "pytorch_lightning" in local_pkgs else local_pkgs[0]
|
|
|
|
print(f"Installing package: {package_to_install}")
|
|
|
|
|
|
|
|
# going to install with `setuptools.setup`
|
|
|
|
pkg_path = os.path.join(_PATH_SRC, package_to_install)
|
|
|
|
pkg_setup = os.path.join(pkg_path, "__setup__.py")
|
|
|
|
if not os.path.exists(pkg_setup):
|
2022-11-04 16:51:03 +00:00
|
|
|
raise RuntimeError(f"Something's wrong, no package was installed. Package name: {_PACKAGE_NAME}")
|
2022-12-21 08:58:32 +00:00
|
|
|
setup_module = _load_py_module(name=f"{package_to_install}_setup", location=pkg_setup)
|
|
|
|
setup_args = setup_module._setup_args()
|
|
|
|
is_main_pkg = package_to_install == "lightning"
|
|
|
|
print(f"Installing as the main package: {is_main_pkg}")
|
|
|
|
if is_source_install:
|
|
|
|
# we are installing from source, set the correct manifest path
|
|
|
|
with _set_manifest_path(pkg_path, aggregate=is_main_pkg):
|
|
|
|
setuptools.setup(**setup_args)
|
|
|
|
else:
|
|
|
|
setuptools.setup(**setup_args)
|
|
|
|
print("Finished setup configuration.")
|