| |
Original author(s) | Jim Hugunin, Microsoft |
---|---|
Developer(s) | Dino Viehland, .NET Foundation |
Initial release | September 5, 2006 [1] |
Stable release | 3.4.1 / July 12, 2023 |
Preview release | 3.4.0-beta1 / April 30, 2022 |
Repository | |
Written in | C# |
Operating system | Windows, Linux, macOS |
Platform | .NET Framework, .NET, Mono |
Type | Python programming language implementation |
License | Apache License 2.0 |
Website | ironpython |
IronPython is an implementation of the Python programming language targeting the .NET and Mono frameworks. The project is currently maintained by a group of volunteers at GitHub. It is free and open-source software, and can be implemented with Python Tools for Visual Studio, which is a free and open-source extension for Microsoft's Visual Studio IDE. [2] [3]
IronPython is written entirely in C#, although some of its code is automatically generated by a code generator written in Python.
IronPython is implemented on top of the Dynamic Language Runtime (DLR), a library running on top of the Common Language Infrastructure that provides dynamic typing and dynamic method dispatch, among other things, for dynamic languages. [4] The DLR is part of the .NET Framework 4.0 and is also a part of Mono since version 2.4 from 2009. [5] The DLR can also be used as a library on older CLI implementations.
Jim Hugunin created the project and actively contributed to it up until Version 1.0 which was released on September 5, 2006. [6] IronPython 2.0 was released on December 10, 2008. [7] After version 1.0 it was maintained by a small team at Microsoft until the 2.7 Beta 1 release. Microsoft abandoned IronPython (and its sister project IronRuby) in late 2010, after which Hugunin left to work at Google. [8] The project is currently maintained by a group of volunteers at GitHub.
This section needs expansion. You can help by adding to it. (July 2012) |
There are some differences between the Python reference implementation CPython and IronPython. [23] Some projects built on top of IronPython are known not to work under CPython. [24] Conversely, CPython applications that depend on extensions to the language that are implemented in C are not compatible with IronPython , [25] unless they are implemented in a .NET interop. For example, NumPy was wrapped by Microsoft in 2011, allowing code and libraries dependent on it to be run directly from .NET Framework. [26]
IronPython is supported on Silverlight (which is deprecated by Microsoft and already has lost support in most web browsers [27] ). It can be used as a scripting engine in the browser just like the JavaScript engine. [28] IronPython scripts are passed like simple client-side JavaScript scripts in <script>
-tags. It is then also possible to modify embedded XAML markup.
The technology behind this is called Gestalt.[ citation needed ]
// DLR initialization script. <scriptsrc="http://gestalt.ironpython.net/dlr-latest.js"type="text/javascript"></script> // Client-side script passed to IronPython and Silverlight. <scripttype="text/python">window.Alert("Hello from Python")</script>
The same works for IronRuby.
Until version 0.6, IronPython was released under the terms of Common Public License. [29] Following recruitment of the project lead in August 2004, IronPython was made available as part of Microsoft's Shared Source initiative. This license is not OSI-approved but the authors claim it meets the open-source definition. [30] With the 2.0 alpha release, the license was changed to the Microsoft Public License, [31] which the OSI has approved. The latest versions are released under the terms of the Apache License 2.0.
One of IronPython's key advantages is in its function as an extensibility layer to application frameworks written in a .NET language. It is relatively simple to integrate an IronPython interpreter into an existing .NET application framework. Once in place, downstream developers can use scripts written in IronPython that interact with .NET objects in the framework, thereby extending the functionality in the framework's interface, without having to change any of the framework's code base. [32]
IronPython makes extensive use of reflection. When passed in a reference to a .NET object, it will automatically import the types and methods available to that object. This results in a highly intuitive experience when working with .NET objects from within an IronPython script.
The following IronPython script manipulates .NET Framework objects. This script can be supplied by a third-party client-side application developer and passed into the server-side framework through an interface. Note that neither the interface, nor the server-side code is modified to support the analytics required by the client application.
fromBookServiceimportBookDictionarybooksWrittenByBookerPrizeWinners=[book.TitleforbookinBookDictionary.GetAllBooks()if"Booker Prize"inbook.Author.MajorAwards]
In this case, assume that the .NET Framework implements a class, BookDictionary, in a module called BookService, and publishes an interface into which IronPython scripts can be sent and executed.
This script, when sent to that interface, will iterate over the entire list of books maintained by the framework, and pick out those written by Booker Prize-winning authors.
What's interesting is that the responsibility for writing the actual analytics reside with the client-side developer. The demands on the server-side developer are minimal, essentially just providing access to the data maintained by the server. This design pattern greatly simplifies the deployment and maintenance of complex application frameworks.
The following script uses the .NET Framework to create a simple Hello World message.
importclrclr.AddReference("System.Windows.Forms")fromSystem.Windows.FormsimportMessageBoxMessageBox.Show("Hello World")
The performance characteristics of IronPython compared to CPython, the reference implementation of Python, depends on the exact benchmark used. IronPython performs worse than CPython on most benchmarks taken with the PyStone script but better on other benchmarks. [33] IronPython may perform better in Python programs that use threads or multiple cores, as it has a JIT compiler, and also because it doesn't have the Global Interpreter Lock. [34] [35]
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with C# and F#, it is one of the three main languages targeting the .NET ecosystem. Microsoft updated its VB language strategy on 6 February 2023, stating that VB is a stable language now and Microsoft will keep maintaining it.
JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer web browser.
NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. The predecessor of NumPy, Numeric, was originally created by Jim Hugunin with contributions from several other developers. In 2005, Travis Oliphant created NumPy by incorporating features of the competing Numarray into Numeric, with extensive modifications. NumPy is open-source software and has many contributors. NumPy is a NumFOCUS fiscally sponsored project.
Jython is an implementation of the Python programming language designed to run on the Java platform. It was known as JPython until 1999.
The Web Server Gateway Interface is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, version 1.0.1, is specified in Python Enhancement Proposal (PEP) 3333.
PyPy is an implementation of the Python programming language. PyPy often runs faster than the standard implementation CPython because PyPy uses a just-in-time compiler. Most Python code runs well on PyPy except for code that depends on CPython extensions, which either does not work or incurs some overhead when run in PyPy.
The Dynamic Language Runtime (DLR) from Microsoft runs on top of the Common Language Runtime (CLR) and provides computer language services for dynamic languages. These services include:
IronRuby is an implementation of the Ruby programming language targeting Microsoft .NET Framework. It is implemented on top of the Dynamic Language Runtime (DLR), a library running on top of the Common Language Infrastructure that provides dynamic typing and dynamic method dispatch, among other things, for dynamic languages.
Jim Hugunin is a software programmer who created the Python programming language extension Numeric, and later created Python implementations for the Java Platform (Jython) and for Microsoft .NET platform (IronPython); he has also co-designed the AspectJ extension for the Java programming language. He worked for Microsoft from 2004 to 2010, mainly on IronPython and Dynamic Language Runtime.
Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.
The .NET Framework is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability across several programming languages. Programs written for .NET Framework execute in a software environment named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.
GraalVM is a Java Development Kit (JDK) written in Java. The open-source distribution of GraalVM is based on OpenJDK, and the enterprise distribution is based on Oracle JDK. As well as just-in-time (JIT) compilation, GraalVM can compile a Java application ahead of time. This allows for faster initialization, greater runtime performance, and decreased resource consumption, but the resulting executable can only run on the platform it was compiled for.
Nuitka is a source-to-source compiler which compiles Python code to C source code, applying some compile-time optimizations in the process such as constant folding and propagation, built-in call prediction, type inference, and conditional statement execution. Nuitka initially was designed to produce C++ code, but current versions produce C source code using only those features of C11 that are shared by C++03, enabling further compilation to a binary executable format by modern C and C++ compilers including gcc, clang, MinGW, or Microsoft Visual C++. It accepts Python code compatible with several different Python versions and optionally allows for the creation of standalone programs that do not require Python to be installed on the target computer.
Microsoft, a technology company historically known for its opposition to the open source software paradigm, turned to embrace the approach in the 2010s. From the 1970s through 2000s under CEOs Bill Gates and Steve Ballmer, Microsoft viewed the community creation and sharing of communal code, later to be known as free and open source software, as a threat to its business, and both executives spoke negatively against it. In the 2010s, as the industry turned towards cloud, embedded, and mobile computing—technologies powered by open source advances—CEO Satya Nadella led Microsoft towards open source adoption although Microsoft's traditional Windows business continued to grow throughout this period generating revenues of 26.8 billion in the third quarter of 2018, while Microsoft's Azure cloud revenues nearly doubled.
IronPython has no GIL and multi-threaded code can use multi core processors.