Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Borda
Copy link
Member

@Borda Borda commented Sep 3, 2025

What does this PR do?

reduce dependencies and since pytorch is already based on jsonargparse, there is no need for click

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--21150.org.readthedocs.build/en/21150/

@github-actions github-actions bot added fabric lightning.fabric.Fabric dependencies Pull requests that update a dependency file labels Sep 3, 2025
Copy link
Contributor

github-actions bot commented Sep 3, 2025

⛈️ Required checks status: Has failure 🔴

Warning
This job will need to be re-run to merge your PR. If you do not have write access to the repository, you can ask Lightning-AI/lai-frameworks to re-run it. If you push a new commit, all of CI will re-trigger.

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu-guardian success

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py.

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) (testing Lightning | latest) success
pytorch-lightning (GPUs) (testing PyTorch | oldest) success
pytorch-lightning (GPUs) (testing PyTorch | latest) success

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py.

🔴 pytorch_lightning: Benchmarks
Check ID Status
lightning.Benchmarks failure

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py.

🟢 fabric: Docs
Check ID Status
docs-make (fabric, doctest) success
docs-make (fabric, html) success

These checks are required after the changes to src/lightning/fabric/cli.py, requirements/fabric/test.txt.

🟢 pytorch_lightning: Docker
Check ID Status
build-cuda (3.10, 2.1.2, 12.1.1) success
build-cuda (3.11, 2.2.2, 12.1.1) success
build-cuda (3.11, 2.3.1, 12.1.1) success
build-cuda (3.11, 2.4.1, 12.1.1) success
build-cuda (3.12, 2.5.1, 12.1.1) success
build-cuda (3.12, 2.6.0, 12.4.1) success
build-pl (3.10, 2.1, 12.1.1) success
build-pl (3.11, 2.2, 12.1.1) success
build-pl (3.11, 2.3, 12.1.1) success
build-pl (3.11, 2.4, 12.1.1) success
build-pl (3.12, 2.5, 12.1.1) success
build-pl (3.12, 2.6, 12.4.1) success
build-pl (3.12, 2.7, 12.6.3) success
build-pl (3.12, 2.8, 12.6.3, true) success

These checks are required after the changes to requirements/fabric/test.txt.

🔴 lightning_fabric: CPU workflow
Check ID Status
fabric-cpu-guardian failure

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py, tests/tests_fabric/test_cli.py.

🔴 lightning_fabric: Azure GPU
Check ID Status
lightning-fabric (GPUs) (testing Fabric | oldest) failure
lightning-fabric (GPUs) (testing Fabric | latest) failure
lightning-fabric (GPUs) (testing Lightning | latest) success

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py, tests/tests_fabric/test_cli.py.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to requirements/fabric/test.txt, src/lightning/fabric/cli.py.

🟢 install
Check ID Status
install-pkg-guardian success

These checks are required after the changes to src/lightning/fabric/cli.py, requirements/fabric/test.txt.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@Borda Borda requested a review from Copilot September 3, 2025 07:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the Click-based CLI implementation with jsonargparse, aligning with PyTorch's CLI approach while reducing dependencies. The change introduces a class-based CLI structure that provides the same functionality through jsonargparse's ArgumentParser.

Key changes:

  • Replace Click dependency with jsonargparse[signatures] for CLI argument parsing
  • Restructure CLI from function-based to class-based architecture using FabricCLI
  • Update test requirements to use jsonargparse instead of Click

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lightning/fabric/cli.py Complete rewrite from Click to jsonargparse with new FabricCLI class structure
requirements/fabric/test.txt Replace Click dependency with jsonargparse[signatures] requirement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 163 to 164
"--output_file",
type=str,
Copy link
Preview

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original Click validation type=click.Path(exists=True) for output_file has been removed, but output files should typically NOT exist (they're being created). The original validation logic appears incorrect and this change fixes it, but the help text still mentions 'The file should not already exist' without enforcement.

Copilot uses AI. Check for mistakes.

Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 27.86885% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 81%. Comparing base (04e103b) to head (3d64840).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

❗ There is a different number of reports uploaded between BASE (04e103b) and HEAD (3d64840). Click for more details.

HEAD has 108 uploads less than BASE
Flag BASE (04e103b) HEAD (3d64840)
cpu 54 27
python 6 3
lightning_fabric 14 2
pytest 30 3
lightning 31 16
python3.11 12 6
python3.12 6 3
python3.10 12 6
python3.12.7 18 9
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #21150     +/-   ##
=========================================
- Coverage      87%      81%     -6%     
=========================================
  Files         269      269             
  Lines       23595    23627     +32     
=========================================
- Hits        20581    19127   -1454     
- Misses       3014     4500   +1486     

@Borda Borda changed the title fabric: unify CLI with jsonargparse fabric: unify CLI with jsonargparse [wip] Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file fabric lightning.fabric.Fabric
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant