Skip to content

IronPython is a popular, open-source implementation of Python 3.x for .NET that is built on top of its very own Dynamic Language Runtime.

License

Notifications You must be signed in to change notification settings

Lamparter/IronPython

 
 

Repository files navigation

IronPython Console

IronPython Website GitHub CI Status Azure CI Status Gitter

IronPython is a popular, open-source implementation of Python 3.x for .NET that is built on top of its very own Dynamic Language Runtime.

Note

There is still much that needs to be done to support Python 3. We are working on it, albeit slowly. We welcome all those who would like to help! ❤️

IronPython is an open-source implementation of the Python programming language that is tightly integrated with .NET. IronPython can use .NET and Python libraries, and other .NET languages can use Python code just as easily.

IronPython 3 targets Python 3, including the re-organized standard library, Unicode strings, and all of the other new features.

🎁 Installation

Binaries of IronPython 3 can be downloaded from the release page, available in various formats: .msi, .zip, .deb, .pkg. The IronPython package is also available on NuGet. See the installation article for detailed instructions on how to install a standalone IronPython interpreter on various operating systems and .NET frameworks.

✍️ Examples

The following C# program:

using System.Windows.Forms;

MessageBox.Show("Hello World!", "Greetings", MessageBoxButtons.OKCancel);

can be written in IronPython as follows:

import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import MessageBox, MessageBoxButtons

MessageBox.Show("Hello World!", "Greetings", MessageBoxButtons.OKCancel)

Here is an example how to call Python code from a C# program.

var eng = IronPython.Hosting.Python.CreateEngine();
var scope = eng.CreateScope();
eng.Execute(@"
def greetings(name):
    return 'Hello ' + name.title() + '!'
", scope);
dynamic greetings = scope.GetVariable("greetings");
System.Console.WriteLine(greetings("world"));

This example assumes that IronPython has been added to the C# project as a NuGet package.

More examples and documentation on how to use IronPython outside the interactive console can be found here.

🐍 State of the Project

The current target is Python 3.4, although features and behaviors from later versions may be included.

See the following lists for features from each version of CPython that have been implemented:

🙋 Contributing

Want to contribute to this project? Let us know with an issue that communicates your intent to create a pull request. Also, view our contributing guidelines to make sure you're up to date on the coding conventions. For more details on contributing see the Contributing article.

🫡 Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

🛠️ Building from source

See the article on building from source. Since the main development is on Windows, bugs on other platforms may inadvertently be introduced - please report them!

⚖️ License

This project is licensed under the Apache-2.0 License as stated in the LICENSE.

Copyright (c) .NET Foundation and Contributors.

📝 Wiki

The documentation and guides for IronPython are available on the wiki. Enjoy!

About

IronPython is a popular, open-source implementation of Python 3.x for .NET that is built on top of its very own Dynamic Language Runtime.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 65.7%
  • Python 34.3%