-
Notifications
You must be signed in to change notification settings - Fork 659
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
Converters API #2882
Converters API #2882
Conversation
Hello @cbouy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-05-10 18:20:47 UTC |
Forgot to tag @MDAnalysis/coredevs ! |
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.
Your pandas plot-style interface is a good middle-ground. I don't know how to solve the problem with the docs. Perhaps look into how pandas documents DataFrame.plot
.
I suggest you start building converter things in MDAnalysis.converters
although others might have different opinions.
…or and the converter module instances
Codecov Report
@@ Coverage Diff @@
## develop #2882 +/- ##
===========================================
- Coverage 93.56% 93.56% -0.01%
===========================================
Files 172 176 +4
Lines 22785 22823 +38
Branches 3191 3193 +2
===========================================
+ Hits 21319 21354 +35
- Misses 1416 1419 +3
Partials 50 50
Continue to review full report at Codecov.
|
@cbouy please just let us know when this is ready for review :-) |
I still need to write the tests but most of the code and docs should be ready for review |
I'm not really convinced that we need |
There was a fairly long discussion on this and we found that pandas DataFrames do something similar with their different plots (see #2790 (comment) and thereabouts). The majority seemed to favor TAB-discoverability. |
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.
Ok lgtm
I've included the OpenMM converter as well (just noticed it was there), and hopefully fixed #3262 in the process |
Make sure you also move the documentation stubs. |
@cbouy could you change the Edit: Ah, you already test that. Could you explain why you're also testing |
@cbouy could you please rebase on develop and see if that fixes the tests? :) |
Sorry @cbouy in the interest of getting this merged faster & not forcing you to work on a Sunday I went ahead and did the update against develop. |
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.
Went ahead and fixed the doc issues.
|
||
.. versionadded:: 2.0.0 | ||
|
||
|
||
Converts an | ||
`OpenMM <http://docs.openmm.org/latest/api-python/generated/simtk.openmm.app.topology.Topology.html#simtk.openmm.app.topology.Topology>`_ | ||
`OpenMM topology <http://docs.openmm.org/latest/api-python/generated/simtk.openmm.app.topology.Topology.html#simtk.openmm.app.topology.Topology>`_ |
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.
sphinx was complaining about doubling of OpenMM
link definition, so I renamed the topology as such.
@@ -22,15 +22,15 @@ | |||
# | |||
|
|||
""" | |||
RDKit topology parser | |||
===================== | |||
RDKit topology parser --- :mod:`MDAnalysis.converters.RDKitParser` |
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.
Added these :mod:
entries since they were present in the non Parser
modules.
|
||
.. rubric:: Available converters | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
converters/ParmEdParser | ||
converters/RDKitParser | ||
converters/init |
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.
sphinx was complaining about the presence of init.rst
without a toctree entry for it. I added it, although it isn't super informative as an entry, should we just remove it?
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.
Alternatively, we could move the converters.rst
contents into converters.__init__
?
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.
Went with the path of least resistance here and just moved a tiny bit of init's doc to the converters.rst
. We can always clean up in 2.1.0 (or post beta) if it's really worth it.
Sorry again for hijaking the PR @cbouy, just added a couple of small commits (docs + tests) to see if we can get it merged today. |
This is concerning, the 3.6 / numpy 1.16 run failed twice with the same error... (just restarted things to see if it'll do it a third time in a row)
Ok, it's not done it again, it's probably the whole cache thing -- let's get this merged so we can get that one merged too. edit: the failure rate for py3.6 numpy 1.16 is very high, I wonder if it's actually linked to rdkit 2020 vs 2021. |
@lilyminium @orbeckst can we get a quick re-review with aim to merge please? |
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.
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.
Only failing check here is codecov (just an error cover, can deal with it some other time). Thanks for your hard work here @cbouy 🎉 -- squash merging |
Fixes #2790
Changes made in this Pull Request:
u.atoms.convert_to("PACKAGE")
case insensitiveu.atoms.convert_to("rdkit", NoImplicit=False)
u.atoms.convert_to.package()
methods automatically from the metaclass magic, with TAB completion support, and docstring from the converterThe same logic can be applied to writers if that's needed
The tests will fail for now as I have written them with #2775 in mind.
Also, I'm not sure if I've put the code in the right place and if the names I've come up with are relevant.
I'm not sure how this will work out with Sphinx though, since all the
convert_to.package()
methods are made automatically throughsetattr
. Similar concern forconvert_to
in AtomGroup, is there a way to tell Sphinx to show a particular docstring instead of considering it like an attribute, and if yes, which docstring should it show ?PR Checklist