[Python.NET] Embedding: finer control over module creation

Denis Akhiyarov denis.akhiyarov at gmail.com
Sun Apr 29 22:54:53 EDT 2018


Tom,

You may be interested in this PyScope implementation merged into pythonnet
in 2017. This is in master branch but not in any release yet.

https://github.com/pythonnet/pythonnet/pull/381

This was implemented by @yagweb (https://github.com/yagweb), who is now in
core pythonnet team.

Regarding merging PR - if this small enough change with tests (if
applicable) that don't require extensive review, then we can definitely
merge it as long as it passes Travis CI and Appveyor CI.
If this is more intrusive PR, then at least few members of core team would
need to review this.

BTW, if anyone is willing to step up with helping out on PR reviews,
mailing list management, preparing releases, then please contact me.

Thanks,
Denis


On Fri, Apr 27, 2018 at 12:06 PM, Tom Unger (eVigils) <tunger at evigils.com>
wrote:

> I’m starting on a project to embed CPython into a .NET application for
> scripting.  The application currently uses IronPython, which is falling
> behind.  Our scripting needs are fairly extensive and I’m challenged by the
> limited information I find available.  First questions are about some finer
> grain control over
>
>
>
> First, my application loads a number of scripts.  I currently use
> PythonEngine.ModuleFromString() and this works but I would like finer
> control.
>
>
>
>    1. Set the filename in call to Py_CompileString().  Current this is
>    set to “none”
>    2. Set globals for module before executing it.  I put certain values
>    in the scripts global space for convenience.
>
>
>
> PythonEngine.Compile() will compile the code but then I don’t see any way
> to *execute* the code.  Runtime.PyImport_ExecCodeModule(name, c); is not
> public.
>
>
>
> Is there a way to do this with the current API?
>
>
>
> If I fork the GIT repo, make changes that I need, are they likely to be
> incorporated?
>
>
>
> Thanks,
>
>
>
> Tom
>
>
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> https://mail.python.org/mailman/listinfo/pythondotnet
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20180429/c5c4e8e8/attachment.html>


More information about the PythonDotNet mailing list