[IronPython] DLR resources
I have started compiling a list of DLR resources in this blog - http://blogs.msdn.com/ironpython/archive/2008/03/16/dlr-resources.aspx. I will try and keep it updated so that folks have one place to start when hunting for DLR information. If you have other links that I should add, send them my way... Thanks, Shri Want to work on IronPython, IronRuby, F#?http://blogs.msdn.com/ironpython/archive/2008/02/25/ironpython-ironruby-and-f-openings-in-dev-test-and-pm.aspx Visit http://blogs.msdn.com/ironpython ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] inheriting from base generic type
Hi Dino, asked you about this at pycon. posting it here per our discussion to help track it. I understand it's not high on your priority list (and shouldn't be, considering the other stuff there) details: have a python class (simplified here) that is a wrapper over an event: class Future(object): def set(self,val) # set from one thread def get(self) # blocking until set. returns the value set. I exposed the class to C# code through a template interface: interface IFutureT void set(T val) T get() the interaction in our case is that C# calls python, which returns a future, which C# then waits on: interface MyPythonSubsystem: IFutureint get_an_int() Ideally I'd say that Future implements IFutureT for any T, by having Future inherit from IFuture in python. I hoped this would mean IronPython would accept my Future object when I returned it from the python implementation of get_an_int(). Unfortunately, this isn't possible, and I could only inherit from IFuture[T] for some specific T. Ended up writing a simple function at the boundary between the subsystems which gets T as an argument, and constructs an adapter that inherits from IFutureT and proxies to an underlying Future object. It works fine for our case, but less than pretty :-( anyway, hope this helps document/track it Ronnie ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [AVG SPAM] inheriting from base generic type
Dino's at PyCon? Shit, this conference is getting too large! If you're still here, Dino (and Ronnie too, come to that) try and find me to say hello. regards Steve Ronnie Maor wrote: Hi Dino, asked you about this at pycon. posting it here per our discussion to help track it. I understand it's not high on your priority list (and shouldn't be, considering the other stuff there) details: have a python class (simplified here) that is a wrapper over an event: class Future(object): def set(self,val) # set from one thread def get(self) # blocking until set. returns the value set. I exposed the class to C# code through a template interface: interface IFutureT void set(T val) T get() the interaction in our case is that C# calls python, which returns a future, which C# then waits on: interface MyPythonSubsystem: IFutureint get_an_int() Ideally I'd say that Future implements IFutureT for any T, by having Future inherit from IFuture in python. I hoped this would mean IronPython would accept my Future object when I returned it from the python implementation of get_an_int(). Unfortunately, this isn't possible, and I could only inherit from IFuture[T] for some specific T. Ended up writing a simple function at the boundary between the subsystems which gets T as an argument, and constructs an adapter that inherits from IFutureT and proxies to an underlying Future object. It works fine for our case, but less than pretty :-( anyway, hope this helps document/track it Ronnie ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] Unit testing IP hosting -- update
I've sent some messages to this list about problems trying to use NUnit to test IronPython hosting with IronPython-2.0A8. Just so you know, with IronPython-2.0B1 that seems to be working, at least with a very basic test. Code follows. Class1.cs -- using NUnit.Framework; namespace UnitTest { [TestFixture] public class Class1 { [Test] public void TestHosting() { Host host = new Host(); string x = host.Test(); Assert.AreEqual(Hosting, x); } } } Host.cs -- using IronPython; using IronPython.Modules; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; namespace UnitTest { public class Host { public string Test() { ScriptRuntime environment = ScriptRuntime.Create(); ScriptEngine engine = environment.GetEngine(py); ScriptScope scope = environment.CreateScope(); string scriptText = @ def Test(): return 'Hosting' ; ScriptSource script = engine.CreateScriptSourceFromString(scriptText, SourceCodeKind.Statements); CompiledCode compiledScript = script.Compile(); compiledScript.Execute(scope); string functionCall = Test(); ScriptSource function = engine.CreateScriptSourceFromString(functionCall, SourceCodeKind.Expression); return function.Execute(scope).ToString(); } } } ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [AVG SPAM] inheriting from base generic type
I'm guessing you missed Jim's talk otherwise you would have seen my demo :) But anyway I'm still here - I'm down in Kitty Hawk working on making Django's latest and greatest work. I'm here tomorrow too and leave Wednesday morning. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Holden Sent: Monday, March 17, 2008 3:21 AM To: Discussion of IronPython Subject: Re: [IronPython] [AVG SPAM] inheriting from base generic type Dino's at PyCon? Shit, this conference is getting too large! If you're still here, Dino (and Ronnie too, come to that) try and find me to say hello. regards Steve Ronnie Maor wrote: Hi Dino, asked you about this at pycon. posting it here per our discussion to help track it. I understand it's not high on your priority list (and shouldn't be, considering the other stuff there) details: have a python class (simplified here) that is a wrapper over an event: class Future(object): def set(self,val) # set from one thread def get(self) # blocking until set. returns the value set. I exposed the class to C# code through a template interface: interface IFutureT void set(T val) T get() the interaction in our case is that C# calls python, which returns a future, which C# then waits on: interface MyPythonSubsystem: IFutureint get_an_int() Ideally I'd say that Future implements IFutureT for any T, by having Future inherit from IFuture in python. I hoped this would mean IronPython would accept my Future object when I returned it from the python implementation of get_an_int(). Unfortunately, this isn't possible, and I could only inherit from IFuture[T] for some specific T. Ended up writing a simple function at the boundary between the subsystems which gets T as an argument, and constructs an adapter that inherits from IFutureT and proxies to an underlying Future object. It works fine for our case, but less than pretty :-( anyway, hope this helps document/track it Ronnie ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [AVG SPAM] inheriting from base generic type
Dino, on a Django subject... :) does it run on IronPython? Thanks, Miha. On Mon, Mar 17, 2008 at 5:12 PM, Dino Viehland [EMAIL PROTECTED] wrote: I'm guessing you missed Jim's talk otherwise you would have seen my demo :) But anyway I'm still here - I'm down in Kitty Hawk working on making Django's latest and greatest work. I'm here tomorrow too and leave Wednesday morning. ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [AVG SPAM] inheriting from base generic type
It might be possible to fix the one language compat issue on our side. And at least one of the 2 SQL issues is already fixed in the latest version of Django. So I'm hoping we can get compatible w/o needing to change Django. But currently I have the tweaks on my own version :(. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Miha Valencic Sent: Monday, March 17, 2008 1:47 PM To: Discussion of IronPython Subject: Re: [IronPython] [AVG SPAM] inheriting from base generic type Ahh, thanks for the answer. Quite a few issues to address I see. Do you think it would make sense to run it in IIS somehow? (not via fastcgi with CPython, but with IronPython). Is that even doable yet? Since I am no python expert, but I am rather coming from a C background (and nowdays C# :)), the PEP 249 code you've written isn't very clear to me. But, I will stufy it at least and learn that way. Are you also commiting to Django SVN the changes you make. or are you running on your version? Miha On Mon, Mar 17, 2008 at 6:31 PM, Dino Viehland [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] wrote: The short answer is yes, it runs. The long answer is only 0.96.1 will run on IronPython 2.0 Beta 1 but there are some small issues: ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] 2.0B1 Hosting: Creating Python Types
Hi, I'm trying to figure out how to create an instance of a Python type (i.e. tuple and file) using the hosting interface (from C#). In older versions there was PythonTuple.MakeTuple, for example, but that seems to have disappeared. Now PythonTuple and PythonFile both require a CodeContext, which I'm pretty sure is internal. Is there a nice, easy way in 2.0B1 to create a tuple and convert a Stream to a file-like object? Thanks, Jeff ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] 2.0B1 Hosting: Creating Python Types
MakeTuple has been moved into PythonOps as PythonOps.MakeTuple. The reason for that change is that we now want the public surface area of the .NET Python types to match the public surface area Python types. File is more of a problem... Unfortunately files do need to be bound to a context (for multi-runtime support). If there's enough demand for it we could provide a PythonEngine class which is compatible w/ 1.x and we could expose the file creation via that. Until then probably the only way to do it right now is to call __builtin__.file through Python code (to which you can pass in a stream). The ObjectOperations class should make that fairly easy (you can convert file to a delegate and then call it). CodeContext isn't actually internal but it's also not available to you via the hosting APIs. Basically the DLR APIs are split into hosting APIs and language APIs. The hosting APIs provide a pretty interface as well as a remoting model and the language APIs provide a ton of functionality specific to language implementers. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Hardy Sent: Monday, March 17, 2008 7:17 PM To: Discussion of IronPython Subject: [IronPython] 2.0B1 Hosting: Creating Python Types Hi, I'm trying to figure out how to create an instance of a Python type (i.e. tuple and file) using the hosting interface (from C#). In older versions there was PythonTuple.MakeTuple, for example, but that seems to have disappeared. Now PythonTuple and PythonFile both require a CodeContext, which I'm pretty sure is internal. Is there a nice, easy way in 2.0B1 to create a tuple and convert a Stream to a file-like object? Thanks, Jeff ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] IronPython Console Sample at Pycon
I know that the dynamic console we saw during the presentation is available on the dynamicsilverlight.net, I was having some trouble finding it. Any chance someone has a direct link? -- Kevin Kubasik http://kubasik.net/blog ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] IronPython Console Sample at Pycon
http://dynamicsilverlight.net/see/dlrconsole On 3/17/08 10:39 PM, Kevin Kubasik [EMAIL PROTECTED] wrote: I know that the dynamic console we saw during the presentation is available on the dynamicsilverlight.net, I was having some trouble finding it. Any chance someone has a direct link? -- Kevin Kubasik http://kubasik.net/blog ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com