How Python Powers Dropbox

How Python Powers Dropbox

Dropbox is a cloud-based platform for collaboration as well as the storage, synchronization and sharing of files.  There are native Dropbox clients for the PC, Mac, Linux, iOS and Android platforms as well as a web interface.  Dropbox makes sharing large files a breeze, as easy as sending a single link, which is much easier than using older solutions like FTP or emailing files as attachments, especially when the files exceed attachment size limits.

The free tier offers a small storage allotment (2GB) that is greatly increased in the Pro, Business and Enterprise tiers. Besides the increase in storage, these buy-up options also add additional powerful features like remote wipe, granular permissions and enterprise-level support.

A lot of software performs the magic behind the scenes and Dropbox lists all the open source code which is uses. The company, however goes further than that required disclosure and has open-sourced some of its own internally developed software.

There is one recurring theme in both the outside open source code it uses, and the code it has written for itself: Python.

Many of those third-party open source libraries are written in Python, as are many of the projects hosted on its GitHub repository. Python powers much of the Dropbox experience, both at the backend and at client.  In fact, the Dropbox desktop client applications include a full install of the Python (Version 2.7) language.

So why did Dropbox choose Python to power so much of their platform?

A talk from PyCon 2011 by a Dropbox Engineer provides the answers: cross-platform support, readability, ease of learning.  These strengths of Python were critical to Dropbox’s early and rapid scaling.  The quick development cycle Python makes possible was crucial to implementing, testing and deploying new features.

Since much of Dropbox runs on Python, the company puts a lot of effort into making that code as efficient as possible.  In keeping with it’s open-source ethos, Dropbox openly shares the lessons learned.  The 2011 talk is one example, another is this blog post about Python code optimization from the same year which discusses many techniques you can use in your own projects.

Dropbox is so determined to extract as much performance out of its Python code that in December of 2012, it hired the man who created Python, Guido van Rossum, away from Google.  As of this writing (late 2016), he is still working there.  Guido’s expertise was undoubtedly utilized in creating Pyston, Dropbox’s own alternative Python implementation, using JIT techniques already employed in the JavaScript world.  Pyston was announced in April of 2014, with a release in May of 2016 that is compatible enough with CPython to run the NumPy package.

Given the massive investment of resources invested in Python, it’s very doubtful that Dropbox will be completely moving away from the language. The company is, however, migrating some performance-critical back end code from Python to Google’s Go language. Go is a compiled language with speed being one of it’s main strengths.  This shift actually confirms Python as a world-class prototyping language: If the Python code didn’t work at scale to begin with, there would be nothing for Go to improve upon, because were it not for Python, Dropbox would not have lasted long enough or been successful enough to even face this problem.

Dropbox takes the hassle out of syncing and sharing our files across devices with help from the cloud.  Python has been keeping that cloud aloft for nine years.

Copyright © Python People