Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Dropbox use Python on Windows and OS X?

In Windows the Dropbox client uses python25.dll and the MS C runtime libraries (msvcp71.dll, etc). On OS X the Python code is compiled bytecode (pyc).

My guess is they are using a common library they have written then just have to use different hooks for the different platforms.

What method of development is this? It clearly isn't IronPython or PyObjC. This paradigm is so appealing to me, but my CS foo and Google foo are failing me.

like image 681
robotshapes Avatar asked Apr 20 '10 19:04

robotshapes


People also ask

Is Dropbox created using Python?

Dropbox. This cloud based storage system uses Python in its desktop client.


2 Answers

Dropbox uses a combination of wxPython and PyObjC on the Mac (less wxPython in the 0.8 series). It looks like they've built a bit of a UI abstraction layer but nothing overwhelming—i.e., they're doing their cross-platform app the right way.

They include their own Python mainly because the versions of Python included on the Mac vary by OS version (and Dropbox supports back to 10.4 IIRC); also, they've customized the Python interpreter a bit to improve threading and I/O behavior.

(I do not work for Dropbox or have any inside knowledge; all I did was read their forums and examine the filenames in site-packages.zip in the Dropbox app bundle.)

like image 152
Nicholas Riley Avatar answered Oct 11 '22 18:10

Nicholas Riley


For WINDOWS, Dropbox have employed a module similar to py2exe to package all their .py scripts, required libraries, resources etc into the distribution that you have mentioned above (.exe, library.zip, MS C runtime library and python25.dll) so that they can be run without requiring Python installation. Here's a sample code of how you can achieve this with py2exe.

from distutils.core import setup import py2exe   options = {'py2exe': {            'compressed':1,              'bundle_files': 2,            'dll_excludes': ['w9xpopen.exe']            }} setup(console=['myapp.py'],options=options) 

Please see the tutorial here for more explanation.

PS: the number of files in the distribution can be controlled using the options parameter as shown in the above example.

like image 30
Philar Avatar answered Oct 11 '22 20:10

Philar