Skip to content

Commit

Permalink
Merge master commit '939ed29769f971374982a0663dcd3ab22d5f74a4' into n…
Browse files Browse the repository at this point in the history
…wchem_qmmm

# Conflicts:
#	moldesign/_tests/helpers.py
#	moldesign/_tests/test_qm_xfaces.py
#	moldesign/compute/compute.py
#	moldesign/fileio.py
#	moldesign/orbitals/wfn.py
  • Loading branch information
avirshup committed Jun 19, 2017
2 parents eca3ac0 + 939ed29 commit 0eab030
Show file tree
Hide file tree
Showing 99 changed files with 2,614 additions and 23,103 deletions.
33 changes: 33 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[paths]
source =
moldesign
*/site-packages/moldesign
*/dist-packages/moldesign


[run]
source = moldesign
omit =
moldesign/_notebooks/*
moldesign/_tests/*
moldesign/_static_data/*
moldesign/_version.py
moldesign/external/*
moldesign/widgets.py
moldesign/interfaces/nbo_interface.py
moldesign/utils/_deadfunctions.py
moldesign/utils/docparsers/google.py

[report]
exclude_lines =
pragma: no cover
def __repr__
def __str__
def _repr_markdown_
raise AssertionError
raise NotImplementedError
if PY2
if future.utils.PY2
def show
def unshow

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Delete the text below if you're not filing a bug report -->
## Bug report
#### Description
<!-- A quick description of what's going wrong -->

#### Steps to reproduce
<!-- If possible, show us how to reproduce the bug, INCLUDING any error messages you receive -->

```python
### code to reproduce the bug goes here ###
```

#### Environment
- Operating system: <!-- e.g., "MacOS 10.12.3" or "Debian 8.8"-->
- `python --version` output: <!-- e.g., "2.7.13" or "Python 3.5.2 :: Continuum Analytics, Inc."-->
- `pip show moldesign nbmolviz | grep -B1 Version` output:
34 changes: 22 additions & 12 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# DEVELOPING MDT

### Setting up a dev environment
(WIP)
(still under construction)

### Install prerequisites (first time only)
To make these instructions reasonably cross-platform, we'll use pyenv as the python environment manager.
### Install prequisites (first time only)
You need to install docker, and an environment manager for Python 3 (Miniconda 3). Here's one way to do that:
1. Install docker: [link]
2. Install pyenv and pyenv-venv: [link]
3. Install miniconda2 by running: `pyenv install miniconda2-latest`
4. Switch to miniconda environment by running: `pyenv shell miniconda2-latest`
3. Install miniconda3 by running: `pyenv install miniconda3-latest`
4. Switch to miniconda environment by running: `pyenv shell miniconda3-latest`

### Set up your environment (first time only)
1. Change directory to the base of the `molecular-design-toolkit` repository
1. Get MDT: `git clone http://github.com/Autodesk/molecular-design-toolkit`
1. `cd molecular-design-toolkit`
1. Create conda environment (optional but recommended) by running: [command to create conda env]
2. Activate the environment: `pyenv shell [environment name???]`
1. Install dev dependencies: `pip install -r requirements.txt DockerMakefiles/requirements.txt moldesign/_tests/requirements.txt`
2. Activate the environment: `pyenv activate [environment name???]`
1. Install dev dependencies: `pip install -r requirements.txt DockerMakefiles/requirements.txt deployment/requirements.txt`
2. Set up for local dev mode (this tells MDT to use your local docker containers):
```bash
mkdir ~/.moldesign
echo "devmode: true" > ~/.moldesign/moldesign.yml
```
8. Link your installation within your environment
8. Install MDT in "development mode":
```
pip install -e molecular-design-toolkit
```

### To activate environment (in any new shell)
1. Run `pyenv shell [environment name???]`
1. Run `pyenv activate [environment name???]`

### To rebuild docker images (first time and after changes that affect dockerized code)
5. Build development versions of all docker images:
Expand Down Expand Up @@ -87,9 +88,18 @@ are considered "stable".

### Releases

1. Decide on the new version number (using [semantic versioning](http://semver.org/)). For our purposes here, we'll pretend it's `0.9.3`.
1. Decide on the new version number (see below). For our purposes here, we'll pretend it's `0.9.3`.
1. Tag the relevant commit (the build must be passing) with a release candidate version number, e.g., `0.9.3rc1`.
1. Codeship will automatically deploy the updated release to PyPI and DockerHub (still WIP 5/17)
1. Codeship will automatically deploy the updated release to PyPI and DockerHub
1. Manually test the example notebooks against this pre-release version.
1. If succesful, tag the relevant commit with the official release version `0.9.3`

### Versioning
For now, we're using a subset [PEP 440](https://www.python.org/dev/peps/pep-0440/):
1. Every release should be of the form MAJOR.MINOR.PATCH, e.g. `0.1.2`
2. Pre-releases should be numbered consecutively, and may be alpha, beta, or "release candidate", e.g. `1.0.1rc3` or `0.5.3a1`
3. Our deployment infrastructure uses this regular expression to accept version strings:
`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)((a|rc|b)(0|[1-9]\d*))?$`

### Maintainers: updating the documentation

Expand Down
3 changes: 2 additions & 1 deletion DockerMakefiles/Moldesign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ moldesign_minimal_requirements:
&& apt-get install -y gcc \
&& pip install -r /tmp/mdtreqs.txt
COPY . /opt/molecular-design-toolkit
RUN pip install -e /opt/molecular-design-toolkit
WORKDIR /opt/molecular-design-toolkit
RUN python setup.py sdist && pip install `ls -t dist/*.tar.gz | head -n1`
moldesign_minimal:
requires:
Expand Down
2 changes: 1 addition & 1 deletion DockerMakefiles/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DockerMake >= 0.5.3
DockerMake >= 0.5.6
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include CONTRIBUTING.md
include DEVELOPMENT.md
include NOTICES
include moldesign/HISTORY.rst
include .coveragerc
recursive-include moldesign/_static_data *.*
recursive-include moldesign/_notebooks *.*
global-exclude *.py[cod] __pycache__ *~ *.bak
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<img src="moldesign/_notebooks/img/Header.png">

[![PyPI version](https://badge.fury.io/py/moldesign.svg)](https://badge.fury.io/py/moldesign)
[![GitHub version](https://badge.fury.io/gh/autodesk%2Fmolecular-design-toolkit.svg)](https://badge.fury.io/gh/autodesk%2Fmolecular-design-toolkit)
<a href="https://github.com/autodesk/molecular-design-toolkit/blob/master/LICENSE" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgb(70, 61, 84);"><img src="https://img.shields.io/badge/license-Apache%202-blue.svg"> </a>
[ ![Codeship Status for Autodesk/molecular-design-toolkit](https://app.codeship.com/projects/5ed079f0-08f6-0135-3493-3696d72919a3/status?branch=master)](https://app.codeship.com/projects/214515)
[![Coverage Status](https://coveralls.io/repos/github/Autodesk/molecular-design-toolkit/badge.svg?branch=master)](https://coveralls.io/github/Autodesk/molecular-design-toolkit?branch=master)
[![PyPI version](https://img.shields.io/pypi/v/moldesign.svg?label=dev)](https://pypi.python.org/pypi/moldesign)
[![github release tag](https://img.shields.io/github/release/autodesk/molecular-design-toolkit.svg?label=stable)](https://pypi.python.org/pypi/moldesign)
![Python versions](https://img.shields.io/pypi/pyversions/moldesign.svg)
[![License](https://img.shields.io/pypi/l/moldesign.svg)](LICENSE.md)
[ ![Codeship Status for Autodesk/molecular-design-toolkit](https://img.shields.io/codeship/5ed079f0-08f6-0135-3493-3696d72919a3/master.svg)](https://app.codeship.com/projects/214515)
[![Coverage Status](https://img.shields.io/coveralls/Autodesk/molecular-design-toolkit/master.svg)](https://coveralls.io/github/Autodesk/molecular-design-toolkit?branch=master)

**Try it now:** [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org:/repo/avirshup/mdt-gallery-test)

Expand Down
13 changes: 7 additions & 6 deletions codeship-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ docker_make:
publisher:
encrypted_env_file: deployment/tokens.crypt
build:
context: .
dockerfile: ./deployment/build-env.dockerfile
context: ./deployment
dockerfile: ./moldesign-complete-cache.dockerfile
add_docker: true
working_dir: /opt/molecular-design-toolkit
volumes:
- ./tmp/reports:/opt/reports

Expand All @@ -22,7 +23,7 @@ test_moldesign_minimal:
context: ./deployment
dockerfile: moldesign-minimal-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: minimal
Expand All @@ -36,7 +37,7 @@ test_moldesign_minimal_py2:
context: ./deployment
dockerfile: moldesign-minimal-py2-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: minimal
Expand All @@ -50,7 +51,7 @@ test_moldesign_complete:
context: ./deployment
dockerfile: moldesign-complete-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: complete
Expand All @@ -64,7 +65,7 @@ test_moldesign_complete_py2:
context: ./deployment
dockerfile: moldesign-complete-py2-cache.dockerfile
cached: false # do not cache this! It gets built before the cache is triggered
working_dir: /opt/molecular-design-toolkit/moldesign/_tests
working_dir: /opt/molecular-design-toolkit/
add_docker: true
environment:
TESTENV: complete
Expand Down
30 changes: 8 additions & 22 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,36 +60,22 @@
service: docker_make
command: docker-make --all --tag dev

- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_complete
name: complete_test_py3
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_minimal
name: minimal_test_py3
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_complete_py2
name: complete_test_py2
- command: ../../deployment/codeship_runtests.sh
- command: deployment/codeship_runtests.sh
service: test_moldesign_minimal_py2
name: minimal_test_py2

# TODO: test the merged versions of PRs; test additional environments sometimes

#- name: code_coverage
# service: test_moldesign_complete
# command: cd /opt/molecular-design-toolkit/ && coveralls

- name: publish
service: publisher
# matches tags that are valid semantic versions
tag: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$'
type: serial
steps:
- command: exit 1 # test that the code has the right version (and test that it's a good semver?)
name: verify_version
- command: build any additional images for deployment (moldesign_notebook, at least?)
tag: build_notebook
- command: tag and push docker images
name: docker_deploy
- command: upload package to pypi
name: pypi_deploy
# matches tags that are valid PEP440 versions
tag: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)((a|rc|b)(0|[1-9]\d*))?$'
command: deployment/publish.sh

14 changes: 0 additions & 14 deletions deployment/check_pkg_version.sh

This file was deleted.

28 changes: 20 additions & 8 deletions deployment/codeship_runtests.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
#!/usr/bin/env bash
# this script expects to run from the root of the repository

# this script expects to run from the moldesign/_tests directory
# fail immediately if any command fails:
set -e

VERSION="${TESTENV}.py${PYVERSION}"
PYTESTFLAGS="-n 6 --durations=20 --junit-xml=/opt/reports/junit.${VERSION}.xml --timeout=1800"
if [ "${TESTENV}" == "complete" ]; then
PYTESTFLAGS="--cov .. --cov-config=./.coveragerc ${PYTESTFLAGS}"
PYTESTFLAGS="-n 5 --durations=20 --junit-xml=/opt/reports/junit.${VERSION}.xml --timeout=1800 --tb=short"
if [ "${VERSION}" == "complete.py3" ]; then
PYTESTFLAGS="--cov moldesign ${PYTESTFLAGS}"
fi


function send_status_update(){
python ../../deployment/send_test_status.py "${1}" "${2}"
python deployment/send_test_status.py "${1}" "${2}"
}


function check_if_tests_should_run(){
echo "Should I run the tests in this environment?"
echo "Should I run the tests in this environment?"
runthem=false

if [[ "${CI_COMMIT_MESSAGE}" == *"--fast-ci-tests"* && "${VERSION}" != "complete.py3" ]]; then
echo "NO: found \"--fast-ci-tests\" flag in commit message; run complete.py3 only"
exit 0
fi

if [ "${TESTENV}" == "complete" ]; then
runthem=true
Expand All @@ -38,7 +46,6 @@ function check_if_tests_should_run(){
echo "SKIPPING tests in this environment."
echo "To run these tests, add \"--testall\" to your commit message"
echo "(or work in the dev or deploy branches)"
send_status_update 0 "Skipped (dev/deploy branches only)"
exit 0
fi
}
Expand All @@ -47,6 +54,11 @@ function check_if_tests_should_run(){
function run_tests(){
send_status_update "na" "Starting tests for ${VERSION}"

echo
echo "Test command running in working dir '$(pwd)':"
echo "py.test ${PYTESTFLAGS}"
echo

py.test ${PYTESTFLAGS} | tee /opt/reports/pytest.${VERSION}.log
exitstat=${PIPESTATUS[0]}

Expand All @@ -57,7 +69,7 @@ function run_tests(){

send_status_update "${exitstat}" "${statline}"

if [ "${TESTENV}" == "complete" ]; then
if [ "${VERSION}" == "complete.py3" ]; then
if [[ ${exitstat} == 0 && "$CI_BRANCH" != "" ]]; then
coveralls || echo "Failed to upload code coverage stats"
else
Expand Down
3 changes: 3 additions & 0 deletions deployment/moldesign-complete-cache.dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FROM moldesign_complete:dev
ADD requirements.txt provision_testrunner_image.sh /tmp/
RUN cd /tmp && ./provision_testrunner_image.sh
RUN pip install twine
WORKDIR /opt/molecular-design-toolkit
RUN pip install -r DockerMakefiles/requirements.txt
9 changes: 6 additions & 3 deletions deployment/provision_testrunner_image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Gets image ready to run tests

mkdir -p ~/.moldesign \
&& echo devmode: true >> ~/.moldesign/moldesign.yml \
&& pip install -r ./requirements.txt
set -e

mkdir -p ~/.moldesign
echo devmode: true >> ~/.moldesign/moldesign.yml
pip install -r ./requirements.txt
25 changes: 25 additions & 0 deletions deployment/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Publish a new release (triggered by a git tag that conforms to a PEP440 release)
# Exit 1 if there's a mismatch between the git tag and the package's version
# Expects to run in base directory

# fail immediately if any command fails:
set -e

pyversion=$(python -m moldesign version | tail -n 1)

if [ "${pyversion}" == "${CI_BRANCH}" ]; then
echo "Deploying version ${CI_BRANCH}"
else
echo "Can't publish - moldesign package version '${pyversion}' differs from its Git tag '${CI_BRANCH}'"
exit 1
fi

docker-make -f DockerMakefiles/DockerMake.yml \
--repo docker.io/autodesk/moldesign: \
--tag ${pyversion} \
--all \
--push --user ${DOCKERHUB_USER} --token ${DOCKERHUB_PASSWORD}

twine upload -u ${PYPI_USER} -p ${PYPI_PASSWORD} dist/moldesign-${pyversion}.tar.gz
7 changes: 5 additions & 2 deletions deployment/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Python dependencies for the build/test environment
coveralls
nbformat
pathlib ; python_version < '3.5'
PyGithub
pytest-cov
pytest-xdist
pytest-xdist != 1.17.0
pytest-timeout
coveralls

Loading

0 comments on commit 0eab030

Please sign in to comment.