Skip to content

Commit

Permalink
Merge branch 'develop' into increase_smarts_matches
Browse files Browse the repository at this point in the history
  • Loading branch information
IAlibay authored Jun 1, 2022
2 parents e7d6a68 + eea743f commit 30c3f35
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 12 deletions.
247 changes: 247 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
name: Build and upload to PyPI

on:
pull_request:
branches:
- "package-*"
push:
branches:
- "package-*"
tags:
- "package-*"
release:
types:
- published


concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true


defaults:
run:
shell: bash -l {0}


jobs:
build_wheels:
if: "github.repository == 'MDAnalysis/mdanalysis'"
name: Build wheels
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-18.04, manylinux_x86_64]
- [macos-10.15, macosx_*]
- [windows-2019, win_amd64]
python: ["cp38", "cp39", "cp310"]
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: package
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_BUILD_VERBOSITY: 1

- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl
retention-days: 7

build_sdist:
if: "github.repository == 'MDAnalysis/mdanalysis'"
name: build package source distribution
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v2
with:
path: package/dist/*.tar.gz
retention-days: 7

build_sdist_tests:
if: "github.repository == 'MDAnalysis/mdanalysis'"
name: build test source distribution
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./testsuite
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v2
with:
path: testsuite/dist/*.tar.gz
retention-days: 7

upload_testpypi:
if: |
github.repository == 'MDAnalysis/mdanalysis' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package'))
name: testpypi upload
environment: deploy
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist, build_sdist_tests]
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: move_test_dist
run: |
mkdir -p testsuite/dist
mv dist/MDAnalysisTests-* testsuite/dist
- name: upload_source_and_wheels
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN_SRC }}
skip_existing: true
repository_url: https://test.pypi.org/legacy/

- name: upload_tests
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN_TEST }}
packages_dir: testsuite/dist
skip_existing: true
repository_url: https://test.pypi.org/legacy/

upload_pypi:
if: |
github.repository == 'MDAnalysis/mdanalysis' &&
github.event_name == 'release' && github.event.action == 'published'
name: pypi upload
environment: deploy
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist, build_sdist_tests]
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: move_test_dist
run: |
mkdir -p testsuite/dist
mv dist/MDAnalysisTests-* testsuite/dist
- name: upload_source_and_wheels
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_SRC }}

- name: upload_tests
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_TEST }}
packages_dir: testsuite/dist

check_testpypi:
if: |
github.repository == 'MDAnalysis/mdanalysis' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/package'))
name: testpypi check
runs-on: ${{ matrix.os }}
needs: upload_testpypi
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]
type: ["FULL", "MIN"]
exclude:
# Multiple deps don't like windows
- os: windows-latest
python-version: "3.8"
type: "FULL"
- os: windows-latest
python-version: "3.9"
type: "FULL"
- os: windows-latest
python-version: "3.10"
type: "FULL"
# OpenMM isn't available for this yet
- os: macos-latest
python-version: "3.10"
type: "FULL"
env:
MPLBACKEND: agg

steps:
- uses: actions/checkout@v3

- name: setup_miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
auto-update-conda: true
channel-priority: flexible
channels: conda-forge, bioconda
add-pip-as-python-dependency: true
mamba-version: "*"
architecture: x64

- name: install_full_deps
uses: ./.github/actions/setup-deps
if: "matrix.type == 'FULL'"
with:
mamba: true
full-deps: true

- name: install_min_deps
if: "matrix.type == 'MIN'"
run: |
pip install pytest pytest-xdist
- name: pip_install_mda
run: |
awk '/__version__ =/ {print $3; quit}' package/MDAnalysis/version.py | tr -d \" > version.dat
ver=$(python maintainer/norm_version.py --file version.dat)
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple MDAnalysis==$ver
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple MDAnalysisTests==$ver
- name: run_tests
run: |
pytest -n2 --pyargs MDAnalysisTests
8 changes: 1 addition & 7 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, ]
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, "3.10"]
full-deps: [true, ]
install_hole: [true, ]
codecov: [true, ]
include:
- name: linux_mindeps_py3_10
os: ubuntu-latest
python-version: "3.10"
full-deps: false
install_hole: true
codecov: true
- name: macOS_bigsur_py39
os: macOS-11
python-version: 3.9
Expand Down
32 changes: 32 additions & 0 deletions maintainer/norm_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from packaging.version import Version


def norm_version(version_str: str):
"""
Normalize an input version string in the same way that setuptools' dist
does.
Parameters
----------
version_str : str
A version string to normalize.
Returns
-------
str
Normalised version string
"""
return str(Version(version_str))


if __name__ == "__main__":
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--file', type=str, help="file with version to parse")
args = parser.parse_args()

with open(args.file) as filed:
ver = filed.readlines()[0].strip("\n")

print(norm_version(version_str=ver))
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Chronological list of authors
- Mark Verma
- Marcelo D. Poleto
- Ricky Sexton
- Rafael R. Pappalardo


External code
Expand Down
6 changes: 5 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The rules for this file:
HenokB, umak1106, tamandeeps, Mrqeoqqt, megosato, AnirG, rishu235,
mtiberti, manishsaini6421, Sukeerti1, robotjellyzone, markvrma, alescoulie,
mjtadema, PicoCentauri, Atharva7K, aditi2906, orbeckst, yuxuanzhuang,
rsexton2, orioncohen
rsexton2, rafaelpap, richardjgowers, orioncohen

* 2.2.0

Expand Down Expand Up @@ -61,6 +61,10 @@ Enhancements
* Add smarts_kwargs to allow greater flexiblity with smarts atom selection
(Issue #3469, PR #3470).
* Added `frames` argument to AnalysisBase.run to allow analysis to run on
* Added DL_POLY Classic support. Now HISTORY files from DL_POLY Classic can be
* used. (Issue #3678)
* Wheels and dist now get automatically built and deployed on release
triggers (Issue #1300, PR #3680)
* Added equations for `center_of_mass` and `center_of_geometry`to
documentation (PR #3671)
* Added `center_of_charge` attribute (PR #3671)
Expand Down
4 changes: 2 additions & 2 deletions package/MDAnalysis/coordinates/DLPoly.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def __init__(self, filename, **kwargs):
# "private" file handle
self._file = util.anyopen(self.filename, 'r')
self.title = self._file.readline().strip()
header = np.int64(self._file.readline().split())
self._levcfg, self._imcon, self.n_atoms, _, _ = header
header = np.int64(self._file.readline().split()[:3])
self._levcfg, self._imcon, self.n_atoms = header
self._has_vels = True if self._levcfg > 0 else False
self._has_forces = True if self._levcfg == 2 else False

Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/topology/DLPolyParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def parse(self, **kwargs):
ids = []

line = inf.readline()
while not len(line.split()) == 5:
while not (len(line.split()) == 4 or len(line.split()) == 5):
line = inf.readline()
if line == '':
raise EOFError("End of file reached when reading HISTORY.")
Expand Down
32 changes: 32 additions & 0 deletions testsuite/MDAnalysisTests/data/dlpoly/HISTORY_classic
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
DL_POLY Classic: example of HISTORY
0 1 3
timestep 1 3 0 1 0.000500
35.607 0.000 0.000
0.000 35.607 0.000
0.000 0.000 35.607
C 1 39.098300 0.994000
-1.3006E+01 1.1459E+01 -1.6983E+01
B 2 39.098300 0.994000
-1.1628E+01 1.0204E+01 -1.7025E+01
A 3 39.098300 0.994000
-1.4345E+01 1.2719E+01 -1.6813E+01
timestep 2001 3 0 1 0.000500
35.607 0.000 0.000
0.000 35.607 0.000
0.000 0.000 35.607
C 1 39.098300 0.994000
-1.2998E+01 1.1186E+01 -1.7425E+01
B 1 39.098300 0.994000
-1.1677E+01 9.9189E+00 -1.7225E+01
A 1 39.098300 0.994000
-1.4141E+01 1.2646E+01 -1.7451E+01
timestep 4001 3 0 1 0.000500
35.607 0.000 0.000
0.000 35.607 0.000
0.000 0.000 35.607
C 1 39.098300 0.994000
-1.3124E+01 1.1173E+01 -1.7308E+01
B 1 39.098300 0.994000
-1.1651E+01 1.0041E+01 -1.7020E+01
A 1 39.098300 0.994000
-1.4614E+01 1.2287E+01 -1.7416E+01
2 changes: 2 additions & 0 deletions testsuite/MDAnalysisTests/datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"DLP_CONFIG", "DLP_CONFIG_order", "DLP_CONFIG_minimal", # dl_poly 4 config file
"DLP_HISTORY", "DLP_HISTORY_order", "DLP_HISTORY_minimal", # dl_poly 4 history file
"DLP_HISTORY_minimal_cell", # dl_poly 4 history file with cell parameters
"DLP_HISTORY_classic", # dl_poly classic history file
"waterPSF","waterDCD","rmsfArray",
"HoomdXMLdata",
"Make_Whole", # for testing the function lib.mdamath.make_whole, has 9 atoms
Expand Down Expand Up @@ -518,6 +519,7 @@
DLP_HISTORY_order = resource_filename(__name__, "data/dlpoly/HISTORY_order")
DLP_HISTORY_minimal = resource_filename(__name__, "data/dlpoly/HISTORY_minimal")
DLP_HISTORY_minimal_cell = resource_filename(__name__, "data/dlpoly/HISTORY_minimal_cell")
DLP_HISTORY_classic = resource_filename(__name__, "data/dlpoly/HISTORY_classic")

waterPSF = resource_filename(__name__, 'data/watdyn.psf')
waterDCD = resource_filename(__name__, 'data/watdyn.dcd')
Expand Down
Loading

0 comments on commit 30c3f35

Please sign in to comment.