
Changing the Culture of Python at Facebook [video] - sandGorgon
https://www.youtube.com/watch?v=nRtp9NgtXiA
======
xapata
The punchline:

\- Python is popular at Facebook

\- Python 3 is the default for new projects

\- Changing to Python 3 needed an internal advocate to update build and dev
tools to push the change

\- Facebook is a big user of the new ``asyncio`` module

Perhaps the most subtle point of the talk is that Facebook managed to change
from 2 to 3 from the efforts of just one person. Of course there were more
folks changing code than just the speaker, but it appears he was able to
heavily influence the culture change. Enabling 3 for the build tools probably
made a big difference.

~~~
Animats
Changing Python versions is hardly a "culture change". Changing to Go or Rust
might be.

The main problem is library support, not the language changes. A large company
like Facebook can afford to put someone on library compatibility to make this
happen.

~~~
xapata
Apparently that wasn't even necessary. The big change for library
compatibility was simply changing the settings of the build system. According
to the speaker.

In my own experience, most libraries are 3-compatible.

~~~
sandGorgon
I'm not sure if you watched the entire video, but I seem to have gotten the
impression that all through 2014.. he fixed hundreds of libraries that did not
work with Python 3.

~~~
xapata
I watched it while working on other stuff. Must not have noticed that part.

But note that a small company will have correspondingly fewer dependencies. So
I'm not sure a small company would need a dedicated upgrade engineer.

~~~
cx1000
The size of the company doesn't dictate the number of libraries used. The
scope of the work does.

~~~
xapata
Size of engineering team and scope of work are correlated, in my experience.

------
yeukhon
> \- Python 3 is the default for new projects

What teams are using Python at Facebook now? So far job requirements seem to
be mainly C++ and PHP.

Do they use Cython to speed up? What about PyPy?

~~~
peterjlee
Instagram uses django

------
sandGorgon
one of the interesting things in this video is that Facebook pretty much
invented an equivalent of Flatpak/Zeroinstall/Click-packages to deploy their
python apps.

~~~
justinsaccount
See also
[https://github.com/pantsbuild/pex](https://github.com/pantsbuild/pex)

I've had great success using pex to bundle up tools that use a few
dependencies. It's a lot simpler than tools that try to bundle a full python
distribution.

~~~
voltagex_
I wonder why someone hasn't built a simple loader for Windows that wraps pex
in an exe with pythonxy.dll. You'd pretty much solve distribution of Python
scripts on Windows.

~~~
sandGorgon
there are lots of projects that do this - we had a QT app with embedded
cherrypy that we bundled using cx_freeze.

Worked in production at a hundred different merchants

~~~
voltagex_
[https://sourceforge.net/p/cx-
freeze/mailman/message/34695906...](https://sourceforge.net/p/cx-
freeze/mailman/message/34695906/)

And PyInstaller is quite complicated.

------
sctb
We've changed the link from
[https://youtu.be/nRtp9NgtXiA](https://youtu.be/nRtp9NgtXiA). Please submit
the full URL, since HN kills links from shorteners as they break the
referential integrity of the post.

~~~
sandGorgon
interestingly, this is because of mobile apps. I used the share function in
the youtube app, coupled with the "copy link" intent on android that pops up.
This is the link that was given to me and i pasted it here.

On a mobile device using a native app, it is quite hard/impossible to get a
different url. Could you whitelist the youtu.be url ? because I'm guessing
this will start to happen more frequently.

~~~
throw_away
Or, perhaps hn could just auto-dereference the links to a whitelist of the
most popular shorteners & then everyone can be happy?

~~~
sctb
Thanks, that's a good idea that has come up before. We've got it on our list
to look at.

~~~
jimminy
Part of the reason Youtube provides the youtu.be link is that their systems
disambiguate between mobile and desktop websites.

Mobile versions have the 'm.' subdomain, and provide a less optimized
experience for desktop.

I would also argue that the youtu.be link is a canonical form, since the
identifiers are identical to the source. It is just an optimized canonical
proxy.

