ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

Add arguments to the compiler to make certain functions easier

Open Lamparter opened this issue 9 months ago • 1 comments

It would be nice to be able to compile some things automatically as input to the compiler rather than copying the same thing into each file.

Rather than putting

import clr
clr.AddReference("bla bla bla")
from whatever import foo

I might want to add these as arguments to the IronPython compiler so that they don't need to be in every file.

This will make it easier to support PackageReference via the IronPython SDK and other features.

Lamparter avatar Mar 26 '25 22:03 Lamparter

I might want to add these as arguments to the IronPython compiler so that they don't need to be in every file.

I assume you mean adding a command-line argument specifying a Python file with those (or any other) commands, to be prepended to every compiled file. Sort of an equivalent of #include in C. Yes, this sounds like a good idea. I thought that this was already possible, but I don't see it anywhere in the compiler options.

OTOH, once the compiler can do it, why not the regular interpreter? After all, you may want to debug/test the project under the interpreter as well. And once it is supported by the interpreter, there is already an option to pass arguments to the compiler that are defined for the interpreter.

BCSharp avatar Mar 29 '25 03:03 BCSharp