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

Updates to MDAnalysis v2.0.0 and CI #58

Merged
merged 20 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# this action must be synchronized with version-bump-and-package.yml
name: test_build
name: build

on:
pull_request:
Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test_docs
name: docs

on:
push:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/install-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: install-dev

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: taurenmddev
environment-file: requirements-dev.yml
python-version: ${{ matrix.python-version }}
channels: conda-forge
auto-activate-base: false

- shell: bash -l {0}
run: |
conda info
conda list

# - name: Install dependencies
# run: |
# conda env update -n taurenmddev --file requirements-dev.yml

- name: Test versions
shell: bash -l {0}
run: |
python -c "from mdtraj import version; print('mdtraj version: ', version.version)"
python -c "from openmm import version; print('openmm version: ', version.version)"
python -c "from MDAnalysis import version; print('MDAnalysis version: ', version.__version__)"
38 changes: 38 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: install

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: taurenmd
environment-file: requirements.yml
python-version: ${{ matrix.python-version }}
channels: conda-forge
auto-activate-base: false

- shell: bash -l {0}
run: |
conda info
conda list

- name: Test versions
shell: bash -l {0}
run: |
python -c "from mdtraj import version; print('mdtraj version: ', version.version)"
python -c "from openmm import version; print('openmm version: ', version.version)"
python -c "from MDAnalysis import version; print('MDAnalysis version: ', version.__version__)"
2 changes: 1 addition & 1 deletion .github/workflows/py36.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test_py36
name: pytest_py36

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/py37.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test_py37
name: pytest_py37

on:
push:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/py38.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pytest_py38

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
python-version: 3.8
channels: conda-forge

- name: Install dependencies
run: |
conda install pip setuptools wheel tox coverage[toml]

- name: Test with tox
run: tox -e py38

# from https://github.com/codecov/codecov-action
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
36 changes: 36 additions & 0 deletions .github/workflows/py39.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pytest_py39

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
python-version: 3.9
channels: conda-forge

- name: Install dependencies
run: |
conda install pip setuptools wheel tox coverage[toml]

- name: Test with tox
run: tox -e py39

# from https://github.com/codecov/codecov-action
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Upon version 0.8, and before version 1, SV2 major version increments are reflect
Changelog
=========

* Updates MDAnalysis to version 2.0.0
* Defines versions for all other dependencies
* Updates CI

v0.9.9 (2021-11-22)
------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ taurenmd
:alt: Zenodo

.. image:: https://github.com/joaomcteixeira/taurenmd/workflows/Tests/badge.svg?branch=master
:target: https://github.com/joaomcteixeira/taurenmd/actions?workflow=test_py37
:target: https://github.com/joaomcteixeira/taurenmd/actions?workflow=pytest_py37
:alt: Test Status

.. image:: https://img.shields.io/readthedocs/taurenmd/latest?label=Read%20the%20Docs
Expand Down
29 changes: 20 additions & 9 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ If you use `Anaconda`_ as your Python package manager just do the following on y

If for some reason the above does not work, just open the link on your WebBrowser and save the text to a file (or save the file).

2. Create a new Anaconda Python environment to host *taurenmd*::
2. Create a new Anaconda Python environment to host *taurenmd*. Choose the python version that best fits your needs; if you are not sure chose 3.7.::

conda env create -f taurenmdenv.yml
conda create -n taurenmd python=3.8
conda env update -n taurenmd --file taurenmddev.yml

Where ``taurenmdenv.yml`` is the file downloaded in the previous step.

Expand Down Expand Up @@ -87,21 +88,25 @@ We do not provide support for other distribution platforms such as `HomeBrew <ht
From GitHub
```````````

If you are a proficient Pythonista you might want to install **taurenmd** from a development branch on GitHub. If that is the case you might not need to read this section because you already know well what to do; nonetheless, let's go through it:
If you are a proficient Pythonista you might want to install **taurenmd** directly from the GitHub repository. If that is the case you might not need to read this section because you already know well what to do; nonetheless, let's go through it:

.. note::

``taurenmd`` follows :ref:`Semantic Version 2.0 <Versioning>`, meaning that every single new addition to the master branch gets released on PyPI with a new version number. Therefore, installing from the ``master`` GitHub branch actually adds no benefit to installing with ``pip``.

