mozilla-mobile / prox-server

[INACTIVE] Server & data scripts for the Prox client.
https://github.com/mozilla-mobile/prox/
Mozilla Public License 2.0
5 stars 5 forks source link

Move to python 3 #85

Closed mcomella closed 7 years ago

mcomella commented 7 years ago

The virtualenv has python 2.7 but Pyrebase's readme states "Pyrebase was written for python 3 and will not work correctly with python 2." Using pyrebase with python 2.7, I just ran into an error where a location in firebase with a unicode id, such as "caffé-nonna-nashville-2", are inaccessible.

We should move to python 3 when we can.

I'm guessing we used python 2 to begin with because one of our APIs doesn't support python 3? I'm not sure. @jhugman, do you know why we started with python 2?

mcomella commented 7 years ago

Let's see if this is easy.

mcomella commented 7 years ago

After looking briefly:

You need 5 projects to transition to Python 3.
Of those 5 projects, 4 have no direct dependencies blocking their transition:

  factual-api
  httplib2 (which is blocking foursquare)
  poster (which is blocking foursquare)
  sanction

That being said, foursquare, according to their readme, supports 2 & 3 so I wonder if 1) it's not documented correctly, 2) is using new tricks to support both py 2 & 3 so doesn't have a specific py3 library caniusepython3 might be looking for. I'm concerned about the factual-api, if it really only is python 2, since they're deprecating their web API (so they'll never update it). That being said, it's just a wrapper for the web API so we can write our own.

mcomella commented 7 years ago

[There's a caniusepython3 tool]

Apparently it doesn't distinguish between "ambiguous support" and "not supported" based on packaging categories. So maybe they will work

Running it on our code and running pytest, I get a runtime error. :(

But I accidentally ran pytest with py2 - with python 3, pytest tests, it passes but pytest by itself fails (maybe it tries to test our modules?).

mcomella commented 7 years ago

All our libs install with pip on python3 (I assume it's smart and will not install packages that only support python 2). Looking at them specifically:

sanction

Docs mention python 3+ support but python 3.2 support removed (due to a broken unit test but client code should still work). Well, we're on python 3.6 now (it was last updated ~2014) so great!

httplib2 (which is blocking foursquare)

An older version supposedly supports py3 (see categories) but the latest version doesn't have py3 in the categories.

poster (which is blocking foursquare)

No mention of python3 or on the official site. There is a github repo that ports it to py 3.4 so it probably doesn't support py3.

foursquare

That being said, foursquare says it supports py2+3 so maybe ^ doesn't matter.

factual-api

No mention of python3 on the pypi page but their changelog mentions Python 3.3. Oddly, 2to3 makes changes on their repository – perhaps support has regressed or 2to3 is inaccurate (e.g. for Python 3.0 rather than 3.3).


It sounds like there is a high probability our dependencies will just work.