2023-01-19 16:48:28 +00:00
|
|
|
# Copyright The Lightning AI team.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# 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.
|
|
|
|
|
2019-04-03 17:17:55 +00:00
|
|
|
[build-system]
|
|
|
|
requires = [
|
|
|
|
"setuptools",
|
|
|
|
"wheel",
|
|
|
|
]
|
2020-02-23 02:45:34 +00:00
|
|
|
|
2021-07-13 06:23:36 +00:00
|
|
|
|
2021-07-26 11:37:35 +00:00
|
|
|
[tool.black]
|
|
|
|
line-length = 120
|
2022-07-27 09:02:58 +00:00
|
|
|
exclude = '(_notebooks/.*)'
|
2021-07-26 11:37:35 +00:00
|
|
|
|
2023-08-09 14:44:20 +00:00
|
|
|
[tool.docformatter]
|
|
|
|
recursive = true
|
|
|
|
# this need to be shorter as some docstings are r"""...
|
|
|
|
wrap-summaries = 119
|
|
|
|
wrap-descriptions = 120
|
|
|
|
blank = true
|
|
|
|
|
2023-09-26 15:54:44 +00:00
|
|
|
[tool.codespell]
|
|
|
|
# Todo: enable also python files in a next step
|
|
|
|
skip = '*.py'
|
|
|
|
quiet-level = 3
|
|
|
|
# comma separated list of words; waiting for:
|
|
|
|
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
|
|
|
|
# also adding links until they ignored by its: nature
|
|
|
|
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
|
|
|
|
ignore-words-list = "te, compiletime"
|
|
|
|
|
2021-07-26 11:37:35 +00:00
|
|
|
|
2023-01-19 16:48:28 +00:00
|
|
|
[tool.ruff]
|
|
|
|
line-length = 120
|
2024-03-15 19:48:17 +00:00
|
|
|
target-version = "py38"
|
|
|
|
# Exclude a variety of commonly ignored directories.
|
|
|
|
exclude = [
|
|
|
|
".git",
|
|
|
|
"docs",
|
|
|
|
"_notebooks"
|
|
|
|
]
|
|
|
|
|
|
|
|
[tool.ruff.format]
|
|
|
|
preview = true
|
|
|
|
|
|
|
|
[tool.ruff.lint]
|
|
|
|
select = [
|
2023-01-19 16:48:28 +00:00
|
|
|
"E", "W", # see: https://pypi.org/project/pycodestyle
|
|
|
|
"F", # see: https://pypi.org/project/pyflakes
|
2023-04-27 09:43:12 +00:00
|
|
|
"S", # see: https://pypi.org/project/flake8-bandit
|
2023-10-31 01:16:02 +00:00
|
|
|
"RUF018", # see: https://docs.astral.sh/ruff/rules/assignment-in-assert
|
2024-03-15 19:48:17 +00:00
|
|
|
"UP", # see: https://docs.astral.sh/ruff/rules/#pyupgrade-up
|
2023-01-19 16:48:28 +00:00
|
|
|
]
|
2024-03-15 19:48:17 +00:00
|
|
|
extend-select = [
|
ruff: replace isort with ruff +TPU (#17684)
* ruff: replace isort with ruff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixing & imports
* lines in warning test
* docs
* fix enum import
* [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
* [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
* [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
* [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
* [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
* [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
* fixing
* import
* fix lines
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* type ClusterEnvironment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-26 15:54:55 +00:00
|
|
|
"I", # see: isort
|
2023-04-21 09:07:58 +00:00
|
|
|
"C4", # see: https://pypi.org/project/flake8-comprehensions
|
2023-04-24 21:57:08 +00:00
|
|
|
"SIM", # see: https://pypi.org/project/flake8-simplify
|
2023-05-05 09:34:40 +00:00
|
|
|
"RET", # see: https://pypi.org/project/flake8-return
|
2023-05-05 06:25:15 +00:00
|
|
|
"PT", # see: https://pypi.org/project/flake8-pytest-style
|
2024-02-26 18:54:13 +00:00
|
|
|
"RUF100", # see: https://docs.astral.sh/ruff/rules/unused-noqa/
|
2023-04-21 09:07:58 +00:00
|
|
|
]
|
2024-03-15 19:48:17 +00:00
|
|
|
ignore = [
|
2023-01-19 16:48:28 +00:00
|
|
|
"E731", # Do not assign a lambda expression, use a def
|
2023-05-04 08:12:33 +00:00
|
|
|
"S108",
|
2023-10-31 01:16:02 +00:00
|
|
|
"E203", # conflicts with black
|
2023-01-19 16:48:28 +00:00
|
|
|
]
|
2024-03-15 19:48:17 +00:00
|
|
|
ignore-init-module-imports = true
|
2023-01-19 16:48:28 +00:00
|
|
|
|
2024-02-15 18:39:17 +00:00
|
|
|
[tool.ruff.lint.per-file-ignores]
|
2023-04-27 09:43:12 +00:00
|
|
|
".actions/*" = ["S101", "S310"]
|
|
|
|
"setup.py" = ["S101"]
|
|
|
|
"examples/**" = [
|
|
|
|
"S101", # Use of `assert` detected
|
|
|
|
"S113", # todo: Probable use of requests call without
|
|
|
|
"S104", # Possible binding to all interface
|
|
|
|
"F821", # Undefined name `...`
|
|
|
|
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
|
|
|
|
"S501", # Probable use of `requests` call with `verify=False` disabling SSL certificate checks
|
|
|
|
"S108", # Probable insecure usage of temporary file or directory: "/tmp/data/MNIST"
|
|
|
|
]
|
|
|
|
"src/**" = [
|
|
|
|
"S101", # todo: Use of `assert` detected
|
|
|
|
"S105", "S106", "S107", # todo: Possible hardcoded password: ...
|
|
|
|
"S113", # todo: Probable use of requests call without timeout
|
|
|
|
"S301", # todo: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
|
|
|
|
"S324", # todo: Probable use of insecure hash functions in `hashlib`
|
2024-01-31 17:09:39 +00:00
|
|
|
"S403", # todo: `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
|
|
|
|
"S404", # todo: `subprocess` module is possibly insecure
|
2023-04-27 10:21:04 +00:00
|
|
|
"S602", # todo: `subprocess` call with `shell=True` identified, security issue
|
|
|
|
"S603", # todo: `subprocess` call: check for execution of untrusted input
|
|
|
|
"S605", # todo: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
|
|
|
"S607", # todo: Starting a process with a partial executable path
|
2023-05-05 09:34:40 +00:00
|
|
|
"RET504", # todo:Unnecessary variable assignment before `return` statement
|
2023-06-12 19:33:51 +00:00
|
|
|
"RET503",
|
2023-04-27 09:43:12 +00:00
|
|
|
]
|
|
|
|
"tests/**" = [
|
|
|
|
"S101", # Use of `assert` detected
|
|
|
|
"S105", "S106", # todo: Possible hardcoded password: ...
|
|
|
|
"S301", # `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
|
|
|
|
"S113", # todo: Probable use of requests call without timeout
|
|
|
|
"S311", # todo: Standard pseudo-random generators are not suitable for cryptographic purposes
|
|
|
|
"S108", # todo: Probable insecure usage of temporary file or directory: "/tmp/sys-customizations-sync"
|
2024-01-10 18:11:48 +00:00
|
|
|
"S202", # Uses of `tarfile.extractall()`
|
2024-01-31 17:09:39 +00:00
|
|
|
"S403", # `pickle`, `cPickle`, `dill`, and `shelve` modules are possibly insecure
|
|
|
|
"S404", # `subprocess` module is possibly insecure
|
2023-04-27 10:21:04 +00:00
|
|
|
"S602", # todo: `subprocess` call with `shell=True` identified, security issue
|
|
|
|
"S603", # todo: `subprocess` call: check for execution of untrusted input
|
|
|
|
"S605", # todo: Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
|
|
|
|
"S607", # todo: Starting a process with a partial executable path
|
2023-05-05 09:34:40 +00:00
|
|
|
"RET504", # todo:Unnecessary variable assignment before `return` statement
|
2023-05-05 06:25:15 +00:00
|
|
|
"PT004", # todo: Fixture `tmpdir_unittest_fixture` does not return anything, add leading underscore
|
|
|
|
"PT011", # todo: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
|
|
|
|
"PT012", # todo: `pytest.raises()` block should contain a single simple statement
|
|
|
|
"PT019", # todo: Fixture `_` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
|
2023-04-27 09:43:12 +00:00
|
|
|
]
|
|
|
|
|
2024-02-15 18:39:17 +00:00
|
|
|
[tool.ruff.lint.mccabe]
|
2023-01-19 16:48:28 +00:00
|
|
|
# Unlike Flake8, default to a complexity level of 10.
|
|
|
|
max-complexity = 10
|
|
|
|
|
|
|
|
|
2021-07-13 06:23:36 +00:00
|
|
|
[tool.mypy]
|
2022-07-11 21:46:52 +00:00
|
|
|
files = [
|
2023-02-01 05:29:16 +00:00
|
|
|
"src/lightning",
|
2022-09-20 17:23:48 +00:00
|
|
|
]
|
2022-12-08 18:36:16 +00:00
|
|
|
# This section is for folders with "-" as they are not valid python modules
|
2022-09-20 17:23:48 +00:00
|
|
|
exclude = [
|
2023-02-01 05:29:16 +00:00
|
|
|
"src/lightning/app/cli/app-template",
|
|
|
|
"src/lightning/app/cli/component-template",
|
|
|
|
"src/lightning/app/cli/pl-app-template",
|
|
|
|
"src/lightning/app/cli/react-ui-template",
|
2022-07-11 21:46:52 +00:00
|
|
|
]
|
|
|
|
install_types = "True"
|
|
|
|
non_interactive = "True"
|
2021-07-13 06:23:36 +00:00
|
|
|
disallow_untyped_defs = "True"
|
|
|
|
ignore_missing_imports = "True"
|
|
|
|
show_error_codes = "True"
|
|
|
|
warn_redundant_casts = "True"
|
|
|
|
warn_unused_configs = "True"
|
2023-03-02 19:12:14 +00:00
|
|
|
warn_unused_ignores = "True"
|
2021-07-13 06:23:36 +00:00
|
|
|
allow_redefinition = "True"
|
|
|
|
# disable this rule as the Trainer attributes are defined in the connectors, not in its __init__
|
|
|
|
disable_error_code = "attr-defined"
|
2021-08-26 08:36:21 +00:00
|
|
|
# style choices
|
|
|
|
warn_no_return = "False"
|
2021-07-13 06:23:36 +00:00
|
|
|
|
2021-11-26 20:14:11 +00:00
|
|
|
# Ignore mypy errors for these files
|
2021-11-25 10:27:13 +00:00
|
|
|
# TODO: the goal is for this to be empty
|
2021-07-13 06:23:36 +00:00
|
|
|
[[tool.mypy.overrides]]
|
2021-11-25 10:27:13 +00:00
|
|
|
# the list can be generated with:
|
2022-07-13 21:15:28 +00:00
|
|
|
# mypy --no-error-summary 2>&1 | tr ':' ' ' | awk '{print $1}' | sort | uniq | sed 's/\.py//g; s|src/||g; s|\/|\.|g' | xargs -I {} echo '"{}",'
|
2021-07-13 06:23:36 +00:00
|
|
|
module = [
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.api.http_methods",
|
|
|
|
"lightning.app.api.request_types",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.cli.cmd_install",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.cli.commands.app_commands",
|
[App] Introduce Lightning Storage Commands (#16606)
* update
* update
* update
* update
* update
* update
* update
* update
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* [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
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* update
* update
* update
* [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
* update
* update
* update
* update
* [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
* update
* update
* update
* [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
* update
* update
* [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
* update
* update
* update
* update
* update
* [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
* update
* update
* update
---------
Co-authored-by: thomas <thomas@thomass-MacBook-Pro.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-03 09:28:24 +00:00
|
|
|
"lightning.app.cli.commands.cd",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.cli.commands.cp",
|
|
|
|
"lightning.app.cli.commands.ls",
|
|
|
|
"lightning.app.cli.connect.app",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.components.database.client",
|
|
|
|
"lightning.app.components.database.server",
|
|
|
|
"lightning.app.components.database.utilities",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.components.multi_node.base",
|
|
|
|
"lightning.app.components.multi_node.fabric",
|
|
|
|
"lightning.app.components.multi_node.pytorch_spawn",
|
|
|
|
"lightning.app.components.multi_node.trainer",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.components.python.popen",
|
|
|
|
"lightning.app.components.python.tracer",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.components.serve.auto_scaler",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.components.serve.gradio_server",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.components.serve.python_server",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.components.serve.serve",
|
|
|
|
"lightning.app.components.serve.streamlit",
|
|
|
|
"lightning.app.components.serve.types.image",
|
|
|
|
"lightning.app.components.serve.types.type",
|
|
|
|
"lightning.app.components.training",
|
|
|
|
"lightning.app.frontend.panel.app_state_comm",
|
|
|
|
"lightning.app.frontend.panel.app_state_watcher",
|
|
|
|
"lightning.app.frontend.panel.panel_frontend",
|
|
|
|
"lightning.app.frontend.panel.panel_serve_render_fn",
|
|
|
|
"lightning.app.frontend.streamlit_base",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.frontend.stream_lit",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.frontend.utils",
|
|
|
|
"lightning.app.frontend.web",
|
2023-10-24 12:11:54 +00:00
|
|
|
"lightning.app.launcher.launcher",
|
|
|
|
"lightning.app.launcher.lightning_backend",
|
|
|
|
"lightning.app.launcher.lightning_hybrid_backend",
|
2023-07-31 16:05:21 +00:00
|
|
|
"lightning.app.pdb.pdb",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.runners.backends.backend",
|
|
|
|
"lightning.app.runners.backends.cloud",
|
|
|
|
"lightning.app.runners.backends.docker",
|
|
|
|
"lightning.app.runners.backends.mp_process",
|
|
|
|
"lightning.app.runners.cloud",
|
|
|
|
"lightning.app.runners.multiprocess",
|
|
|
|
"lightning.app.runners.runtime",
|
|
|
|
"lightning.app.source_code.copytree",
|
|
|
|
"lightning.app.source_code.hashing",
|
|
|
|
"lightning.app.source_code.local",
|
|
|
|
"lightning.app.source_code.tar",
|
|
|
|
"lightning.app.source_code.uploader",
|
|
|
|
"lightning.app.storage.copier",
|
|
|
|
"lightning.app.storage.drive",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.app.storage.filesystem",
|
2023-02-01 05:29:16 +00:00
|
|
|
"lightning.app.storage.orchestrator",
|
|
|
|
"lightning.app.storage.path",
|
|
|
|
"lightning.app.storage.payload",
|
|
|
|
"lightning.app.structures.dict",
|
|
|
|
"lightning.app.structures.list",
|
|
|
|
"lightning.app.testing.helpers",
|
|
|
|
"lightning.app.testing.testing",
|
|
|
|
"lightning.app.utilities.app_helpers",
|
|
|
|
"lightning.app.utilities.app_logs",
|
|
|
|
"lightning.app.utilities.cli_helpers",
|
|
|
|
"lightning.app.utilities.cloud",
|
|
|
|
"lightning.app.utilities.commands.base",
|
|
|
|
"lightning.app.utilities.component",
|
|
|
|
"lightning.app.utilities.enum",
|
|
|
|
"lightning.app.utilities.exceptions",
|
|
|
|
"lightning.app.utilities.git",
|
|
|
|
"lightning.app.utilities.imports",
|
|
|
|
"lightning.app.utilities.introspection",
|
|
|
|
"lightning.app.utilities.layout",
|
|
|
|
"lightning.app.utilities.load_app",
|
|
|
|
"lightning.app.utilities.log_helpers",
|
|
|
|
"lightning.app.utilities.login",
|
|
|
|
"lightning.app.utilities.name_generator",
|
|
|
|
"lightning.app.utilities.network",
|
|
|
|
"lightning.app.utilities.openapi",
|
|
|
|
"lightning.app.utilities.packaging.cloud_compute",
|
|
|
|
"lightning.app.utilities.packaging.lightning_utils",
|
|
|
|
"lightning.app.utilities.proxies",
|
|
|
|
"lightning.app.utilities.scheduler",
|
|
|
|
"lightning.app.utilities.state",
|
|
|
|
"lightning.app.utilities.tracer",
|
|
|
|
"lightning.app.utilities.tree",
|
2023-03-02 19:12:14 +00:00
|
|
|
"lightning.store.utils",
|
2021-07-13 06:23:36 +00:00
|
|
|
]
|
|
|
|
ignore_errors = "True"
|
2023-01-19 11:59:00 +00:00
|
|
|
|
2023-01-19 16:48:28 +00:00
|
|
|
|
2023-01-19 11:59:00 +00:00
|
|
|
[tool.coverage.report]
|
|
|
|
exclude_lines = [
|
|
|
|
"pragma: no cover",
|
|
|
|
"warnings",
|
|
|
|
"pass",
|
|
|
|
"rank_zero_warn",
|
|
|
|
"raise NotImplementedError",
|
|
|
|
]
|
|
|
|
|
2023-01-19 16:48:28 +00:00
|
|
|
|
2023-01-19 11:59:00 +00:00
|
|
|
[tool.pytest.ini_options]
|
|
|
|
norecursedirs = [
|
|
|
|
".git",
|
|
|
|
".github",
|
|
|
|
"dist",
|
|
|
|
"build",
|
|
|
|
"docs",
|
|
|
|
]
|
2023-01-26 09:28:30 +00:00
|
|
|
addopts = [
|
|
|
|
"--strict-markers",
|
|
|
|
"--doctest-modules",
|
|
|
|
"--color=yes",
|
|
|
|
"--disable-pytest-warnings",
|
|
|
|
"--ignore=legacy/checkpoints",
|
|
|
|
]
|
2023-01-19 11:59:00 +00:00
|
|
|
markers = [
|
2023-12-13 19:27:49 +00:00
|
|
|
"cloud: Run the cloud tests for example",
|
2023-01-19 11:59:00 +00:00
|
|
|
]
|
|
|
|
filterwarnings = [
|
|
|
|
"error::FutureWarning",
|
|
|
|
]
|
|
|
|
xfail_strict = true
|
|
|
|
junit_duration_report = "call"
|