-
Notifications
You must be signed in to change notification settings - Fork 767
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
Alternative syntax for unions requires Python 3.10 or newer error ... but only in Jupyter notebooks #3376
Comments
Can you please reproduce the issue (in a |
I can't reproduce in a The "Python Language Server" shows nothing ... here is what Jupyter log returns:
|
Sorry, not sure how I misread that. Do you have |
No. |
|
Oh, you are correct: microsoft/pyright@b881f28 I didn't realize that Looks like the problem is that with |
I'd hate to have to duplicate the import in every cell as I use type hints
extensively.
This behavior is new as it was working fine a few weeks ago. Is there any
way I can get it working like before? Lmk. Thanks again.
…On Fri, Sep 23, 2022, 3:44 PM Erik De Bonte ***@***.***> wrote:
1. "Python 3.9.13" (my understanding is that the from __future__
import annotations would pull that feature used in 3.10).
Oh, you are correct: ***@***.***
<microsoft/pyright@b881f28>
I didn't realize that from __future__ import annotations enabled anything
other than PEP 563
<https://peps.python.org/pep-0563/#enabling-the-future-behavior-in-python-3-7>
.
Looks like the problem is that with "python.pylanceLspNotebooksEnabled":
true, from __future__ import annotations only applies to the cell it is
in. As a workaround, you could duplicate the import.
—
Reply to this email directly, view it on GitHub
<#3376 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADNMEVO4UF3GFSA5SN2DTV7YXEJANCNFSM6AAAAAAQSPTUOE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You could set LSP notebooks are the new default (which is probably why you noticed this change in behavior) and we're planning to remove the old, concatenated document behavior in the near future. So, it's unlikely that we would fix any issues you encountered in that mode. But I suppose it might give you some temporary relief. I'm already looking into fixing this issue for what it's worth. |
For future reference, here's Eric Traut's explanation of why the alternative union syntax is available (in some scenarios) with
|
Thanks for the info and thanks for looking into a fix! Much appreciated! |
This will be fixed in next week's Pylance pre-release build. |
Cool.
Thanks for the quick turnaround
- wg
…On Fri, Sep 30, 2022 at 10:27 AM Erik De Bonte ***@***.***> wrote:
This will be fixed in next week's Pylance pre-release build.
—
Reply to this email directly, view it on GitHub
<#3376 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADNMHDIUH3B5LSXSB2PDLWA4PGZANCNFSM6AAAAAAQSPTUOE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This issue has been fixed in prerelease version 2022.10.11, which we've just released. You can find the changelog here: CHANGELOG.md |
@joe733 this issue is closed, please open new issue. |
Environment data:
pylance version: 2022.9.30
vscode version: 1.71.2
python version: 3.9/13
OS platform: Ubuntu 18.04
Code:
Problem:
In my .py files, this parameter defintion reports no problem and Black formats it so that it looks like the above.
However, pylance reports a problem with the syntax in Juypter notebooks ...
Alternative syntax for unions requires Python 3.10 or newer
. Further, when I format the cell (using Black), it mucks with the formatting so that it looks like this:Lmk if you all need anything else. Thanks!
The text was updated successfully, but these errors were encountered: