-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 compatiability fixes; measurement result example changes #230
base: master
Are you sure you want to change the base?
Conversation
merge from master
DAO changes for ANSP
changes to DAO for CUAHSI Hydroclient compatability
updates
updates for python3
@miguelcleon, thank you for doing this! I see that this PR is failing the Travis tests. Ideally, we could issue a release that is compatible with both Python 2 & 3. How easy is that? Does a compatibility layer like this help: https://python-future.org? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the goal is to be 100% Python 3 one should drop the Python 2 testing and create a version of the dependencies, like odm2api
, for Python 3.
@@ -389,7 +389,7 @@ def quote_xml(inStr): | |||
"Escape markup chars, but do not modify CDATA sections." | |||
if not inStr: | |||
return '' | |||
s1 = (isinstance(inStr, basestring) and inStr or | |||
s1 = (isinstance(inStr, str) and inStr or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I don't have any stake in this so when I say that in almost 2019 and going all in for Python 3 is 👍 take it with a grain of salt.
If Python 2 and 3 support is needed you may look into tools like six
and lines like this one, for example, would be six.string_types
instead.
@@ -1,6 +1,6 @@ | |||
from __future__ import (absolute_import, division, print_function) | |||
|
|||
import StringIO | |||
from io import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may needs to treat things as BytesIO
instead.
wof/core.py
Outdated
@@ -27,6 +21,18 @@ | |||
from spyne.server.http import HttpTransportContext | |||
from spyne.server.wsgi import WsgiApplication | |||
|
|||
import sys | |||
print('sys.path!!!!') | |||
print(sys.path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is left over debugging statements.
PS: using env will give you path isolation and reduce headaches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, thanks, removed now.
@ocefpaf, thanks for those suggestions. I ideally, we would go 100% Python 3, but unfortunately, we can't do that for WOFpy until the https://github.com/ODM2/ODM2DataSharingPortal repo moves to Python 3. @horsburgh, @jcaraballo17 and @Maurier, what would it take to do that? Is a transition to Python 3 something that we might put on the roadmap for the ODM2DataSharingPortal? I think that would be the main constraint, as we could simultaneously move WOFpy and ODM2API to Python 3. |
I should add that existing deployments and examples, of which there are many, could continue to point to our older releases. However, the safest plan would be to maintain backward compatibly with Python 2.7 for at least a year or so, if it's not too much work. It was helpful for me to read this as I considered the effort: https://docs.python.org/2/howto/pyporting.html cc: @steveskrip |
remove extra debugging statement
@aufdenkampe - we are using a bunch of Python 2 libraries for the data sharing portal. So, conversion to Python 3 is a good goal, but we'll have to look more closely at the effort involved. But, I don't think it's necessary to tie these two together. WOFPy is a completely separate application. We are running it in a separate Python Virtual Environment on the Data Sharing Portal server, so it's isolated in terms of Python. I think you could go ahead and upgrade WOFPy to Python 3 and then the virtual environment within which it is running on the data sharing portal server could be updated. It shouldn't affect the data sharing portal application. |
Sorry for not replying yet; I've been under a couple of hard deadlines -- and still am. |
Ok. Sorry it took me such a long time to follow up. Again, thanks so much @miguelcleon !! And I'm really glad you got your ODM2 measurement results working! @ocefpaf and @aufdenkampe, thanks for your follow ups! Let's get a couple of things out of the way:
Py3kI have a hunch the Py3k upgrade will be trickier and will require broader discussions and PR's beyond this one, so having an umbrella issue will help. FYI, on that issue I've linked to the resources pointed out on this PR comments, plus others. As mentioned on that issue, we had already done some Py3k-oriented code changes over a year ago. But we have done no focused testing whatsoever. As @ocefpaf mentioned, all tests in the CI are Py2 based (ie, based on a Python 2.7 conda env). I can't guarantee that I have the time to see Py3k changes to completion, including tests. We should probably create a new branch for this development. @ocefpaf, would you be able to help or guide me with this? I don't think I have time to do it this week, but I can start discussing it.
ODM2 Measurements Results DAO/Example@miguelcleon, if it's not too much trouble, can you list out in the new issue I created, #232, the main changes you made to make this work, besides Py3k changes? That'll help me as I review the commit(s). Ideally, I'd prefer to first address a PR focusing on this feature, and leave Py3k components for later. |
I agree with everything that @emiliom said in #230 (comment) but this part:
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 IMO the plan should be:
|
Thanks @ocefpaf! I was hesitating as I wrote that. I completely agree with the plan you laid out. So, I'll copy it over to the Py3k issue 😸 |
Hi All
I have been lurking here, but I wanted to put in my $0.02. As Anthony has
mentioned, we have in my company been working on using ODM2.
As part of this effort we have migrated the odm2api to python 3 and also
made a number of changes to the ODM2 schema (part of these are listed as
ODM2.1 on github). Many of the changes to the schema were things that
people discussed before and were posted in the different documents. Others
are ones that we realized were needed (for instance, the ability to store
multiple numbers associated with a geochemical sample analysis, rather than
have the single result -> resultvalue -> resultmeasurementvalue. (for
instance measurement and std dev, or min and max). We extended and fixed
some bugs in the odm2api.
We have been testing this on a fairly large multi year, multi site, multi
sample geochemical dataset. This contains about 4000 discrete samples from
20 locations, with a total of > 100K analytical results. This allowed us to
really test performance and so on.
We decided not to try to take any of the other capabilities along in this
migration (so no WofPy, YAML, Django web stack and so on). As these all
depend on the old schema, they would be impacted by this.
The changes to the ODM2 schema and to the api are both big and small. I
want to share them with the community, and plan to do so after the AGU, but
I think this is looking more and more like something which will become a
fork, rather than something which will be easy to merge, as adopting this
for a new odmxx database is fine, but making it work with an older one will
be challenging.
Not sure how to proceed on this, but just wanted to start the discussion.
My suggestion is to get together with whomever is there at the AGU next
week, I can show what we have done, and then see how the community thinks I
should proceed. I am there all week, with the only firm commitment my talk
at 430 pm on Friday
Regards
Roelof
Regards
Roelof
…On Tue, Dec 4, 2018 at 3:19 PM Filipe ***@***.***> wrote:
I agree with everything that @emiliom <https://github.com/emiliom> said
in #230 (comment)
<#230 (comment)> but this
part:
We should probably create a new branch for this development.
By creating a long lived dev branch you may create huge merge conflicts
down the road. There is nice a Python talk
<https://www.youtube.com/watch?v=66XoCk79kjM> 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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#230 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHjhtMxPRwz2jEplArR_hK-dqgGf-bWGks5u1tjQgaJpZM4Y3xzV>
.
|
Thanks for the update, @roelofversteeg. I'm looking forward to hearing more details about the work you describe. I won't be at AGU, and I can't remember if Anthony will. I'll be interested in following up on your work updating your odm2api fork to Python 3, but that'll have to wait till January. |
@miguelcleon, I'm getting back to this PR (and WOFpy, more generally). Can you respond to my long comments from 12/4? Thanks! |
@emiliom sorry I haven't gotten back to this. Unfortunately I have some higher priority things to work on right now and I'm not sure when I'm going to be able to get to this. |
@miguelcleon Understood. Thanks for letting me know. I'll see what I can do on my own this month, since I'll be working on WOFpy. |
python 2 to 3 changes; remove sourcelink. CUAHSI HIS could not ingest WOF data when it includes a source link so it is commented out here.
The latest commit, today adds a number of additional changes for python 3 compatibility.
I had previously only tested WOF with ODM2 time series and did not attempt to apply changes to the entire WOFpy code base. However now I have applied the same changes needed for ODM2 time series to the entire code base. This has not been thoroughly tested. I'm using my fork for production though, so you all can decide to merge this or not. |
@miguelcleon could you comment on the last 3 of my 5 comments under the "Py3k" heading, above? Namely: odm2api and spyne dependencies in a Py3k environment; and the comment that starts with "I see that in fixing the ODM2 measurement results DAO, you ended up copying lower-level WOFpy code into the DAO folder, examples/flask/odm2/measurement." Thanks. |
updates from prod for timeseries dao
This PR upgrades WOFpy for Python 3. I've upgraded ODM2 Admin for Python 3 and I wanted to run WOFpy on the same server and I didn't want to run web applications with different versions of python.
I'm not sure if you will want to merge this but I thought I'd make the PR so we can discuss.
I have this running with python 3 here http://bitnami-miguel.cuahsi.org/odm2lczo/
This PR also contains updates for the examples/flask/odm2/measurement DOA and related files. The previous version did not work with an example database water quality database I've been working with. This is currently deployed here https://dev-odm2admin.cuahsi.org/ansp/
@emiliom let me know what you think, Maybe @lsetiawan can look at this or someone else?