Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for functions to be parsed by the Lightning CLI in addition to Types #8400

Merged
merged 19 commits into from
Jul 26, 2021

Conversation

ethanwharris
Copy link
Member

@ethanwharris ethanwharris commented Jul 13, 2021

What does this PR do?

Adds support for functions (e.g. classmethods) to be provided to the CLI in addition to types.
Needed for FlashCLI where we have data modules created from clasmethods

Does your PR introduce any breaking changes ? If yes, please list them.

Before submitting

  • Was this discussed/approved 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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)
  • Did you list all the breaking changes introduced by this pull request?

PR review

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

  • 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

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #8400 (771613f) into master (b7dbcc3) will decrease coverage by 0%.
The diff coverage is 92%.

@@          Coverage Diff           @@
##           master   #8400   +/-   ##
======================================
- Coverage      88%     88%   -0%     
======================================
  Files         218     218           
  Lines       14401   14390   -11     
======================================
- Hits        12680   12669   -11     
  Misses       1721    1721           

@ethanwharris ethanwharris marked this pull request as draft July 13, 2021 18:41
@ethanwharris ethanwharris marked this pull request as ready for review July 13, 2021 19:40
@awaelchli awaelchli added this to the v1.5 milestone Jul 14, 2021
@awaelchli awaelchli added feature Is an improvement or enhancement argparse (removed) Related to argument parsing (argparse, Hydra, ...) labels Jul 14, 2021
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
@mergify mergify bot removed the has conflicts label Jul 14, 2021
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
@carmocca
Copy link
Contributor

carmocca commented Jul 14, 2021

There are some mypy complains to address

@ethanwharris
Copy link
Member Author

@carmocca Yeah, mypy wasn't picking up inspect.isclass for some reason. Fixed now 😃

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

tests/utilities/test_cli.py Outdated Show resolved Hide resolved
tests/utilities/test_cli.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/cli.py Show resolved Hide resolved
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/cli.py Outdated Show resolved Hide resolved
@mergify mergify bot added ready PRs ready to be merged has conflicts labels Jul 19, 2021
@mergify mergify bot removed the has conflicts label Jul 21, 2021
@ethanwharris
Copy link
Member Author

@mauvilsa thanks for the updates 😃 I've updated the PR with the required changes, mind taking another look?

@mergify mergify bot removed the has conflicts label Jul 22, 2021
pytorch_lightning/utilities/cli.py Show resolved Hide resolved
tests/utilities/test_cli.py Outdated Show resolved Hide resolved
@tchaton tchaton merged commit 52526c2 into master Jul 26, 2021
@tchaton tchaton deleted the feature/cli_function_support branch July 26, 2021 08:53
@carmocca carmocca modified the milestones: v1.5, v1.4 Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
argparse (removed) Related to argument parsing (argparse, Hydra, ...) feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants