consider adding package pythonnet to call into .net world

533 views
Skip to first unread message

Denis Akhiyarov

unread,
Feb 4, 2016, 12:54:41 AM2/4/16
to WinPython
Nowadays .NET is pre-installed on Windows and offers some nice ways to call into .NET libraries such as WPF or even Windows API.

So can I suggest to include pythonnet into WinPython like pywin32 is included?


Thanks,
Denis

Thorsten Kranz

unread,
Feb 4, 2016, 2:05:52 AM2/4/16
to WinPython

+1

Installation of python.net is rather awkward, so having it in WinPython would definitely be nice.

Greetings,
Thorsten


--
You received this message because you are subscribed to the Google Groups "WinPython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winpython+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stonebig

unread,
Feb 4, 2016, 2:13:20 PM2/4/16
to WinPython
I see cgohlke has a pythonnet-2.1.0.dev1

".0.dev1" means suffering to my ears.

Denis Akhiyarov

unread,
Feb 4, 2016, 2:23:03 PM2/4/16
to WinPython
you have beta or dev versions of mingwpy, spyder, seaborn, pyopengl in WinPython 3.4.3.7 :)

but seriously let me find out on mailing list what blocks merging dev into master.

stonebig

unread,
Feb 4, 2016, 3:01:09 PM2/4/16
to WinPython
Yes, I'm expert in suffering

Thorsten Kranz

unread,
Feb 4, 2016, 4:19:32 PM2/4/16
to WinPython

Ok, sounds promising... Looking forward to reading good news!


stonebig <stone...@gmail.com> schrieb am Do., 4. Feb. 2016 21:01:
Yes, I'm expert in suffering

--
Message has been deleted

stonebig

unread,
Feb 7, 2016, 4:50:39 PM2/7/16
to WinPython
I'm not sure of the constraints or side-benefits of using pythonnet in WinPython, a userland distro.
Can you give some demo examples of what you expect from this ?

Denis Akhiyarov

unread,
Feb 7, 2016, 7:16:29 PM2/7/16
to winp...@googlegroups.com
First of all, pythonnet can be used for both extending and embedding CPython using .NET and Mono, without any limitations of IronPython and without need for C compiler.

Then .NET multithreading can use multiple cores (see TPL), but I have not seen anyone exploring this idea.

Here is quick tutorial for pythonnet:


Here is WPF GUI example:


Also some WinForms examples here:


Some people used pythonnet to connect to SQL Server database, although I was able to use directly pymssql:


At my work I use pythonnet to call into numerical libraries for python from .NET and to call into proprietory .NET dlls from CPython.



On Sun, Feb 7, 2016 at 3:50 PM, stonebig <stone...@gmail.com> wrote:
I'm not sure of the constraints or side-benefits of using pythonnet in WinPython, a userland distro.
Can you give some demo examples of what you expect from this ?

--
You received this message because you are subscribed to a topic in the Google Groups "WinPython" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/winpython/G4QFjF2f9Bw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to winpython+...@googlegroups.com.

Sol Simpson

unread,
Feb 8, 2016, 10:36:54 AM2/8/16
to WinPython
If this was a multi platform targeted distro, I would give this suggestion a -1, but since it is WinPython after all, +1 from me. ;)
the WordPad demo is really cool, and shows how simple / nice the interface is, IMO.  Looks easier to use than pyqt in some ways. Another gui framework to learn, unless you already know .NET I suppose, which many probably do. This all assumes the package is somewhat stable, no idea about this.

Denis Akhiyarov

unread,
Feb 8, 2016, 10:54:48 AM2/8/16
to winp...@googlegroups.com
pythonnet is not specific to Windows, Mono and now CoreCLR can run on wide variety of platforms much like CPython.

On Mon, Feb 8, 2016 at 9:36 AM, Sol Simpson <s...@isolver-software.com> wrote:
If this was a multi platform targeted distro, I would give this suggestion a -1, but since it is WinPython after all, +1 from me. ;)
the WordPad demo is really cool, and shows how simple / nice the interface is, IMO.  Looks easier to use than pyqt in some ways. Another gui framework to learn, unless you already know .NET I suppose, which many probably do. This all assumes the package is somewhat stable, no idea about this.

--

Sol Simpson

unread,
Feb 8, 2016, 10:56:52 AM2/8/16
to winp...@googlegroups.com

On Mon, Feb 8, 2016 at 10:54 AM, Denis Akhiyarov <denis.a...@gmail.com> wrote:
pythonnet is not specific to Windows, Mono and now CoreCLR can run on wide variety of platforms much like CPython.

