Replies: 1 comment
-
RustPython supports a lot of features of importlib. The projects looks like using importlib. It will be worth to try. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I want to use rustpython as my scripting engine, but with some simple syntax extension. I want to do it with a preprocessor, so that I don't need to modify rustpython's parser.
I can ask users to name their source code with a special extension name to indicate that the file contains extended syntax. For example,
test.py
is a normal python file, andtest.mypy
is an extended python file.if it is an extended python file, I will first run my preprocessor to translate it into a normal python and then run rustpython.
But if the
mypy
file imports anothermypy
file, how can I run the preprocessor before importing?An idea is using the import hook as mentioned here https://aroberge.github.io/ideas/docs/html/
I wonder if this can be achieved using rustpython? i.e. is there a callback right before importing a file so that I can intercept and modify the imported code.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions