ODM2 / WOFpy

A server-side implementation of CUAHSI's Water One Flow service stack in Python.
http://odm2.github.io/WOFpy/
9 stars 9 forks source link

Python 3 #231

Open emiliom opened 5 years ago

emiliom commented 5 years ago
emiliom commented 5 years ago

From @ocefpaf, wrt planning migration to Py3k:

By creating a long lived dev branch you may create huge merge conflicts down the road. There is nice a Python talk on how Instagram move its huge code base to Python 3 without long lived dev branches and by merging it into master! Worth watching (or reading the blog post about it).

IMO the plan should be:

  1. identify the dependencies that must be migrated to Python 3 and start converting them from the bottom up in the dependency chain;
  2. start hard failures for Python 3 in the CIs so new code is always compliant;
  3. choose a migration technique: future, six, 2to3, a combination of them, or even Python 3 only code from now on.
emiliom commented 5 years ago

WOFpy is one ODM2 package that should (I think) be ported over to Python 3 only, having no compelling reason to maintain Python 2.7 support. I can elaborate on this later.

As a helpful contrast, I don't think we can say the same thing about odm2api. We probably want to maintain Py2.7 support in odm2api after we add Py3 support.

aufdenkampe commented 5 years ago

@emiliom, I fully support this migration sooner than later to support our need to migrate the Monitor My Watershed implementation of the ODM2DataSharingPortal to Django 2.x, which requires Python 3. See https://github.com/ODM2/ODM2DataSharingPortal/issues/381.

@miguelcleon, how have you integrated WOFpy with ODM2Admin deployments since you upgraded to Django 2 & Python 3 this fall? Do you have WOFpy in a separate Python 2.7 environment?

miguelcleon commented 5 years ago

I've been using my own fork with python 3. I added a pull request with my changes, Emilio wanted me to break up my changes into two pull requests because it also includes changes to allow ODM2 measurement results to be served succesfully which really wasn't working. I haven't had time to do that. Here is the PR https://github.com/ODM2/WOFpy/pull/230

aufdenkampe commented 5 years ago

@miguelcleon, thanks for that reminder!

emiliom commented 5 years ago

@aufdenkampe please look over the discussion at PR #230, specially my assessment of the PR.

As it stands the PR is too complex and has some serious issues (unless those were fixed by @miguelcleon's latest commits, from March) that prevent merging. But please head over to the PR to discuss the PR.

@aufdenkampe see also the discussion in that PR about the ODM2DataSharingPortal vs WOFpy. The two are completely isolated. If you use conda environments or any other python virtual environment set up, you can run both as is. The same is true for ODM2 Admin vs WOFpy, but Miguel preferred to manage a single Python (Py3) environment.