Shows how little I know about the .NET world. ;(

stonebig

unread,
Feb 8, 2016, 12:57:10 PM2/8/16
to WinPython
This "0.dev1" is still raining over my enthousiasm.
The absolute lack of 2.1 target release date also.

Denis Akhiyarov

unread,
Feb 8, 2016, 1:36:33 PM2/8/16
to WinPython, to...@pyxll.com
I posted your concerns here:

https://mail.python.org/pipermail/pythondotnet/2016-February/001710.html

Tony Roberts is working on Python 3.5 builds with Travis CI and AppVeyor.

Otherwise I do not see any other blocking issues.

stonebig

unread,
Feb 8, 2016, 2:10:42 PM2/8/16
to WinPython, to...@pyxll.com
"files-> open" failed on Python3.4 ...

Is it Python 3 compatible ?

stonebig

unread,
Feb 8, 2016, 2:16:13 PM2/8/16
to WinPython, to...@pyxll.com
It's only testing on Python 2.6 (!) and 2.7 on Travis and Appveyor.

Waiting for a wordpad demo that is ok on Python3.

Denis Akhiyarov

unread,
Feb 8, 2016, 2:42:33 PM2/8/16
to winp...@googlegroups.com, to...@pyxll.com
I think you are committing into master branch, not develop. I made the same mistake before. On develop branch I see tests on Python 3: https://travis-ci.org/pythonnet/pythonnet/builds/106303487

let me check the demo on Python 3.

stonebig

unread,
Feb 8, 2016, 3:34:31 PM2/8/16
to WinPython, to...@pyxll.com
ok, I fixed my 3 PRs

stonebig

unread,
Feb 13, 2016, 7:02:16 AM2/13/16
to WinPython, to...@pyxll.com
Looking further:
- ok the functionnality is a must have,
- but no, it's not stable yet http://www.xavierdupre.fr/app/pymyinstall/helpsphinx/blog/2016/2016-01-03_pythonnet.html

I guess this project has currently only one active contributor, and would greatly need a second one for a few months.

Denis Akhiyarov

unread,
Feb 13, 2016, 2:53:02 PM2/13/16
to winp...@googlegroups.com, Tony Roberts
@stonebig, I agree that Python 3.5 support is a must have and until this pull request is merged, pythonnet should not be considered for release. But let me try to address other concerns mentioned by Xavier Dupré from Microsoft, since his blog does not allow comments:

1)


Debugging is still uneasy. Maybe I missed something. I downloaded the source fromPython website and I inserted many prints to understand where the module was stuck

It is possible to debug pythonnet in mixed-mode (both Python and C# code at the same time) using PTVS. The key is to select correct set of debugger in Visual Studio (Native, Managed, Python). Tony also used PyCharm to debug pythonnet code when embedding CLR. There are some open issues with debuggers for both IDEs, but I think these are not blocking issues.


2)

The second concern is about passing numpy arrays as pointers between Python and CLR, the overloading fails. I tried the same thing on my branch which fixes some overloading issues (see the link below ) and it seems to works, although I'm not sure what is supposed to be returned for this case:


>>> ar = IntPtr.__overloads__[int](array.__array_interface__['data'][0])
Decref(NULL)

Here is some background info on this numpy array passing:


3)
Could not load file or assembly 'file:///<apath>\Python.Runtime.dll
This is very common error resolved by installing properly pythonnet from wheels. Usually the problem is that Python.Runtime.DLL is not installed to the correct folder in Python\lib\site-packages.

I agree on need for contributors to fix some outstanding issues like Python 3.5 support.



--

Denis Akhiyarov

unread,
Feb 13, 2016, 2:58:19 PM2/13/16
to WinPython, to...@pyxll.com
BTW, I did not find IntPtr_long anywhere in pythonnet or .NET.
To unsubscribe from this group and all its topics, send an email to winpython+unsubscribe@googlegroups.com.
Message has been deleted

stonebig

unread,
Feb 14, 2016, 7:02:28 AM2/14/16
to WinPython, to...@pyxll.com
looking further, it's not so much a dead project, but the development not happening on Master is odd to me.

pythonnet_graph.GIF

stonebig

unread,
Mar 12, 2016, 5:08:42 AM3/12/16
to WinPython, to...@pyxll.com
are there any example of pythonnet with some example of :
- gui with a grid object
- database access ?

Denis Akhiyarov

unread,
Mar 13, 2016, 5:23:50 AM3/13/16
to WinPython, to...@pyxll.com
here is wpf dynamic grid object:
 

Database access is likely good enough in python, including ORM. So why would .NET database access needed from python? BTW - it is very hard to provide demo for databases, especially SQL Server.

Like I mentioned before in this thread, some people used pythonnet to connect to SQL Server database, although I was able to use directly pymssql:

stonebig

unread,
Mar 13, 2016, 6:45:36 AM3/13/16
to WinPython, to...@pyxll.com
Thanks!

Now waiting for pythonnet 2.1 to happen.
Reply all
Reply to author
Forward
0 new messages