-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update docstring and docs for graphflood #68
Conversation
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.
Thanks for cleaning this up, @Teschl! I probably want to get @bgailleton to look over this. It seems like mostly cosmetic changes, but I do want to make sure that things like the type specifications or the renaming don't interfere with his workflow.
Changelog:
* graphflood.py * Converted import of C++ functions to new style I have been using to minimize the use of stuff like: `type:ignore` and such. * reordered imports to comply with pep8
This is the kind of thing that we would like to catch in linting if we're going to enforce it. Is there a way to configure flake8
to alert us about the import order?
* Added a docstring to `run_graphflood()` * there is still a description missing for SFD. * I wasn't sure what the best description for the return would be.
I added some comments with possibilities for those descriptions.
* Added parameter specifications to `run_graphflood()` * docs/api.rst * added graphflood to docs, it's separate from the GridObject since it's not part of the class. Should we change that or keep it this way?
For now I think it is all right if it is separate from the class.
We probably should develop some guidelines for which functions should be methods on our classes and which can be plain functions.
Argument names like
N_iterations
orSFD
don't conform to snake_case naming style. Do we want to replace them or just keep them like this? I think it doesn't really do any harm to keep them this way, but if we want to be strict about pep8 we should adjust them.
I'll defer to @bgailleton for the moment regarding naming conventions for graphflood.
In the longer term, I think it will be important to have consistency within pytopotoolbox for named arguments: if we have an SFD
argument to run_graphflood
and also some future flow routing method on GridObject
, we should make sure that they are spelled the same just so users aren't tripped up by needing SFD
for one and sfd
for the other. Sticking to the PEP8 snake case style is probably the easiest way to make sure this works, but we would probably also need some developer documentation that spells out things like "use sfd
rather than single_flow_direction
".
If we do want to take the naming conventions more seriously this is also something that we should catch in our linter.
Pylint would catch issues like that. It's still in the ci.yaml pipeline but as a comment. While pylint would catch issues like wrong-import-order. But pylint also raises issues like: Edit: |
I enabled pylint in the The pipeline is failing as expected because: |
OK I reviewed the modifications, and everything looks good to me! For now, I suggest we focus on properly exposing/documenting the I originally created them to handle boundary conditions specific to the Shallow Water Equation solver I developed, which might make them less convenient or fully integrated with the rest of the Let me know what you think! |
@Teschl: I think we can go ahead and merge these changes and continue to think about our style conventions unless there is anything specific you think we need to address now. It looks like there is a failing lint at the moment, but if you sort that out and mark this PR as ready for review, I will merge it. |
@wkearn: I converted all remaining variable name to lowercase. It now passes the pylint tests. I also noticed that the project had no requirements.txt, so I added one. This resolved an issue with non-reproducible errors when using pylint (a .venv can now be created easily). This should be ready to merge now. |
Excellent. I do want to get @bgailleton's thoughts about the argument case because it might have the potential to break things on his end. We have been sticking more or less to PEP8 as a reasonable standard, but the point of a style guide is to ensure the project presents a consistent interface to users, not just to obey the linter. I am okay with breaking the style guide if it makes it easier to interface with existing code and as long as we can clearly specify what we expect to break with the style guide. To that end, is it possible to turn off a particular On a separate note: Why do we need |
I do not have strong opinion on argument case, especially if it makes things more consistent on your side. I can adapt my codes already relying on In my opinion there are pros and cons to any standards anyway, enforcing lowercase enhance clarity for the developers, having capital letters can be more intuitive for non experimented users. In the end consistency is key and as I use |
Yes, by adding
Yes, the
We can, I will add them after this. |
I changed my mind about specifying versions in pyproject.toml (TopoToolbox#68), but I wanted to go ahead and merge that one. I think having requirements.txt for developers and the automated testing infrastructure to have a consistent environment is all right, though we might need to think about how we decide when to bump those versions. We shouldn't constrain users of the library to also have a particular version of the dependencies unless it is necessary for our topotoolbox functionality that a certain dependency version be available.
I changed my mind about specifying versions in pyproject.toml (#68), but I wanted to go ahead and merge that one. I think having requirements.txt for developers and the automated testing infrastructure to have a consistent environment is all right, though we might need to think about how we decide when to bump those versions. We shouldn't constrain users of the library to also have a particular version of the dependencies unless it is necessary for our topotoolbox functionality that a certain dependency version be available.
Changelog:
type:ignore
and such.run_graphflood()
run_graphflood()
Argument names like
N_iterations
orSFD
don't conform to snake_case naming style. Do we want to replace them or just keep them like this? I think it doesn't really do any harm to keep them this way, but if we want to be strict about pep8 we should adjust them.