-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3315 from hiro-o918/master
Implement mypy plugin for `luigi.Task`
- Loading branch information
Showing
16 changed files
with
623 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Mypy plugin | ||
-------------- | ||
|
||
Mypy plugin provides type checking for ``luigi.Task`` using Mypy. | ||
|
||
Require Python 3.8 or later. | ||
|
||
How to use | ||
~~~~~~~~~~ | ||
|
||
Configure Mypy to use this plugin by adding the following to your ``mypy.ini`` file: | ||
|
||
.. code:: ini | ||
[mypy] | ||
plugins = luigi.mypy | ||
or by adding the following to your ``pyproject.toml`` file: | ||
|
||
.. code:: toml | ||
[tool.mypy] | ||
plugins = ["luigi.mypy"] | ||
Then, run Mypy as usual. | ||
|
||
Examples | ||
~~~~~~~~ | ||
|
||
For example the following code linted by Mypy: | ||
|
||
.. code:: python | ||
import luigi | ||
class MyTask(luigi.Task): | ||
foo: int = luigi.IntParameter() | ||
bar: str = luigi.Parameter() | ||
MyTask(foo=1, bar='2') # OK | ||
MyTask(foo='1', bar='2') # Error: Argument 1 to "Foo" has incompatible type "str"; expected "int" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.