SlideShare a Scribd company logo
Python with DotNet and VS2010
Python tools for VisualStudio2010 http://pytools.codeplex.com/
Python Tools for Visual Studio turns Visual Studio into a Python IDE.  It's a free & open source plug-in for Visual Studio 2010 from Microsoft's Developer Division.  PTVS enables developers to use all the major productivity features of Visual Studio to build Python code using either CPython or IronPython and adds new features such as using High Performance Computing clusters to scale your code.
IronPython http://ironpython.codeplex.com/   Latest version 2.7.1
IronPython is an implementation of the  Python programming language  running under  .NET / Mono  and  Silverlight / Moonlight .  It supports an interactive console with fully dynamic compilation. It's well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining compatibility with the Python language. There also is Visual Studio tooling integration. IronPython  is an open source project freely available under the Apache License v2.0. The sources are stored on GitHub as part of the  IronLanguages project.
Usage Use IronPython as scripting of DotNet
 
Code example that adds reference
 
d = XmlDocument() d.Load('load.xml') n = d.SelectNodes('//Puzzle/SavedGames/Game/@caption') for e in n: print e.Value
Code example: WPF
 
http://ironpython.net/documentation/dotnet/dotnet.html
Using IronPython in C# using System; using IronPython.Hosting; public class HelloWorld { public static void Main(string[] args) { var engine = Python.CreateEngine(); engine.CreateScriptSourceFromString("print 'hello world'").Execute(); } }
DotNet4 dynamic class Calculator(object): def add(self, a, b): return a + b ======================= string scriptPath = "Calculator.py"; ScriptEngine engine = Python.CreateEngine(); engine.SetSearchPaths(new string[] { … ScriptSource source = engine.CreateScriptSourceFromFile(scriptPath); ScriptScope scope = engine.CreateScope(); ObjectOperations op = engine.Operations; source.Execute(scope); dynamic Calculator = scope.GetVariable("Calculator"); dynamic calc = Calculator(); return calc.add(x,y);
Create assembly with IronPython Create C# project, add PythonEngine in code Load python code file or resource string Run the PythonEngine
Subclassing .NET types class MyClass(System.ICloneable): pass o = MyClass() import clr clr.GetClrType(System.ICloneable).IsAssignableFrom(o.GetType()) Output>>>True class MyClass(System.ICloneable): def Clone(self): return MyClass() o = MyClass() o.Clone()
Methods with multiple overloads import clr import System StringComparer = System.Collections.Generic.IEqualityComparer[str] class MyComparer(StringComparer): def GetHashCode(self, *args): if len(args) == 0: # Object.GetHashCode() called return 100 if len(args) == 1 and type(args[0]) == str: # StringComparer.GetHashCode() called return 200 assert("Should never get here") comparer = MyComparer() getHashCode1 = clr.GetClrType(System.Object).GetMethod("GetHashCode") args = System.Array[object](["another string"]) getHashCode2 = clr.GetClrType(StringComparer).GetMethod("GetHashCode") # Use Reflection to simulate a call to the different overloads # from another .NET language getHashCode1.Invoke(comparer, None) >>>100 getHashCode2.Invoke(comparer, args)
Winform example
 
IronTunes – WPF example http://ironpython.codeplex.com/releases/view/12482
App and ViewModel
 
Diskusage - WPF
 
IronPython with SilverLight http://www.silverlight.net/learn/advanced-techniques/dynamic-languages/dynamic-languages-in-silverlight#example_applications

More Related Content

PPT
Visual studio 11 developer preview
PDF
Using google appengine
PDF
Symfony2 Specification by examples
PDF
How to deploy angular 12 application using firebase hosting
PDF
Google cloud endpoints
PPTX
PDF
Mini-Training: Roslyn
PPTX
Declarative authorization in REST services in SharePoint with F# and ServiceS...
Visual studio 11 developer preview
Using google appengine
Symfony2 Specification by examples
How to deploy angular 12 application using firebase hosting
Google cloud endpoints
Mini-Training: Roslyn
Declarative authorization in REST services in SharePoint with F# and ServiceS...

What's hot (20)

PPTX
Creating iOS and Android Apps with Visual Studio and C#
PDF
How to create an Angular builder
PPTX
Android Jetpack - What's new
PDF
IVY: an overview
PDF
The new features of angular 12
PDF
What's new in python 3.8? | Python 3.8 New Features | Edureka
PDF
Firebase analytics event_201607
PDF
Cloudy with a Chance of Cross Platform (for Bay.NET)
KEY
iOS Auto Build
PPTX
Kotlin in industry
PPT
Asp.Net(2)
PPTX
(WPF + WinForms) * .NET Core = Modern Desktop
PDF
WebRTC - Brings Real-Time to the Web
PDF
High Productivity Web Development Workflow
PPT
SDK Hackery
PPTX
React Alicante - React Redux a development workflow
PPTX
Writing Slack Bots in JavaScript
PDF
Create Alexa Skills using IBM Watson Conversation and Apache OpenWhisk
PPTX
[Codelab] - Getting Started With Kotlin For Android Development
PPTX
Creating Apps with .NET MAUI
Creating iOS and Android Apps with Visual Studio and C#
How to create an Angular builder
Android Jetpack - What's new
IVY: an overview
The new features of angular 12
What's new in python 3.8? | Python 3.8 New Features | Edureka
Firebase analytics event_201607
Cloudy with a Chance of Cross Platform (for Bay.NET)
iOS Auto Build
Kotlin in industry
Asp.Net(2)
(WPF + WinForms) * .NET Core = Modern Desktop
WebRTC - Brings Real-Time to the Web
High Productivity Web Development Workflow
SDK Hackery
React Alicante - React Redux a development workflow
Writing Slack Bots in JavaScript
Create Alexa Skills using IBM Watson Conversation and Apache OpenWhisk
[Codelab] - Getting Started With Kotlin For Android Development
Creating Apps with .NET MAUI
Ad

Viewers also liked (9)

PDF
PyCon 2011: IronPython Command Line
ODP
Open Source .NET
PPT
IronPython and Dynamic Languages on .NET by Mahesh Prakriya
PPTX
Python 101 For The Net Developer
PPTX
Dynamic programming on .net
PPTX
SyPy IronPython
PPTX
The .NET developer's introduction to IronPython
PDF
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
PPT
Introduction to Python
PyCon 2011: IronPython Command Line
Open Source .NET
IronPython and Dynamic Languages on .NET by Mahesh Prakriya
Python 101 For The Net Developer
Dynamic programming on .net
SyPy IronPython
The .NET developer's introduction to IronPython
Python Tools for Visual Studio: Python na Microsoftovom .NET-u
Introduction to Python
Ad

Similar to Python with dot net and vs2010 (20)

PDF
Pyhton-1a-Basics.pdf
PDF
Tutorial_Python1.pdf
PDF
Python in the browser
PDF
Ekon 25 Python4Delphi_MX475
PPT
Visual Studio .NET2010
PDF
Interfacing C++ with Python to boost your legacy apps with Python interfaces
PPTX
Introduction to Python.Net
PDF
[ABC2018Spring]Flutterアプリ開発入門
PDF
05 python.pdf
PPTX
Iron python
PDF
Pemrograman Python untuk Pemula
PPTX
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
PDF
Python Online Compiler
ODP
Intro To Spring Python
PPTX
Introduction to Google App Engine with Python
PPTX
How c/c++ works
PPT
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
PPTX
2012: ql.io and Node.js
PPTX
Sphinx + robot framework = documentation as result of functional testing
PPTX
SharePoint for the .NET Developer
Pyhton-1a-Basics.pdf
Tutorial_Python1.pdf
Python in the browser
Ekon 25 Python4Delphi_MX475
Visual Studio .NET2010
Interfacing C++ with Python to boost your legacy apps with Python interfaces
Introduction to Python.Net
[ABC2018Spring]Flutterアプリ開発入門
05 python.pdf
Iron python
Pemrograman Python untuk Pemula
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Python Online Compiler
Intro To Spring Python
Introduction to Google App Engine with Python
How c/c++ works
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
2012: ql.io and Node.js
Sphinx + robot framework = documentation as result of functional testing
SharePoint for the .NET Developer

More from Wei Sun (19)

PPT
Using google appengine_final2
PPT
Using google appengine_final
PPT
Using google appengine_1027
PPT
Using google appengine (2)
PPTX
Gc algorithm inside_dot_net
PPT
Code review
PPT
Windbg dot net_clr2
PPT
The best way to learn java script
PPT
Asynchronous in dot net4
PPT
Code quality
DOC
老友记
DOC
Lua gc代码
PPT
Windbg dot net_clr2
PPT
Dotnetintroduce 100324201546-phpapp02
PPT
Code rule
PDF
Web development overview
PPT
Lua
PPT
DotNet Introduction
PDF
Mac
Using google appengine_final2
Using google appengine_final
Using google appengine_1027
Using google appengine (2)
Gc algorithm inside_dot_net
Code review
Windbg dot net_clr2
The best way to learn java script
Asynchronous in dot net4
Code quality
老友记
Lua gc代码
Windbg dot net_clr2
Dotnetintroduce 100324201546-phpapp02
Code rule
Web development overview
Lua
DotNet Introduction
Mac

Recently uploaded (20)

PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Modernizing your data center with Dell and AMD
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
Advanced Soft Computing BINUS July 2025.pdf
Chapter 2 Digital Image Fundamentals.pdf
Empathic Computing: Creating Shared Understanding
MYSQL Presentation for SQL database connectivity
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Monthly Chronicles - July 2025
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Per capita expenditure prediction using model stacking based on satellite ima...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Understanding_Digital_Forensics_Presentation.pptx
Review of recent advances in non-invasive hemoglobin estimation
Modernizing your data center with Dell and AMD
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
Electronic commerce courselecture one. Pdf
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Advanced Soft Computing BINUS July 2025.pdf

Python with dot net and vs2010

  • 1. Python with DotNet and VS2010
  • 2. Python tools for VisualStudio2010 http://pytools.codeplex.com/
  • 3. Python Tools for Visual Studio turns Visual Studio into a Python IDE.  It's a free & open source plug-in for Visual Studio 2010 from Microsoft's Developer Division. PTVS enables developers to use all the major productivity features of Visual Studio to build Python code using either CPython or IronPython and adds new features such as using High Performance Computing clusters to scale your code.
  • 5. IronPython is an implementation of the  Python programming language  running under  .NET / Mono  and  Silverlight / Moonlight . It supports an interactive console with fully dynamic compilation. It's well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining compatibility with the Python language. There also is Visual Studio tooling integration. IronPython  is an open source project freely available under the Apache License v2.0. The sources are stored on GitHub as part of the  IronLanguages project.
  • 6. Usage Use IronPython as scripting of DotNet
  • 7.  
  • 8. Code example that adds reference
  • 9.  
  • 10. d = XmlDocument() d.Load('load.xml') n = d.SelectNodes('//Puzzle/SavedGames/Game/@caption') for e in n: print e.Value
  • 12.  
  • 14. Using IronPython in C# using System; using IronPython.Hosting; public class HelloWorld { public static void Main(string[] args) { var engine = Python.CreateEngine(); engine.CreateScriptSourceFromString("print 'hello world'").Execute(); } }
  • 15. DotNet4 dynamic class Calculator(object): def add(self, a, b): return a + b ======================= string scriptPath = "Calculator.py"; ScriptEngine engine = Python.CreateEngine(); engine.SetSearchPaths(new string[] { … ScriptSource source = engine.CreateScriptSourceFromFile(scriptPath); ScriptScope scope = engine.CreateScope(); ObjectOperations op = engine.Operations; source.Execute(scope); dynamic Calculator = scope.GetVariable("Calculator"); dynamic calc = Calculator(); return calc.add(x,y);
  • 16. Create assembly with IronPython Create C# project, add PythonEngine in code Load python code file or resource string Run the PythonEngine
  • 17. Subclassing .NET types class MyClass(System.ICloneable): pass o = MyClass() import clr clr.GetClrType(System.ICloneable).IsAssignableFrom(o.GetType()) Output>>>True class MyClass(System.ICloneable): def Clone(self): return MyClass() o = MyClass() o.Clone()
  • 18. Methods with multiple overloads import clr import System StringComparer = System.Collections.Generic.IEqualityComparer[str] class MyComparer(StringComparer): def GetHashCode(self, *args): if len(args) == 0: # Object.GetHashCode() called return 100 if len(args) == 1 and type(args[0]) == str: # StringComparer.GetHashCode() called return 200 assert("Should never get here") comparer = MyComparer() getHashCode1 = clr.GetClrType(System.Object).GetMethod("GetHashCode") args = System.Array[object](["another string"]) getHashCode2 = clr.GetClrType(StringComparer).GetMethod("GetHashCode") # Use Reflection to simulate a call to the different overloads # from another .NET language getHashCode1.Invoke(comparer, None) >>>100 getHashCode2.Invoke(comparer, args)
  • 20.  
  • 21. IronTunes – WPF example http://ironpython.codeplex.com/releases/view/12482
  • 23.  
  • 25.  
  • 26. IronPython with SilverLight http://www.silverlight.net/learn/advanced-techniques/dynamic-languages/dynamic-languages-in-silverlight#example_applications