[IronPython] IronPython in Visual Studio 2008

Michael Foord fuzzyman at voidspace.org.uk
Wed Jan 20 00:23:23 CET 2010


On 19/01/2010 21:17, Vernon Cole wrote:
> Vincent:
>
> I will try the first part of an answer to your question.  It is a long 
> question, so you will probably get lots of different answers...
>
> There are several different implementations of Python. I will talk 
> about the two which are most common on Windows systems. I use both.
>
> CPython is implemented in the C++ language 

Actually C and *not* C++, although that may change if unladen-swallow is 
merged back in (unladen-swallow uses LLVM which is written in C++).

To answer some of the the other questions.

Yes you *can* create 'exe' files written from compiled Python using 
IronPython. The user need never care that the program was written in 
Python. You can either use the Pyc compiler to create these directly or 
just write a simple '.exe' wrapper in C# that executes the Python code.

.NET has an FFI (Foreign Function Interface) for integrating .NET 
applications written in C/C++. This is what Ironclad uses to interface 
with Python C extensions. You can use the FFI (PInvoke) directly for 
working with other C/C++ libraries.

Even though few on this list would recommend using Visual Studio to edit 
your Python files you can use the standard .NET build system to build 
your project from combined Python, C# and C/C++ sources relatively easily.

All the best,

Michael Foord
> and uses the traditional (or OLD, depending on your point of view) 
> method of operating a Windows program.  It is much more mature, starts 
> up much faster, and has lots of available modules, including numpy, 
> scipy and countless others. You find it at http://python.org. 
> <http://python.org%20> To do Windows specific things with it, you also 
> need pywin32 <http://sourceforge.net/projects/pywin32> .  It can be 
> used on a web server, and several web engines such as django, are 
> written using it.  It cannot be used as a client script on a web page.
>
> IronPython is new, written by Microsoft in the C# language, and uses 
> the new .NET way of hooking things together.  It is a VERY good 
> implementation of standard Python, but since many of the add-on 
> libraries were written in C++, not C#, you cannot link to them. There 
> is a package called IronClad which seeks to make this happen, often 
> successfully. ( http://www.resolversystems.com/products/ironclad/ .) 
> IronPython also suffers from the frustrating habit of ALL .NET 
> implementations of taking several seconds (which at times feels like 
> several minutes) to start a new process running. So while it may often 
> be FASTER than CPython after it finally gets going, don't even THINK 
> about using it for a quick command-line script.  On the other hand, if 
> you are trying to interface with a new .NET project, it is only 
> reasonable way to go.  It also runs on the Silverlight platform, so 
> can be used as a scripting language for a web client page, not only a 
> server page.
>
> I have heard nothing but BAD reports about using Iron Python Studio. 
> However, there are several Integrated Development Environments which 
> work with CPython, IronPython, or both.  I, personally, use Wing for 
> debugging, and the IDE which is built in to pywin32 for rough work.
>
> Will Python code run as fast as C, or C++, or C# code?  No.  (or 
> almost never.)  Will it run fast enough that a human user will never 
> notice the difference?  Almost always.  So what you do is prototype in 
> Python, where you are most productive, then if you find that some part 
> of your system actually needs the performance boost, you recode that 
> piece in C++ (or C#).  I find that design changes usually do much more 
> to boost perceived speed than compiler changes do.  Python excels at that.
>
> So welcome aboard.  You have discovered a great tool.
> --
> Vernon Cole
>
>
> On Tue, Jan 19, 2010 at 10:22 AM, Vicent <vginer at gmail.com 
> <mailto:vginer at gmail.com>> wrote:
>
>     Hello to all.
>
>     This is my first message to the list. I would like to ask you some
>     basic questions about IronPython. First of all, sorry for my English.
>
>     I've just discovered IronPython, and I am actually a new-by in
>     Python, not an expert programmer. So maybe you'll find my
>     questions quite simple or naive.
>
>     I read the first chapter of the classic book for IronPython
>     (http://www.manning.com/foord/SampleChapter1.pdf), and in pages
>     7-8 the author says:
>
>     "Visual Studio 2008 integration exists in the form of IronPython
>     Studio, which is implemented through the Visual Studio Shell
>     extensibility framework. IronPython Studio can either be run
>     standalone (without requiring Visual Studio to be installed) or
>     integrated into Visual Studio. It includes Windows Forms and WPF
>     designers and is capable of producing binary executables from
>     Python projects."
>
>     I am very interested in fully understanding this sentence above,
>     because I currently use C++ in MS Visual Studio 2008, but I like
>     Python more.
>
>     So, with IronPython + Visual Studio 2008:
>
>     (1) Can I obtain compiled code from Python source, as
>     efficient/fast/etc. as if it was made from C++?
>     (2) Can I obtain executables (programs that people can install and
>     use, in the "normal user" language) as good/fast/efficient as I
>     would obtain using Visual C++?
>     (3) Can I easily link my Python code with existing external C/C++
>     libraries?
>     (4) (Similar to the previous one) Can I easily link my Python code
>     with some C/C++ source code (I mean, mixing up Python and C in the
>     same project, in a transparent way)?
>     (5) Can I use NumPy, SciPy and other key (scientific) Python
>     libraries in a transparent way?
>
>     (or am I just dreaming??)
>
>     Any answer will be appreciated. Thank you in advance.
>
>     --
>     Vicent Giner
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100119/99068584/attachment.html>


More information about the Ironpython-users mailing list