From bf29aa482af0f95bfc35becaf92e2279a0642dd2 Mon Sep 17 00:00:00 2001 From: jirka <6035284+Borda@users.noreply.github.com> Date: Thu, 26 Mar 2026 11:47:45 +0100 Subject: [PATCH 1/5] Update contributor docs: CoC 2.1, completeness, link fixes - Upgrade CODE_OF_CONDUCT.md from Contributor Covenant 1.4 to 2.1 (tiered enforcement ladder, expanded pledge) - Add project conventions section to CONTRIBUTING.md (line length, Ruff rules, MyPy, rank_zero_*, callback hook convention) - Add two-package architecture overview and Python 3.9+ requirement to CONTRIBUTING.md - Fix broken/dead links in CONTRIBUTING.md and PULL_REQUEST_TEMPLATE.md - Rewrite tests/README.md: test layout tree, RunIf decorator, markers, standalone tests, coverage commands for both packages --- Co-authored-by: Claude Code --- .github/CODE_OF_CONDUCT.md | 99 ++++++++++---------- .github/CONTRIBUTING.md | 84 +++++++++++++++-- .github/PULL_REQUEST_TEMPLATE.md | 4 +- tests/README.md | 152 ++++++++++++++++++++++--------- 4 files changed, 238 insertions(+), 101 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 02c1e0b356a62..778d0f919a427 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -2,73 +2,78 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socioeconomic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards -Examples of behavior that contributes to creating a positive environment -include: +Examples of behavior that contributes to a positive environment for our community include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community -Examples of unacceptable behavior by participants include: +Examples of unacceptable behavior include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks - Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting +- Publishing others' private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +## Enforcement Responsibilities -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at community@lightning.ai. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at community@lightning.ai. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, +available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a1f280a185b1b..d3401e07a90cd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -3,7 +3,7 @@ Welcome to the PyTorch Lightning community! We're building the most advanced research platform on the planet to implement the latest, best practices and integrations that the amazing PyTorch team and other research organization rolls out! -If you are new to open source, check out [this blog to get started with your first Open Source contribution](https://medium.com/pytorch-lightning/quick-contribution-guide-86d977171b3a). +If you are new to open source, check out [GitHub's guide to contributing to open source projects](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project). ## Main Core Value: One less thing to remember @@ -103,7 +103,7 @@ _**Note**, even if you do not find the solution, sending a PR with a test coveri Want to keep Lightning healthy? Love seeing those green tests? So do we! How to we keep it that way? We write tests! We value tests contribution even more than new features. -Most of the tests in PyTorch Lightning train a random `BoringModel` under various trainer conditions (ddp, amp, etc...). Want to add a new test case and not sure how? [Talk to us!](https://www.pytorchlightning.ai/community) +Most of the tests in PyTorch Lightning train a random `BoringModel` under various trainer conditions (ddp, amp, etc...). Want to add a new test case and not sure how? [Join us on Discord!](https://discord.gg/VptPCZkGNa) ______________________________________________________________________ @@ -111,6 +111,15 @@ ______________________________________________________________________ ### Development environment +**Python version**: Python 3.9 or newer is required (the project targets `py39` in its lint/type configs). + +**Repository layout**: this repo contains two distinct packages under the `lightning` namespace: + +- **Lightning Fabric** (`src/lightning/fabric/`) — low-level distributed primitives; users keep their own training loops +- **PyTorch Lightning** (`src/lightning/pytorch/`) — high-level `Trainer`/`LightningModule` framework built on top of Fabric + +There are also thin backward-compatibility shims at `src/pytorch_lightning/` and `src/lightning_fabric/` that re-export from the canonical locations above. Keep these in sync when adding public APIs. + To set up a local development environment, we recommend using `uv`, which can be installed following their [instructions](https://docs.astral.sh/uv/getting-started/installation/). Once `uv` has been installed, begin by cloning the forked repository: @@ -155,11 +164,12 @@ If you would like more information regarding the uv commands, please refer to uv ### Developments scripts -To build the documentation locally, simply execute the following commands from project root (only for Unix): +To build the documentation locally, execute the following from the project root (Unix only): -- `make clean` cleans repo from temp/generated files -- `make docs` builds documentation under _docs/build/html_ -- `make test` runs all project's tests with coverage +- `make clean` — cleans repo from temp/generated files +- `make docs-pytorch` — builds PyTorch Lightning docs under `docs/source-pytorch/` +- `make docs-fabric` — builds Lightning Fabric docs under `docs/source-fabric/` +- `make test` — runs all project tests with coverage (both packages) ### Original code @@ -169,8 +179,66 @@ In case you are adding new dependencies, make sure that they are compatible with ### Coding Style -1. Use f-strings for output formation (except logging when we stay with lazy `logging.info("Hello %s!", name)`). -1. You can use [pre-commit](https://pre-commit.com/) to make sure your code style is correct. +1. Use f-strings for output formation (except logging, where we stay with lazy `logging.info("Hello %s!", name)`). +1. Run `pre-commit run --all-files` to check and auto-fix style before pushing. + +### Project Conventions + +These are enforced by CI — familiarise yourself with them before your first PR. + +#### Line length + +120 characters. Configured in `pyproject.toml` for Ruff, Black, and Prettier. + +#### Linting and formatting + +We use [Ruff](https://docs.astral.sh/ruff/) for both linting and formatting. The active rule sets are: `E`, `W` (pycodestyle), `F` (pyflakes), `S` (bandit), `UP` (pyupgrade), `I` (isort), `C4` (flake8-comprehensions), `SIM` (flake8-simplify), `RET` (flake8-return), `PT` (flake8-pytest-style), `RUF100` (unused noqa). + +```bash +ruff check src/ tests/ # lint +ruff format src/ tests/ # format +``` + +#### Type annotations + +All public interfaces in `src/lightning/` require type annotations. MyPy is configured with `disallow_untyped_defs = true`. Run: + +```bash +mypy src/lightning/ +``` + +#### Distributed / rank-aware code + +Code that may run across multiple processes must use the rank-aware utilities from `lightning.fabric.utilities` rather than bare `print` or `warnings.warn`: + +```python +from lightning.fabric.utilities import rank_zero_info, rank_zero_warn + +rank_zero_warn("something the user should know") # warning on rank 0 only +rank_zero_info("training started") # info on rank 0 only +``` + +For logic that must execute only once per run, use the `@rank_zero_only` decorator: + +```python +from lightning.fabric.utilities.rank_zero import rank_zero_only + +@rank_zero_only +def log_hyperparams(self, params): + ... +``` + +#### Adding a new callback hook + +New training lifecycle events must be added in three places: + +1. The `Callback` base class (`src/lightning/pytorch/callbacks/callback.py`) +2. The relevant loop file in `src/lightning/pytorch/loops/` +3. `src/lightning/pytorch/trainer/connectors/callback_connector.py` + +#### Backward-compatibility policy + +We avoid breaking the public API without a proper deprecation cycle. See the "Backward-compatible API" design principle above. When replacing a public function or argument, deprecate it in a minor release and remove it in the next major. ### Documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cd784a5037525..2a1d819944d3a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,7 +7,7 @@ List any dependencies that are required for this change. If we didn't discuss your PR in Github issues there's a high chance it will not be merged. -The following links the related issue to the PR (https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) +The following links the related issue to the PR (https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) --> Fixes #\ @@ -33,7 +33,7 @@ Fixes #\ ## PR review Anyone in the community is welcome to review the PR. -Before you start reviewing, make sure you have read the [review guidelines](https://github.com/Lightning-AI/lightning/wiki/Review-guidelines). In short, see the following bullet-list: +Before you start reviewing, make sure you have read the [contributor guidelines](https://github.com/Lightning-AI/pytorch-lightning/blob/master/.github/CONTRIBUTING.md). In short, see the following bullet-list:
Reviewer checklist diff --git a/tests/README.md b/tests/README.md index e542bfb0db180..3caecc3c3f347 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,85 +1,149 @@ -# PyTorch-Lightning Tests +# PyTorch Lightning Tests -Most of the tests in PyTorch Lightning train a [BoringModel](https://github.com/Lightning-AI/pytorch-lightning/blob/master/src/lightning/pytorch/demos/boring_classes.py) under various trainer conditions (ddp, amp, etc...). Want to add a new test case and not sure how? [Talk to us!](https://www.pytorchlightning.ai/community) +Most tests in PyTorch Lightning train a [BoringModel](https://github.com/Lightning-AI/pytorch-lightning/blob/master/src/lightning/pytorch/demos/boring_classes.py) under various trainer conditions (ddp, amp, etc.). Want to add a new test case and not sure how? [Talk to us on Discord!](https://discord.gg/VptPCZkGNa) + +## Test directory layout + +``` +tests/ +├── tests_pytorch/ # Tests for PyTorch Lightning (Trainer, LightningModule, callbacks, …) +├── tests_fabric/ # Tests for Lightning Fabric (low-level distributed primitives) +├── parity_pytorch/ # Output parity checks: validates results match vanilla PyTorch +├── parity_fabric/ # Output parity checks for Fabric +└── legacy/ # Backward-compatibility tests for checkpoints from old releases +``` + +Each `tests_pytorch/` and `tests_fabric/` subtree mirrors the corresponding source layout under `src/lightning/`. ## Running tests -**Local:** Testing your work locally will help you speed up the process since it allows you to focus on particular (failing) test-cases. -To setup a local development environment, install both local and test dependencies: +### Quick setup ```bash -# clone the repo -git clone https://github.com/Lightning-AI/lightning.git -cd lightning - -# install required dependencies -export PACKAGE_NAME=pytorch -python -m pip install ".[dev, examples]" -# install pre-commit (optional) -python -m pip install pre-commit -pre-commit install +# Clone, install all dev dependencies, and configure pre-commit in one step +make setup ``` -Additionally, for testing backward compatibility with older versions of PyTorch Lightning, you also need to download all saved version-checkpoints from the public AWS storage. Run the following script to get all saved version-checkpoints: +### Run the full test suite ```bash -bash .actions/pull_legacy_checkpoints.sh +make test ``` -Note: These checkpoints are generated to set baselines for maintaining backward compatibility with legacy versions of PyTorch Lightning. Details of checkpoints for back-compatibility can be found [here](https://github.com/Lightning-AI/pytorch-lightning/tree/master/tests/legacy/README.md). +This runs both packages with coverage. Note: GPU and TPU tests are skipped automatically on machines without the required hardware. -You can run the full test suite in your terminal via this make script: +### Run tests for one package ```bash -make test +# PyTorch Lightning only +pytest tests/tests_pytorch/ -v + +# Lightning Fabric only +pytest tests/tests_fabric/ -v ``` -Note: if your computer does not have multi-GPU or TPU these tests are skipped. +### Run a single file or test -**GitHub Actions:** For convenience, you can also use your own GHActions building which will be triggered with each commit. -This is useful if you do not test against all required dependency versions. +```bash +# Single file +pytest tests/tests_pytorch/trainer/test_trainer.py -v -**Docker:** Another option is to utilize the [pytorch lightning cuda base docker image](https://hub.docker.com/r/pytorchlightning/pytorch_lightning/tags?name=cuda). You can then run: +# Single test function +pytest tests/tests_pytorch/trainer/test_trainer.py::TestClass::test_method -v -```bash -python -m pytest src/lightning/pytorch tests/tests_pytorch -v +# Match by keyword +pytest tests/tests_pytorch/ -k "test_trainer_fit" -v ``` -You can also run a single test as follows: +### Run with coverage ```bash -python -m pytest -v tests/tests_pytorch/trainer/test_trainer_cli.py::test_default_args +# PyTorch Lightning +python -m coverage run --source src/lightning/pytorch -m pytest src/lightning/pytorch tests/tests_pytorch -v +python -m coverage report -m + +# Lightning Fabric +python -m coverage run --source src/lightning/fabric -m pytest src/lightning/fabric tests/tests_fabric -v +python -m coverage report -m +``` + +## Conditional tests and the `RunIf` decorator + +Hardware- or package-gated tests use the `RunIf` helper instead of a bare `pytest.mark.skipif`: + +```python +from tests.helpers.runif import RunIf # tests_pytorch +# or +from tests.helpers.runif import RunIf # tests_fabric + +@RunIf(min_cuda_gpus=1) +def test_something_that_needs_a_gpu(): + ... + +@RunIf(min_cuda_gpus=2, standalone=True) +def test_distributed(): + ... ``` -### Conditional Tests +Common `RunIf` kwargs: + +| Kwarg | What it guards | +|---|---| +| `min_cuda_gpus=N` | at least N CUDA GPUs available | +| `min_torch="2.1"` | PyTorch >= version | +| `mps=True` | Apple Silicon (MPS) backend | +| `skip_windows=True` | skip on Windows | +| `standalone=True` | marks test as standalone (see below) | +| `deepspeed=True` | DeepSpeed installed | +| `bf16_cuda=True` | GPU supports bfloat16 | + +GPU tests require that the environment variable `RUN_ONLY_CUDA_TESTS=1` is set; this is done automatically by CI. -To test models that require GPU make sure to run the above command on a GPU machine. -The GPU machine must have at least 2 GPUs to run distributed tests. +## Standalone tests -Note that this setup will not run tests that require specific packages installed -You can rely on our CI to make sure all these tests pass. +Some distributed tests must run in a separate process to avoid interference. Mark them with `@RunIf(standalone=True)`. To run them locally: -### Standalone Tests +```bash +PL_RUN_STANDALONE_TESTS=1 pytest tests/tests_pytorch/ -v +``` -There are certain standalone tests, which you can run using: +The CI helper script can also be used: ```bash cd tests/ -wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/run_standalone_tests.sh -./tests/run_standalone_tests.sh tests_pytorch/ +bash tests_pytorch/run_standalone_tasks.sh ``` -## Running Coverage +## Pytest markers + +The only custom marker registered in `pyproject.toml` is: + +- `cloud` — tests that require cloud infrastructure (run in CI only) + +Because pytest is configured with `--strict-markers`, **any new marker must be registered** in the `[tool.pytest.ini_options] markers` list in `pyproject.toml` before it can be used. Unregistered markers cause a collection error. + +## Legacy (backward-compatibility) tests -Make sure to run coverage on a GPU machine with at least 2 GPUs. +The `legacy/` directory tests that checkpoints from older PyTorch Lightning releases can still be loaded. To pull the archived checkpoints from the public AWS storage: ```bash -# generate coverage (coverage is also installed as part of dev dependencies) -coverage run --source src/lightning/pytorch -m pytest src/lightning/pytorch tests/tests_pytorch -v +bash .actions/pull_legacy_checkpoints.sh +``` + +See [tests/legacy/README.md](legacy/README.md) for details on generating checkpoints for a new release. -# print coverage stats -coverage report -m +## Docker -# exporting results -coverage xml +You can also run tests inside the [pytorch-lightning CUDA Docker image](https://hub.docker.com/r/pytorchlightning/pytorch_lightning/tags?name=cuda): + +```bash +# PyTorch Lightning +python -m pytest src/lightning/pytorch tests/tests_pytorch -v + +# Lightning Fabric +python -m pytest src/lightning/fabric tests/tests_fabric -v ``` + +## GitHub Actions + +Each push to a fork triggers CI automatically. This is useful for testing against all required dependency versions without a local GPU. From 18657cea06ba8071921b4e6098cb85829fc59bd6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:49:40 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/CONTRIBUTING.md | 4 ++-- tests/README.md | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d3401e07a90cd..3110ac24691b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -233,8 +233,8 @@ def log_hyperparams(self, params): New training lifecycle events must be added in three places: 1. The `Callback` base class (`src/lightning/pytorch/callbacks/callback.py`) -2. The relevant loop file in `src/lightning/pytorch/loops/` -3. `src/lightning/pytorch/trainer/connectors/callback_connector.py` +1. The relevant loop file in `src/lightning/pytorch/loops/` +1. `src/lightning/pytorch/trainer/connectors/callback_connector.py` #### Backward-compatibility policy diff --git a/tests/README.md b/tests/README.md index 3caecc3c3f347..7abe866437ff0 100644 --- a/tests/README.md +++ b/tests/README.md @@ -87,15 +87,15 @@ def test_distributed(): Common `RunIf` kwargs: -| Kwarg | What it guards | -|---|---| -| `min_cuda_gpus=N` | at least N CUDA GPUs available | -| `min_torch="2.1"` | PyTorch >= version | -| `mps=True` | Apple Silicon (MPS) backend | -| `skip_windows=True` | skip on Windows | -| `standalone=True` | marks test as standalone (see below) | -| `deepspeed=True` | DeepSpeed installed | -| `bf16_cuda=True` | GPU supports bfloat16 | +| Kwarg | What it guards | +| ------------------- | ------------------------------------ | +| `min_cuda_gpus=N` | at least N CUDA GPUs available | +| `min_torch="2.1"` | PyTorch >= version | +| `mps=True` | Apple Silicon (MPS) backend | +| `skip_windows=True` | skip on Windows | +| `standalone=True` | marks test as standalone (see below) | +| `deepspeed=True` | DeepSpeed installed | +| `bf16_cuda=True` | GPU supports bfloat16 | GPU tests require that the environment variable `RUN_ONLY_CUDA_TESTS=1` is set; this is done automatically by CI. From b080a85d161a993f2f14198f757f4fa67b967fea Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Thu, 26 Mar 2026 13:57:35 +0100 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/CONTRIBUTING.md | 4 ++-- tests/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3110ac24691b9..ec058455d87f6 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -111,7 +111,7 @@ ______________________________________________________________________ ### Development environment -**Python version**: Python 3.9 or newer is required (the project targets `py39` in its lint/type configs). +**Python version**: Python 3.10 or newer is required (the project targets `py310` in its lint/type configs). **Repository layout**: this repo contains two distinct packages under the `lightning` namespace: @@ -192,7 +192,7 @@ These are enforced by CI — familiarise yourself with them before your first PR #### Linting and formatting -We use [Ruff](https://docs.astral.sh/ruff/) for both linting and formatting. The active rule sets are: `E`, `W` (pycodestyle), `F` (pyflakes), `S` (bandit), `UP` (pyupgrade), `I` (isort), `C4` (flake8-comprehensions), `SIM` (flake8-simplify), `RET` (flake8-return), `PT` (flake8-pytest-style), `RUF100` (unused noqa). +We use [Ruff](https://docs.astral.sh/ruff/) for both linting and formatting. The active rule sets are: `E`, `W` (pycodestyle), `F` (pyflakes), `S` (bandit), `UP` (pyupgrade), `I` (isort), `C4` (flake8-comprehensions), `SIM` (flake8-simplify), `RET` (flake8-return), `PT` (flake8-pytest-style), `RUF018` (assignment-in-assert), `RUF100` (unused noqa). ```bash ruff check src/ tests/ # lint diff --git a/tests/README.md b/tests/README.md index 7abe866437ff0..8658f96cf62ad 100644 --- a/tests/README.md +++ b/tests/README.md @@ -72,9 +72,9 @@ python -m coverage report -m Hardware- or package-gated tests use the `RunIf` helper instead of a bare `pytest.mark.skipif`: ```python -from tests.helpers.runif import RunIf # tests_pytorch +from tests_pytorch.helpers.runif import RunIf # tests_pytorch # or -from tests.helpers.runif import RunIf # tests_fabric +from tests_fabric.helpers.runif import RunIf # tests_fabric @RunIf(min_cuda_gpus=1) def test_something_that_needs_a_gpu(): From 871555f3957501941ce8be36920cd126a8cf8233 Mon Sep 17 00:00:00 2001 From: jirka <6035284+Borda@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:05:11 +0200 Subject: [PATCH 4/5] docs: fix standalone test script working directory in tests/README.md [resolve #2] Review comment by @Copilot (PR #21614): "These commands run run_standalone_tasks.sh from the tests/ directory, but the script explicitly assumes it is run with the working directory tests/tests_pytorch and uses relative paths that will fail otherwise." --- Co-authored-by: Claude Code --- tests/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/README.md b/tests/README.md index 8658f96cf62ad..a61c8467203c1 100644 --- a/tests/README.md +++ b/tests/README.md @@ -110,8 +110,8 @@ PL_RUN_STANDALONE_TESTS=1 pytest tests/tests_pytorch/ -v The CI helper script can also be used: ```bash -cd tests/ -bash tests_pytorch/run_standalone_tasks.sh +cd tests/tests_pytorch/ +bash run_standalone_tasks.sh ``` ## Pytest markers From 56daabdad83be990a24716163c2f8eb765de91dc Mon Sep 17 00:00:00 2001 From: jirka <6035284+Borda@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:05:37 +0200 Subject: [PATCH 5/5] docs: use relative link for CONTRIBUTING.md in PR template [resolve #5] Review comment by @Copilot (PR #21614): "Consider linking to the contributing guide in the current repo (preferably via a relative link) to avoid sending reviewers to a potentially different/outdated document." --- Co-authored-by: Claude Code --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2a1d819944d3a..6f2e13122d9a6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -33,7 +33,7 @@ Fixes #\ ## PR review Anyone in the community is welcome to review the PR. -Before you start reviewing, make sure you have read the [contributor guidelines](https://github.com/Lightning-AI/pytorch-lightning/blob/master/.github/CONTRIBUTING.md). In short, see the following bullet-list: +Before you start reviewing, make sure you have read the [contributor guidelines](CONTRIBUTING.md). In short, see the following bullet-list:
Reviewer checklist