Hello there, I am a nooby with smalltalk but quite experienced with python. 
Here is a little background about python libraries. 


Python libraries come in 3 flavors 


a) Pure python libraries

b) Pure C libraries

c) A mix between the two

Now as you may have guessed option C is the most popular but lets see how 
either one works. 


Option A
-------------

Pure python libraries are not that common, but they do exist, an example of 
this is pyglet, it uses Ctypes a FFI that allows to access dynamical libraries 
(*.dll ,*.so etc) use just pure python , so pyglet access both opengl and 
native OS support for games, like windows, events etc. Pure python libraries, 
use only python and as suck accessing them from another programming language is 
relatively easy usually via sockets or even embeding python inside your app, in 
this case pharo. Obviously sockets is way easier. 


Option B
--------------

Pure C libraries in python are very common. Python was invented for simplifying 
and extending C apps, so it comes as no suprised that python core is written in 
C but even a 50 % of the libraries python comes with by default are written in 
C at least partly. Pure C libraries wrapped for python use the C python API 
which is nothing than a collection of C functions that can convert C types to 
python types and increase and decrease the reference counter which plays a huge 
role in python automatic memory management. The good news is that what you end 
up with even though it may come with the strange extension of *.pyd  its 
actually a normal dynamic library (dll in windows). That is good news for Pharo 
because it means that this type of python library is accessible through pharos 
FFIs , so if the library is open source it should be fairly easy to use from 
pharo without converting code to smalltalk or using sockets that are not that 
fast

Option C
------------
This must be the most popular option out there.

I think this option is relative easy to guess. Its still option B but with 
additional python modules to extend the core pyd file, if those modules are not 
much you could convert the library to smalltalk and use FFI to access the core 
pyd file.

Of course in all cases sockets are an easy solution. You just fire up a python 
intepreter and you create a socket bridge between pharo and python. 


If you want additional technically details I will be glad to help , though I am 
not a python expert. 



________________________________
 From: Serge Stinckwich <serge.stinckw...@gmail.com>
To: Pharo-project@lists.gforge.inria.fr 
Sent: Thursday, 6 September 2012, 10:03
Subject: Re: [Pharo-project] FFI & Python
 
Hum, I see ;-)

Welcome on board Santiago !
If you are interested, we can talk about the alternatives to build a
ROS client in Smalltalk (rosbridge, pure client or Python bindings).

Regards,

On Thu, Sep 6, 2012 at 1:43 PM, Esteban Lorenzano <esteba...@gmail.com> wrote:
> he, Santiago *is* the engineer recruited by Noury :)
>
> On Sep 6, 2012, at 3:17 AM, Serge Stinckwich <serge.stinckw...@gmail.com> 
> wrote:
>
>> On Thu, Sep 6, 2012 at 5:58 AM, Santiago Bragagnolo
>> <santiagobragagn...@gmail.com> wrote:
>>> Hi all!
>>
>> Hi Santiago,
>>
>>>    I'm currently working in a project related with ROS (robot operative
>>> system), which already have a library to develop in C++ and other to do the
>>> same at Python. So, there a lot of variables to contrast to make a choice
>>> (performance, code-easy-to-prototype, flexibility, and a lot more), but the
>>> main variable is the accessibility from Pharo, then the question is, is
>>> there any project that use python from pharo? Or, if i select python i
>>> should write a library in C that bootstrap python and give access to pharo
>>> via FFI?
>>>
>>>   I looked in the list's mails and in google without any success.
>>
>> As Chris already told, there is a Python binding with OpenQwaq:
>> https://squeakingalong.wordpress.com/2011/05/04/openqwaq-python-integration/
>>
>> I'm really interested to be able to use ROS from Pharo.
>> I start some weeks ago to work on a pure Smalltalk client for ROS:
>> http://ss3.gemstone.com/ss/RosSmalltalk.html
>>
>> Noury is also interested and start some work also:
>> http://car.mines-douai.fr/squeaksource/RoSt.html
>>
>> We planned with Noury to join our efforts to have a ROS client as soon
>> as possible.
>> Noury will also recruit a engineer to work full time on this.
>>
>> Another alternative in order to use ROS from Smalltalk is to use
>> websockets and rosbridge.
>> I have done some work to use ROS from Amber here:
>> https://github.com/SergeStinckwich/rostalk
>>
>> You are than welcome to join us ;-)
>> Regards,
>> --
>> Serge Stinckwich
>> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
>> Every DSL ends up being Smalltalk
>> http://doesnotunderstand.org/
>>
>
>



-- 
Serge Stinckwich
UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
Every DSL ends up being Smalltalk
http://doesnotunderstand.org/

Reply via email to