Skip to content

Commit

Permalink
reorganize python tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrmnn committed Oct 14, 2018
1 parent f1a937d commit b1e3fa8
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 536 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*.pyc
*.egg-info
/build/
/.coverage
/*.egg-info/
/dist/
/docs/build/
/.pytest_cache/
/.cache/
/.tox/
/htmlcov/
/pyproject.lock
/setup.py
5 changes: 0 additions & 5 deletions .readthedocs.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: python
matrix:
include:
- python: 2.7
env: TOXENV=py27-coverage-codecov
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37-coverage-codecov
dist: xenial
sudo: required
- python: 3.6
stage: deploy
env: TOXENV=docs
before_install:
- pip install tox tox-venv
- |
if [[ $TOXENV != docs ]]; then
pip --upgrade pip"<=18.0"
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
source .travis/install-mopac.sh
fi
install: true
script: tox
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
local-dir: docs/build
on:
branch: master
condition: $TOXENV = docs
5 changes: 5 additions & 0 deletions .travis/install-mopac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wget $MOPAC_DOWNLOAD_URL $MOPAC_PASSWORD_URL
unzip MOPAC2016_for_Linux_64_bit.zip
chmod +x MOPAC2016.exe
export PATH="$PATH:$PWD/.travis"
export MOPACDIR="$PWD"
4 changes: 4 additions & 0 deletions .travis/mopac
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
export LD_LIBRARY_PATH=$MOPACDIR
export MOPAC_LICENSE=$MOPACDIR
$MOPACDIR/MOPAC2016.exe "$@"
13 changes: 0 additions & 13 deletions Pipfile

This file was deleted.

468 changes: 0 additions & 468 deletions Pipfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion berny/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def MopacSolver(cmd='mopac', method='PM7', workdir=None):
input_file = os.path.join(tmpdir, 'job.mop')
with open(input_file, 'w') as f:
f.write(mopac_input)
subprocess.check_output([cmd, input_file])
subprocess.check_call([cmd, input_file])
with open(os.path.join(tmpdir, 'job.out')) as f:
energy = float(next(l for l in f if 'TOTAL ENERGY' in l).split()[3])*ev
next(l for l in f if 'FINAL POINT AND DERIVATIVES' in l)
Expand Down
32 changes: 26 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#!/usr/bin/env python3
import os
import sys
import datetime
import pkg_resources
from unittest.mock import MagicMock

import toml

sys.path.insert(0, os.path.abspath('..'))

class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()

MOCK_MODULES = ['numpy', 'numpy.linalg']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

metadata = toml.load(open('../pyproject.toml'))['tool']['poetry']

project = 'pyberny'
version = metadata['version']
author = ' '.join(metadata['authors'][0].split()[:-1])
description = metadata['description']

extensions = [
'sphinx.ext.autodoc',
Expand All @@ -10,21 +30,21 @@
]
source_suffix = '.rst'
master_doc = 'index'
project = 'pyberny'
author = 'Jan Hermann'
copyright = f'2017-{datetime.date.today().year}, {author}'
version = pkg_resources.require(project)[0].version
release = version
language = None
exclude_patterns = ['build', '.DS_Store']
pygments_style = 'sphinx'
todo_include_todos = True
html_theme = 'alabaster'
html_theme_options = {
'description': 'Molecular geometry optimizer',
'description': description,
'github_button': True,
'github_user': 'azag0',
'github_repo': 'pyberny',
'badge_branch': 'master',
'codecov_button': True,
'travis_button': True,
}
html_sidebars = {
'**': [
Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[tool.poetry]
name = "pyberny"
version = "0.3.4"
description = "Molecular/crystal structure optimizer"
readme = "README.md"
authors = ["Jan Hermann <[email protected]>"]
repository = "https://github.com/azag0/pyberny"
documentation = "https://janhermann.cz/pyberny"
license = "MPL-2.0"
packages = [
{ include = "berny" },
]
classifiers = [
"Environment :: Console",
"Intended Audience :: Science/Research",
"Operating System :: POSIX",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Physics",
]

[tool.poetry.dependencies]
python = "~2.7 || ^3.4"
numpy = "^1.15"

[tool.poetry.dev-dependencies]
pytest = "^3.6"
sphinx = "^1.7"
flake8 = "^3.5"
toml = "^0.10.0"
coverage = "^4.5"

[tool.poetry.scripts]
berny = "berny.cli:main"
36 changes: 36 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[flake8]
ignore = E226,E501,E741

[tool:pytest]
filterwarnings =
ignore::PendingDeprecationWarning

[tox:tox]
minversion = 3.3
requires = tox-venv
envlist = py27

[testenv]
skip_install = true
whitelist_externals = poetry
deps =
pytest
coverage: coverage
codecov: codecov
commands =
poetry install --no-dev
!coverage: pytest -v
coverage: coverage run --source=berny --branch -m pytest -v
codecov: codecov
passenv =
MOPACDIR
codecov: TOXENV CI TRAVIS TRAVIS_*

[testenv:docs]
whitelist_externals = touch
deps =
sphinx
toml
commands =
sphinx-build -d "{toxworkdir}/docs_doctree" docs docs/build
touch docs/build/.nojekyll
31 changes: 0 additions & 31 deletions setup.py

This file was deleted.

Empty file added tests/__init__.py
Empty file.
8 changes: 0 additions & 8 deletions tox.ini

This file was deleted.

0 comments on commit b1e3fa8

Please sign in to comment.