Giter VIP home page Giter VIP logo

Comments (11)

dkrystki avatar dkrystki commented on May 28, 2024 1

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.

from reloadium.

dkrystki avatar dkrystki commented on May 28, 2024

Are you sure you're running it under 3.12? 3.12 is not supported yet.

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

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

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

Have been googling for the last hour and haven't found anyone else mention this problem or how to resolve it, any tips?

from reloadium.

dkrystki avatar dkrystki commented on May 28, 2024

Correct usage would be:

from typing import Set
buttons: Set[int]

I'm closing this since it's not related to Reloadium

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

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.

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

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.

from reloadium.

dkrystki avatar dkrystki commented on May 28, 2024

I see what you mean but I can't reproduce it.

2024-02-28_23:33:44

Can you provide a reproducer?

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

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

image

From what I gather your parser needs to be doing two things:

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.

from reloadium.

th3w1zard1 avatar th3w1zard1 commented on May 28, 2024

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

from reloadium.

dkrystki avatar dkrystki commented on May 28, 2024

Fixed in Reloadium 1.4.1 and PyCharm plugin 1.4.1

from reloadium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.