Closed th3w1zard1 closed 2 months ago
Are you sure you're running it under 3.12? 3.12 is not supported yet.
Whoops, sorry I'm a bit new to pycharm. Looks like I'm running python 3.8 with from __future__ import annotations
at the top of my script
Have been googling for the last hour and haven't found anyone else mention this problem or how to resolve it, any tips?
Correct usage would be:
from typing import Set
buttons: Set[int]
I'm closing this since it's not related to Reloadium
In my opinion this is definitely a bug. I'm using a supported version of python (according to your docs) and I'm getting undesirable behavior due to perfectly acceptable python typing. If this doesn't intend to be supported, perhaps it could be documented somewhere at least?
from typing import Set
buttons: Set[int]
You've shown an example of the old-style annotations,
The annotation style (lowercase set) is perfectly acceptable in python 3.8 if you import from __future__ import annotations
at the top of your script.
To add, we have a library of hundreds of python scripts using the future annotation syntax. To my knowledge I don't believe there's a tool that'll auto downgrade to the old style. I know tools like Ruff and pyupgrade will automatically convert to future annotations however.
I see what you mean but I can't reproduce it.
Can you provide a reproducer?
I was struggling to get consistent results, as there didn't seem to be a command to get Reloadium to simply just try to parse a single file. After a bit of experimentation, I finally was able to get it to throw an error in a script consistently, without any non-builtin dependencies.
https://github.com/NickHugi/PyKotor/blob/master/Libraries/Utility/src/utility/system/path.py
From what I gather your parser needs to be doing two things:
from __future__ import annotations
is at the top of the file.It might be easier to import something like ruff/pylint to do quick checks like this. Another potential idea is to expose a checkbox in the settings to disable Reloadium's syntax checks. In my scenario, the only thing I want Reloadium to do is reload the changed code/affected modules: I couldn't care less about whether it finds an error in the code.
In the above example, I have the following import structure, compliant with PEP 563
from __future__ import annotations
import contextlib
import os
import pathlib
import re
import subprocess
import sys
import uuid
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Any, Union
from utility.error_handling import format_exception_with_variables
if TYPE_CHECKING:
from collections.abc import Callable, Generator
from typing_extensions import Self
I still can't reproduce it but you're right, there is some custom logic around parsing future imports. I'll have a look into that.
Fixed in Reloadium 1.4.1 and PyCharm plugin 1.4.1
Describe the bug*
I am constantly getting errors due to static typing
This seems to be an issue with python 3.11-style annotations. I'm using python
3.123.8.10 yet it's still giving me errors due to annotation style. Anytime I save. It's quite obnoxious and it doesn't seem to be possible in the settings to disable.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Actual parsing of python 3.11 annotations. At the very least, a way to disable it's error check routine.
Screenshots
Desktop or remote (please complete the following information):**
3.12.23.8.10Additional Context:
I remember experiencing this a few times unrelated to this plugin when I've used older versions of python and forgot to import
from __future__ import annotations
. The error messages reloadium is giving me look quite similar to that scenario.