#. Install the MD analysis libraries as described in the above sections
#. Clone our repository: ``git clone https://github.com/joaomcteixeira/taurenmd``
#. Place yourself in the new ``taurenmd`` folder, in Linux-like systems: ``cd taurenmd``.
#. ``git checkout -b the-branch-you-want-to-use``
#. Install **taurenmd** with the following command: ``python setup.py develop``
#. Install the dependencies using Anaconda. Choose your preferred python version.::

conda create -n taurenmd python=3.8
conda env update -n taurenmd --file requirements-dev.yml

#. Install **taurenmd** with the following command: ``python setup.py develop --no-deps``
#. In the future, to keep your installation up to the latest:

#. pull repository updates from the upstream repository: ``git pull`` (from within ``taurenmd`` git folder)
#. because taurenmd developments are mostly reflected on new interfaces you need to update those as well: ``python setup.py develop``
#. because taurenmd developments are mostly reflected on new interfaces you need to update those as well: ``python setup.py develop --no-deps``
#. beaware, if the version increment denotes API breaks you might need to reinstall ``taurenmd`` from scratch.

Running taurenmd
----------------
Expand All @@ -115,9 +120,15 @@ Please read our :ref:`Usage` page for, *whatelse*, usage instructions and exampl
Upgrade
-------

To upgrade *taurenmd* and all its dependencies to the latest version::
To upgrade *taurenmd* and all its dependencies to the latest version:

#. If you installed from PyPI::

pip3 install -U --force-reinstall taurenmd

#. If you installed from Anaconda::

pip3 install -U --force-reinstall taurenmd
pip3 install -U --force-reinstall taurenmd --no-deps

Something failed
----------------
Expand Down
10 changes: 4 additions & 6 deletions requirements-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ channels:
- omnia
- defaults
dependencies:
- python=3.7
- tox
- tox-conda
- mdanalysis
- mdtraj
- openmm
- tox=3
- mdanalysis=2
- mdtraj>=1.9,<2
- openmm>=7.6,<8
- matplotlib=3
- numpy=1
- pip
7 changes: 3 additions & 4 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ channels:
- omnia
- defaults
dependencies:
- python=3.7
- mdanalysis
- mdtraj
- openmm
- mdanalysis=2
- mdtraj>=1.9,<2
- openmm>=7.6,<8
- matplotlib=3
- numpy=1
- pip
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

# Molecular Dynamics deps
mddeps = [
'MDAnalysis>=0.2,<1',
'MDAnalysis==2',
'mdtraj>=1,<2',
]

Expand Down Expand Up @@ -91,6 +91,8 @@ def _read(*names, **kwargs):
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Utilities',
],
project_urls={
Expand All @@ -107,7 +109,7 @@ def _read(*names, **kwargs):
'Molecular Biology',
'Biochemistry',
],
python_requires='>=3.6, <3.8',
python_requires='>=3.6, <3.10',
install_requires=install_requires,
extras_require={
'all': alldeps,
Expand Down
9 changes: 7 additions & 2 deletions src/taurenmd/cli_trajedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def main(
traj_output='traj_out.dcd',
top_output=None,
unwrap=False,
unwrap_reference=None,
unwrap_reference='com',
unwrap_compound='fragments',
align=False,
**kwargs,
Expand All @@ -165,7 +165,12 @@ def main(
topology = Path(topology)
trajectories = [Path(t) for t in trajectories]

u = libmda.load_universe(topology, *trajectories, insort=insort)
u = libmda.load_universe(
topology,
*trajectories,
insort=insort,
guess_bonds=unwrap,
)

if unwrap:
log.info(T('unwrapping'))
Expand Down
14 changes: 13 additions & 1 deletion src/taurenmd/libs/libmda.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@


@libcli.add_reference(tcore.ref_mda)
def load_universe(topology, *trajectories, insort=False):
def load_universe(
topology,
*trajectories,
insort=False,
**universe_args):
"""
Load MDAnalysis universe.

Expand Down Expand Up @@ -54,6 +58,13 @@ def load_universe(topology, *trajectories, insort=False):
Paths to trajectory file(s). Trajectory files will be used
sequentially to create the Universe.

insort : bool
Whether to sort trajectory files by suffix number.
See :func:`libio.sort_numbered_input`.

universe_args : any
Other arguments to be passed to `MDAnalysis Universe`.

Return
------
MDAnalysis Universe
Expand All @@ -65,6 +76,7 @@ def load_universe(topology, *trajectories, insort=False):
universe = mda.Universe(
Path(topology).str(),
[Path(i).str() for i in trajectories],
**universe_args,
)
report(universe)
return universe
Expand Down
Loading