-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Complete type annotations in pip/_internal/cli #10065
Complete type annotations in pip/_internal/cli #10065
Conversation
This is the second part of my job made on pypa#10018, where I must complete all the annotations from `pip/_internal/cli`.
This is the news file for my pull request.
I just changed one function annotations, on line 121.
Just update the annotations according to the CI last failure.
I wanted to use "RequirementPreparer", not "RequirementParser".
Hi. Now I have a huge question. On the last changes to
I just can't see where my mistake is. Can somebody help me? |
pip/_internal/cli
pip/_internal/cli
You need to look a bit further up in the output:
So you had some trailing whitespace, and also your layout wasn't correct according to black. Edit: Unfortunately, black doesn't tell you what was wrong, it just fixes it for you and leaves you to do a diff if you want to know. Don't get me started on this... 🙂 |
Hum... this is confusing. So, what can I do now? |
Fix the trailing whitespace issue and run black locally on your code, then push the changes. |
Ok. I will be working on it for this week.
Could you please give me the page? It can help me to solve this problem 😄. |
Well, if somebody else can test my problem at the same time than me, and finds where the problem is, please comment it. Also you can push the changes to my branch |
Sorry! I messed up the Markdown for links. It's at https://pip.pypa.io/en/latest/development/getting-started/#running-linters |
Oh, don't worry 😄. |
Ok. By now, I will be trying to solve this problem, but anyone else can try to help me. (And thanks, @pfmoore. The article you commented was useful for me). |
After a long test (cloning my own fork, running
What do you think about this? Where is the problem? |
def _build_session(
- self,
- options: Values,
- retries: Optional[int] = None,
- timeout: Optional[int] = None
+ self,
+ options: Values,
+ retries: Optional[int] = None,
+ timeout: Optional[int] = None,
) -> PipSession: There’s a missing comma at the end of the - ) -> RequirementPreparer:
+ ) -> RequirementPreparer: There’s a trailing whitespace at the end (difficult to find if you just read the code on GitHub). |
Understood. Thank you very much. I will take that in count for today. |
There were some previous errors with this, but now I fixed them.
It is not exactly a problem, it's just to pass the CI.
They fail on the CI checks.
Done. The |
Convert type commentaries into annotations.
Or maybe you can review the changes before merging. |
Fix also the original annotation instead of just copying it. Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Some of the annotations were incorrect.
It is "self._session: Optional[PipSession] = None" instead of "self._session = None # type: Optional[PipSession]".
They were imported but unused.
One of them was incorrect.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@uranusjr, @pfmoore and I were talking about Mypy is not giving any error message with some "evident" fails. You can see it on the last 2 reviews:
However, I consider this is an issue with Mypy, not with Pip. If you want, I can open an issue with python/mypy to discuss this. If someone wants to do it, tell me first. |
Well. Everything's done by now. If any @pypa member wants to merge this, just do it. Thank you for all your help. |
Hi @uranusjr, could you merge this PR? Or, can someone do it? Remember that I can't do it (GitHub restricted merging for me 😅) About the Mypy issue, maybe we can open an issue over there and discuss on a larger way. (Or just update Mypy version to a new one, I don't know). |
Why is the |
Checks sometimes fail like that, you know, networking glitches and things like that. |
Re-triggering builds. |
Thanks. Now, we can safely merge. |
pip/_internal/cli
Thanks @uranusjr! |
This is the second part of my job made on #10018, where I must complete all the annotations from
pip/_internal/cli
.