Skip to content
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

[Tracking] import_expression doesn't function correctly in 3.12 #228

Closed
Gorialis opened this issue Mar 5, 2024 · 3 comments · Fixed by #234
Closed

[Tracking] import_expression doesn't function correctly in 3.12 #228

Gorialis opened this issue Mar 5, 2024 · 3 comments · Fixed by #234

Comments

@Gorialis
Copy link
Owner

Gorialis commented Mar 5, 2024

import_expression does spooky AST magic to get imports to be inlined through a specialized syntax: module!.

This doesn't work anymore in 3.12 due to parser changes within Python, need to think if there is a sensible solution.

@Sachaa-Thanasius
Copy link

Sachaa-Thanasius commented Apr 7, 2024

Would you prefer fixing the upstream package or redoing the logic internally? I ask because I’ve written a proof of concept for a shorter version of the same functionality. It isn’t as rigorously tested as import_expression currently but seemingly works on 3.10-3.12 and isn’t as complex. It’s few enough lines of code that you could probably maintain your own version of a similar code transformer within jishaku. I’d be willing to help with that as well (if needed) depending on what your plan is moving forward.

@Gorialis
Copy link
Owner Author

Gorialis commented Apr 7, 2024

Jishaku was originally going to have this feature be internal anyway. The main reason why it's in another package is because at some point I rambled about what my requirements and vision for the feature was publicly, and the maintainer took it as a challenge and built it as a standalone package so that it could be reused.

Unfortunately, I don't have a good conventional means of communication with the maintainer anymore, and even back when I did they were increasingly inactive as time went on. While fixing it upstream would probably be for the best (because it would retroactively fix old jishaku versions), it's coming up on 4 years since the last import_expression update, so a PR to it might not even be acknowledged and I think it's safe to consider the package unmaintained.

I'd gladly merge any PRs that can handle the behavior on 3.12 as long as it passes the litmus test on 3.8-3.12 and doesn't break tracebacks or submodule resolution (e.g. discord.utils!.snowflake_time should work)

@ioistired
Copy link
Contributor

Hi, I'm active again and am working on fixing this upstream.

ioistired added a commit to ioistired/jishaku that referenced this issue May 27, 2024
ioistired added a commit to ioistired/jishaku that referenced this issue May 27, 2024
Gorialis pushed a commit that referenced this issue May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants