Skip to content

Commit

Permalink
Merge tag 'release-0.5.1'
Browse files Browse the repository at this point in the history
release 0.5.1 (bug fixes)
  • Loading branch information
orbeckst committed Jun 29, 2016
2 parents c014e27 + 9e4da49 commit 04c246d
Show file tree
Hide file tree
Showing 51 changed files with 740 additions and 15,647 deletions.
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
branch = True
source = gromacs

[report]
exclude_lines =
pragma: no cover
def __repr__
def _repr_html_
def __str__
raise NotImplementedError
if __name__ == .__main__.:

omit =
gromacs/tests/*
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install:

# run tests
script:
- py.test --cov gromacs/tests --pep8 gromacs/tests
- py.test --cov gromacs

after_success:
- codecov
17 changes: 16 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
CHANGELOG for GromacsWrapper
==============================

2016-xx-xx 0.4.1
2016-06-29 0.5.1
whitead, dotsdl, orbeckst

* fixed: check_mdrun_success() works now for Gromacs 4 and Gromacs 5
(issue #64)
* fixed: MDRunner working for Gromacs 4 and Gromacs 5 (issue #64)
* fixed setup.energy_minimize() not falling back to single precision
mdrun (issue #63)
* fixed: added missing alias "gmx solvate" <--> "genbox" (issue #62)
* added keyword argument use_shell=True to Command() to make Popen use
the shell
* added template for Gromacs 4.6.x gromacswrapper.cfg
* improved testing


2016-05-23 0.5.0
quantifiedcode-bot, orbeckst, jandom, whitead

* requires Python 2.7
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include py setup.py COPYING COPYING.LESSER README.rst CHANGES
include setup.py COPYING COPYING.LESSER README.rst CHANGES
recursive-include scripts *.py
graft gromacs/templates/
9 changes: 8 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
README: GromacsWrapper
========================

|zenodo| |docs|
|build| |cov| |docs| |zenodo|

A primitive wrapper around the Gromacs tools until we have proper
python bindings. It also provides a small library (cook book) of
Expand All @@ -27,6 +27,13 @@ running simulations with sensible parameters.
http://gromacswrapper.readthedocs.org/en/latest/
.. _GromacsWrapper git repository:
http://github.com/Becksteinlab/GromacsWrapper
.. |build| image:: https://travis-ci.org/Becksteinlab/GromacsWrapper.svg?branch=develop
:target: https://travis-ci.org/Becksteinlab/GromacsWrapper
:alt: Build Status
.. |cov| image:: https://codecov.io/gh/Becksteinlab/GromacsWrapper/branch/develop/graph/badge.svg
:target: https://codecov.io/gh/Becksteinlab/GromacsWrapper?branch=develop
:alt: Code Coverage
:scale: 100%
.. |zenodo| image:: https://zenodo.org/badge/13219/Becksteinlab/GromacsWrapper.svg
:target: https://zenodo.org/badge/latestdoi/13219/Becksteinlab/GromacsWrapper
:alt: Latest release on zenodo (with DOI)
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ dependencies:
- gromacs>=5.1
- numpy>=1.9
- scipy
- pandas
- pip:
- recsql>=0.7
8 changes: 4 additions & 4 deletions gromacs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Contains classes that wrap the gromacs tools. They are automatically
generated from the list of tools in :data:`gromacs.tools.gmx_tools`.
:mod:`gromacs.formats`
:mod:`gromacs.fileformats`
Classes to represent data files in various formats such as
xmgrace graphs. The classes allow reading and writing and for
graphs, also plotting of the data.
Expand Down Expand Up @@ -112,7 +112,7 @@
-----------------------
A number of package-specific exceptions (:exc:`GromacsError`) and
warnings (:exc:`GromacsFailureWarning`, :exc:`GromacsImportWarning`,
warnings (:exc:`GromacsFailureWarning`, :exc:`GromacsImportWarning`,
:exc:`GromacsValueWarning`, :exc:`AutoCorrectionWarning`,
:exc:`BadParameterWarning`) can be raised.
Expand Down Expand Up @@ -230,13 +230,13 @@ def start_logging(logfile="gromacs.log"):
The default logfile is named ``gromacs.log`` and messages are
logged with the tag *gromacs*.
"""
import log
from . import log
log.create("gromacs", logfile=logfile)
logging.getLogger("gromacs").info("GromacsWrapper %s STARTED logging to %r", get_version(), logfile)

def stop_logging():
"""Stop logging to logfile and console."""
import log
from . import log
logger = logging.getLogger("gromacs")
logger.info("GromacsWrapper %s STOPPED logging", get_version())
log.clear_handlers(logger) # this _should_ do the job...
Expand Down
18 changes: 11 additions & 7 deletions gromacs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ def Popen(self, *args,**kwargs):

stdin = kwargs.pop('stdin', None)
input = kwargs.pop('input', None)

use_shell = kwargs.pop('use_shell', False)
if input:
stdin = PIPE
if isinstance(input, basestring):
Expand All @@ -267,8 +269,8 @@ def Popen(self, *args,**kwargs):
# (cannot move out of method because filtering of stdin etc)
try:
p = PopenWithInput(cmd, stdin=stdin, stderr=stderr, stdout=stdout,
universal_newlines=True, input=input)
except OSError,err:
universal_newlines=True, input=input, shell=use_shell)
except OSError as err:
logger.error(" ".join(cmd)) # log command line
if err.errno == errno.ENOENT:
errmsg = "Failed to find Gromacs command %r, maybe its not on PATH or GMXRC must be sourced?" % self.command_name
Expand Down Expand Up @@ -493,7 +495,7 @@ def __init__(self, *args, **kwargs):
self.failuremode = kwargs.pop('failure','raise')
self.extra_doc = kwargs.pop('doc',None)
self.gmxargs = self._combineargs(*args, **kwargs)
self.__doc__ = self.gmxdoc
self.__doc__ = self.gmxdoc

def failuremode():
doc = """mode determines how the GromacsCommand behaves during failure
Expand Down Expand Up @@ -602,7 +604,7 @@ def _get_gmx_docs(self):
.. Note::
The header is on STDOUT and is ignored. The docs are read from STDERR in GMX 4.
The header is on STDOUT and is ignored. The docs are read from STDERR in GMX 4.
In GMX 5, the opposite is true (Grrr)
"""
# Uses the class-wide arguments so that 'canned invocations' in cbook
Expand All @@ -612,15 +614,15 @@ def _get_gmx_docs(self):
# temporarily throttle logger to avoid reading about the help function invocation or not found
logging.disable(logging.CRITICAL)
try:
rc,header,docs = self.run('h', stdout=PIPE, stderr=PIPE, use_input=False)
rc,header,docs = self.run('h', stdout=PIPE, stderr=PIPE, use_input=False)
except:
logging.critical("Invoking command {} failed when determining its doc string. Proceed with caution".format(self.command_name))
return "(No Gromacs documentation available)"
return "(No Gromacs documentation available)"
finally:
logging.disable(logging.NOTSET) # ALWAYS restore logging....
m = re.match(self.doc_pattern, docs, re.DOTALL) # keep from DESCRIPTION onwards
if m is None:
m = re.match(self.doc_pattern, header, re.DOTALL) # Try now with GMX 5 approach
m = re.match(self.doc_pattern, header, re.DOTALL) # Try now with GMX 5 approach
if m is None:
return "(No Gromacs documentation available)"
return m.group('DOCS')
Expand Down Expand Up @@ -675,11 +677,13 @@ def __init__(self,*args,**kwargs):
input_string = ""
self.command_string = input_string + " ".join(self.command)
super(PopenWithInput,self).__init__(*args,**kwargs)

def communicate(self, use_input=True):
"""Run the command, using the input that was set up on __init__ (for *use_input* = ``True``)"""
if use_input:
return super(PopenWithInput,self).communicate(self.input)
else:
return super(PopenWithInput,self).communicate()

def __str__(self):
return "<Popen on %r>" % self.command_string
10 changes: 8 additions & 2 deletions gromacs/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.

"""
:mod:`gromacs.formats` -- Accessing various files
""":mod:`gromacs.formats` -- Accessing various files
=================================================
This module contains classes that represent data files on
Expand All @@ -23,6 +22,11 @@
do *not* make use of :mod:`gromacs.tools` or :mod:`gromacs.cbook` and
can be safely imported at any time.
.. SeeAlso::
This module gives access to a selection of classes from
:mod:`gromacs.fileformats`.
Classes
-------
Expand All @@ -39,6 +43,8 @@
:members:
.. autoclass:: XPM
:members:
.. autoclass:: TOP
:members:
"""
from __future__ import absolute_import
Expand Down
Loading

0 comments on commit 04c246d

Please sign in to comment.