scarletcafe / jishaku

A debugging and testing cog for discord.py rewrite bots.
https://jishaku.readthedocs.io/en/latest/
MIT License
543 stars 182 forks source link

Incorporate import_expression logic into jishaku. #231

Closed Sachaa-Thanasius closed 6 months ago

Sachaa-Thanasius commented 7 months ago

Rationale

import_expression is effectively unmaintained and isn't functional on python3.12 (according the issue linked below). The new logic should be functional on 3.8+.

Closes #228.

Summary of changes made

Adds a token stream transformer and AST transformer and incorporates them into a parse function with the same signature as ast.parse to achieve a similar end result to import_expression.parse. Also added tests, mostly sourced from import_expression and modified to account for the different and much smaller API surface.

Checklist

Sachaa-Thanasius commented 7 months ago

Regarding the remaining points:

@Gorialis

Sachaa-Thanasius commented 7 months ago

On a tangential note: it was mentioned in the related issue that the inline import feature should pass "the litmus test" on 3.8-3.12, but in the overall tracking issue for the next release (#212), it was also mentioned that jishaku would get a bump to 3.10. Is the latter still true, and if so, do I only have to care about this being compatible with 3.10+?

Sachaa-Thanasius commented 6 months ago

Since ioistired is back, I'll close this PR once upstream has been fixed.