Skip to content
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

Minor fixes #1247

Merged
merged 9 commits into from
May 7, 2017
Merged

Minor fixes #1247

merged 9 commits into from
May 7, 2017

Conversation

jbarnoud
Copy link
Contributor

This PR is the result of some heavy procrastination. It fixes some minor issues in the package:

  • Remove the windows end of line in the XVG aux reader
  • Replace all occurences of isinstance(something, int) by the more generic and safe isinstance(something, numbers.Integral)
  • Update most docstrings to the numpy format; only the docstrings from the analysis are left.

Please, do not squash the commits as they are unrelated logical units.

dict
dict with totallength (in chars), repeat, length, format, decimals

Raises
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a line of dashes missing

Parameters
----------
i : int
Step number (0-indexed) to move to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return value doc is missing

@@ -19,343 +19,348 @@
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbarnoud is this just rewritten with unix \n instead of whatever MS encoding is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the \r at the end of the lines. The file seems to be ASCII as it should be.

richardjgowers
richardjgowers previously approved these changes Mar 19, 2017
@orbeckst
Copy link
Member

When I build I get a whole bunch of SEVERE errors with messed up docs:

/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/ExtendedPDBParser.py:docstring of MDAnalysis.topology.ExtendedPDBParser:24: SEVERE: Unexpected section title.

Classes
-------
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/PDBQTParser.py:docstring of MDAnalysis.topology.PDBQTParser:24: SEVERE: Unexpected section title.

Classes
-------
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/PQRParser.py:docstring of MDAnalysis.topology.PQRParser:4: ERROR: Unknown target name: "pqr".
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/PQRParser.py:docstring of MDAnalysis.topology.PQRParser:4: ERROR: Unknown target name: "pdb2pqr".
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/PrimitivePDBParser.py:docstring of MDAnalysis.topology.PrimitivePDBParser:21: SEVERE: Unexpected section title.

Classes
-------
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/TOPParser.py:docstring of MDAnalysis.topology.TOPParser:28: ERROR: Unknown directive type "todo".

.. todo:: Add reading of bonds etc
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/TPRParser.py:docstring of MDAnalysis.topology.TPRParser:73: SEVERE: Unexpected section title.

Development notes
-----------------
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/TPRParser.py:docstring of MDAnalysis.topology.TPRParser.TPRParser:1: ERROR: Unknown target name: "tpr".
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/topology/__init__.py:docstring of MDAnalysis.topology.__init__:147: SEVERE: Unexpected section title.

Developer Notes
---------------
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/package/MDAnalysis/visualization/streamlines.py:docstring of MDAnalysis.visualization.streamlines.generate_streamlines:65: WARNING: Explicit markup ends without a blank line; unexpected unindent.

Typically, this seems to be something like

See Also
--------
* item 1
* item 2

Classes
-------

.. autoclass:: Foo

At least my version of sphinx (v1.5.1)/napoleon seems to be unhappy about the numpy-style "See Also" because when I change it back to

.. SeeAlso::
    * item 1
    * item 2

Classes
-------

.. autoclass:: Foo

then everything is fine again.

Is this just me?

(Generally speaking, the numpy docs format does some hackish things such as any heading "Examples" is turned into a non-section heading and the "See Also" probably also only works nicely inside class/method/function docs.)

@jbarnoud
Copy link
Contributor Author

The easiest is probably to revert back to the old .. SeeAlso::. I'll do it as soon as I find some time.

@jbarnoud
Copy link
Contributor Author

It seems that I actually broke quite a bit of the doc, and that fixing it is not trivial. I'll try to solve that this weekend.

@orbeckst orbeckst self-requested a review March 23, 2017 06:04
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the formatting got broken.

See, for instance, problems with See Also.

I am blocking the merge until fixed.

orbeckst
orbeckst previously approved these changes Apr 21, 2017
@orbeckst
Copy link
Member

This will need to be rebased after PR #1314 will have been merged.

@orbeckst
Copy link
Member

@jbarnoud do you want to try and rebase and hopefully get it in soon?

@jbarnoud
Copy link
Contributor Author

I plan on going back to it next week.

@orbeckst
Copy link
Member

orbeckst commented May 1, 2017

@jbarnoud I rebased against develop and fixed the conflicts. Please have a look.

(Note: this needs to be merged.)

@orbeckst orbeckst dismissed stale reviews from richardjgowers and themself via 608e7ee May 5, 2017 01:16
jbarnoud and others added 6 commits May 4, 2017 18:18
Testing that arguments where integer by using `isinstance(arg, int)` has
proven itself detrimental on several occasions. Indeed, the test refuses
other types that would be legitimate such as numpy integers. This commit
replaces the remaining occurences of the too narrow test by the solution
that has already been used on multiple places of the code: testing
against `numbers.Integral`. This new way matches everything that looks
enough like an integer, and behave the same on python 2 and python 3 on
the contrary to testing against `int`.
Update the docstrings everywhere in the package but in the anlysis.
…efile)

Normally we build the docs with
      python setup.py build_sphinx
but for more fine-grained control one can also locally build with
      cd doc/sphinx
      make html
This is useful for debugging reST issues.
- I fixed everything until local
     cd doc/sphinx
     make html
  passed without errors.... but I am sure that more
  errors will come up.
- reformatted and rewrote various portions of the docs while
  fixing the errors
