-
Notifications
You must be signed in to change notification settings - Fork 13
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 compatibility and flake8 #111
Conversation
Wow that is a lot! I will take a look at this in a bit. Thanks @ocefpaf. 😄 |
Sorry about that 😬 there is no way to actually review this line-by-line. |
Thanks, @ocefpaf!! As I mentioned in my email to you just now, BiG CZ project priorities for the next 5 weeks will be a project-end "user" workshop we're putting together. Because of that, Python 3 compatibility will be low on the priorities for the time being, unfortunately. Some specific comments:
Great!
This sounds like a bigger problem that we should expose via an issue. Could you create one to list the cases where "type" is used as methods args?
I think I'd be conservative for now, and avoid removing comments. So, change to use
Yeah, that's a bad practice that should be eliminated eventually. But we need to be very careful not to break something unexpected.
Thanks. |
The Python 3 compatibility in this PR is actually a bonus. Most of the code changes are to implement better practices, avoid some confusions and bugs with
Sure. I'll open one in a moment.
I understand your point of view but when using With that said, the commented out code will be preserve in the commit hashes before this one anyway. We can always find them with a quick GitHub search. BTW , we should always try to open actionable issues instead of leaving commented out code in the code base.
The direct impact is tested via the |
I agree with @emiliom. I haven't used the majority of the code yet. I will evaluate them and remove the comments as I see fit as I use |
One of my main reasons is to defer to Stephanie for those decisions. That means I'd prefer to wait until she's back and she can have a vote (even as we try to persuade her!).
That's another reason.
Yeah. If you see something that seems like it can obviously be removed, go ahead and do it (as we've done in some cases).
By direct impact you mean within odm2api proper, right? I'm undecided about how concerned (and conservative) to be about indirect impacts on current usage of odm2api ... Of course, this will only impact future odm2api releases, so we could say others can pin to older releases (including the last one) to be 100% safe. Hmm. @ocefpaf, thanks for all the other comments. Sounds great. |
No I mean the use on the module that had the |
@ocefpaf I have tested these changes against the EnviroDIY Postgresql Database and Little Bear River MySQL Database, there doesn't seem to be any breakage. Also travis are passing! So I think these changes are save to merge. |
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.
LGTM! Tested with Postgres and MySQL.
@emiliom Okay if I merge or wait for Stephanie to review these also? |
This can wait for @sreeder. There is no rush. But we must keep in mind that it will be hard to rebase if we do more changes to the code base b/c this PR touchs almost 100% of it. |
@ocefpaf This will not get messed up as I update docstrings correct? |
It will be a hard rebase 😄 but if you are only going to work on the docstring we can live with that. Code changes would be even harder. |
Sorry 😞. As I work on ODM2 REST API, I'll probably make changes to docstrings, and hopefully not have to change the code. If I have to make code changes, I'll just stash it somewhere until this PR is merged. |
odm2api/ODM2/models.py
Outdated
@@ -265,6 +265,14 @@ class SamplingFeatures(Base): | |||
"""float: The elevation of the sampling feature in meters, or in the case of Specimen, | |||
the elevation from where the SamplingFeature.Specimen was collected""" | |||
ElevationDatumCV = Column('elevationdatumcv', ForeignKey(CVElevationDatum.Name), index=True) | |||
"""str: The code for the vertical geodetic datum that specifies the zero point for |
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.
@lsetiawan are these suppose to be docstrings? Should we consolidate them into a single docstring or make them a comment with a #
?
The auto-generated docs from this will be quite messy 😕
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.
@ocefpaf I merely followed the google example:
self.attr3 = param3 #: Doc comment *inline* with attribute
#: list of str: Doc comment *before* attribute, with type specified
self.attr4 = ['attr4']
self.attr5 = None
"""str: Docstring *after* attribute, with type specified."""
There are three options and I did the last option. What do you think I should do? Thanks.
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.
It is not about the example, it is about how we want the docs to look. Some people are on the side that no docs are better than bad automated docs. It is easy to create an automated doc page that is incomprehensible.
I am not saying that is the case here but someone should read the results with care to see if they make sense.
odm2api/ODM2/services/readService.py
Outdated
* Pass a SamplingFeature Well Known Text - return a list of sampling feature objects | ||
* Pass whether or not you want to return only the sampling features | ||
that have results associated with them | ||
"""Retrieve a list of Sampling Feature objects. |
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.
Nice one @lsetiawan! Just rebased from your PR. Can you take a look to see if everything is here?
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.
Looks all good. Thanks!
I discussed this PR with @lsetiawan, and I'm comfortable going ahead and merging. It looks like it's ready to merge. I haven't read through every single comment, but I know you two have discussed it extensively. Don, please merge at your convenience. I'll leave it up to you, but you have my vote 😜 |
Current master is now in branch |
Great, thanks. |
@lsetiawan, based on our discussion on Monday and you having created that "safe archive" branch, I think we decided we can move forward with merging this PR, right? |
See #111 (comment) for where the branch is. We are ready to go. |
Ok, merging! We'll blame @ocefpaf if anything goes wrong 😈 |
@lsetiawan do not merge this yet. Let's test it with a real case deployment first.
There is a lot in this PR but very little are real code changes.
For example:
type
in some methods args;#
;import *
but that could break the code is a shadowed module is expected to be present;