- completed the ENCORE citations in encore/similarity.py
@orbeckst
Copy link
Member

orbeckst commented May 5, 2017

If this passes Travis then I need another review, please.

  • Fixed remaining issues.
  • rebased against develop and cleaned up.

@orbeckst
Copy link
Member

orbeckst commented May 5, 2017

Note: Merge please see #1247 (comment) (do not squash)

@orbeckst orbeckst added this to the 0.16.x milestone May 5, 2017
@jbarnoud
Copy link
Contributor Author

jbarnoud commented May 5, 2017

I fixed the last new rendering error I could find. It is good to go on my side.

import math
import warnings

from ..lib.util import asiterable, anyopen
import numpy as np
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the numpy import should still be independent from the mdanalysis internal imports

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


"""Write to a CHARMM/NAMD DCD trajectory file.

Parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we decided to put those into the init function

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't remember a discussion, I might have missed that. I don't see anything in the Style Guide: Docs.

My reasoning was that with the extended numpy sections it looks better to have everything in the class docs instead of __init__, especially as sometimes we might not even have __init__ for derived classes.

I certainly followed this reasoning in some of the analysis module doc rewrites where class docs contained background and examples and __init__ contained parameter lists.

Can you point me to where we decided using __init__ for the class docs? For right now I'd like to leave it as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which PR anymore. But we currently have both styles in the library.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say: open an issue to change it to one or the other and update the style guide according to the consensus.

@@ -391,15 +401,15 @@ class DCDReader(base.ReaderBase):
``data = dcd.correl(...)``
populate a :class:`MDAnalysis.core.Timeseries.Collection` object with computed timeseries

.. Note::
Note
----

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the empty line here should be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (empty line not harmful and positively helps when reformatting the block in emacs but I agree that this should be consistent everywhere)

Skip has been deprecated in favor of the standard keyword step.
Parameters
----------
asel: :class:`~MDAnalysis.core.groups.AtomGroup`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after asel

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (not harmful, but yes, let's keep the style uniform)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and all the other occurences in DCD.py


Returns
-------
:class:`DCDWriter`

.. Note::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change the Note section here as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

:attr:`NamedStream.name` will be changed accordingly)
ext: None or str
extension to use in the new filename
keep: bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

mode: str
'r' or 'w' or 'a', more complicated modes ('r+', 'w+' are not supported
because only the first letter is looked at)
reset: bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

Returns
-------
root: str
ext: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

last column + 1
*typespecifier*
typespecifier: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

allowed in between.
Parameters
----------
residue: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

@orbeckst
Copy link
Member

orbeckst commented May 5, 2017

I think I addressed @kain88-de 's comments (and more...).

Fixing docs is a bottomless pit for time and I spent way more time on this than I should have. I will fix anything in my commits that has broken something but for any other wishes, please do them yourself on the PR.

@orbeckst
Copy link
Member

orbeckst commented May 7, 2017

I found that many coordinate classes were not even shown in the docs so I added explicit .. autoclass markup where necessary. Also fixed the link to AtomGroup that @kain88-de pointed out (thanks).

I rebased into my last commit to keep the history tidy and immediately mergable. Force-pushed... and hopefully done.

- @kain88-de suggestions
- even more fixes (everywhere in coordinates, elsewhere where I found something
  to fix). In particular
  - adde Parameter/Return/Raises sections to many functions in lib.util
  - made sure that there were two empty lines above .. versionchanged etc sections
  - made proper Example sections
  - fixed/clarified text
  - ensure that *all* classes are shown and can be linked (added autoclass markup
    where necessary)
- PDB: removed any mentioning of the simple/Bio.PDB parser stuff, only left a
  versionchanged entry
@orbeckst orbeckst removed their assignment May 7, 2017
@orbeckst
Copy link
Member

orbeckst commented May 7, 2017

Why does the numpy dev test fail?? https://travis-ci.org/MDAnalysis/mdanalysis/jobs/229565210 – it looks as if it sets up the environment and then just dies silently.

I think I don't understand

  • how "cron" tests are supposed to work
  • if (and how) the astropy-ci helper scripts handle numpy dev

@kain88-de
Copy link
Member

Why does the numpy dev test fail??

see Discussion at #1334

@orbeckst
Copy link
Member

orbeckst commented May 7, 2017

Thanks!

kain88-de
kain88-de previously approved these changes May 7, 2017
Copy link
Member

@kain88-de kain88-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume everything is correct. I haven't checked every line of this massive PR

@@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXBUILD = sphinx-build -v -W
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are these options doing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verbose (more output) and make warnings failure (the same thing that you (?) enabled in the setup.cfg file).

Running

python setup.py build_sphinx

is apparently not using this Makefile but if one wants to reproduce locally the build with the Makefile then I found it useful to have. I didn't know how to change any other build_sphinx option for testing so it was convenient to use the standard Makefile.

@orbeckst orbeckst merged commit d5667ae into develop May 7, 2017
@orbeckst
Copy link
Member

orbeckst commented May 7, 2017

I merged it as is and ignored the travis failures.

@orbeckst orbeckst deleted the minor-fixes branch May 7, 2017 19:43
@orbeckst
Copy link
Member

orbeckst commented May 7, 2017

Thanks everyone for these "minor fixes"... especial thanks to @kain88-de for repeatedly reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants