Skip to content

Commit

Permalink
new_release New_add_doc (#71)
Browse files Browse the repository at this point in the history
* Avoid simple pass in Exceptions

* Restrict coverage folders in GH action

* Removed ipython from poetry

* Refactored copy_log in cli.py

* How to setup for dev

* Improved exception handling

* Added a janitor fixture for pytest

* Fixed ver_today with pcregrep (linux/macos)

* Remove ipython dev dependency

* Test verboless

* Fixed bug for sorted atomPairs

* Test ILDN with -z exception

* Test ILDN with -z exception improved

* Corrected logger().exception use

* Install poetry via curl

* Pytest in random order

* Test for corrupt glycam

* Added sphinx and docs

* Adding docs, just starting

* Fixed some badges

* Added info about documenting

* Improved doc example

* Trying to refine actions

* Use dynamic year for copyright

* Tests for mol and mdl formats

* Test sqm fails due to wrong charge input

* Typings and docs

* Test for ekFlag

* Try/exception around setResNameCheckCoords()

* Remove try/exception around os.chdir(mol.rootDir)

* Tests about resname

* tests for empty amber files

* Test mol geometry

* Check resname

* convertSmilesToMol2: redundant obabel check

* Increasing coverage about charges

* Fixed regex in ver_today.sh

* Poetry added pyupgrade, pre-commit and sphinx

* Make check_acpype.py to work, still need more

* Pyupgraded

* Added printErrorQuoted

* pre-commit end-of-file-fixer

* pid and docstrings errors cleared
  • Loading branch information
alanwilter authored Jan 3, 2022
1 parent 58aed59 commit f25680b
Show file tree
Hide file tree
Showing 196 changed files with 2,744 additions and 935 deletions.
224 changes: 115 additions & 109 deletions .github/workflows/check_acpype.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,120 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: check_acpype

on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "acpype/**"
- "tests/**"

jobs:
check-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# - name: Python Poetry Action
# uses: abatilo/[email protected]

- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Set Env
run: |
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
echo "AMBERHOME=$PWD/acpype/amber21-11_linux" >> $GITHUB_ENV
echo "$PWD/acpype/amber21-11_linux/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends tzdata libarpack++2-dev
- name: Install OpenBabel
run: |
sudo apt-get install --no-install-recommends -y openbabel
- name: Poetry install dependencies
run: |
pip3 install poetry
poetry add openbabel-wheel
poetry install
- name: Lint with flake8
run: poetry run flake8 -v --count

- name: Check format with black
run: poetry run black --diff --check .

- name: Run isort
run: poetry run isort . --check-only --profile black

- name: Test with PyTest
run: |
poetry run pytest --color=yes --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == 3.6
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true

release:
needs: check-test
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y.%-m.%-d')"

- name: Create tag
# will only create a new release if the commit message is 'new_release' to master branch
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'new_tag')
uses: actions/github-script@v3
with:
# github-token: ${{ github.token }} # optional
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.date.outputs.date }}",
sha: context.sha
})
- name: Create Release
# will only create a new release if the commit message is 'new_release' to master branch
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'new_release')
id: create_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.date.outputs.date }}
release_name: Release ${{ steps.date.outputs.date }}
draft: false
prerelease: false
check-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# - name: Python Poetry Action
# uses: abatilo/[email protected]

- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Set Env
run: |
echo "PYTEST_ADDOPTS=--random-order" >> $GITHUB_ENV
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
echo "AMBERHOME=$PWD/acpype/amber21-11_linux" >> $GITHUB_ENV
echo "$PWD/acpype/amber21-11_linux/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends tzdata libarpack++2-dev
- name: Install OpenBabel
run: |
sudo apt-get install --no-install-recommends -y openbabel
- name: Poetry install dependencies
run: |
pip3 install poetry
poetry add openbabel-wheel
poetry install
- name: Lint with flake8
run: poetry run flake8 -v --count

- name: Check format with black
run: poetry run black --diff --check .

- name: Run isort
run: poetry run isort . --check-only --profile black

- name: Test with PyTest
run: |
poetry run pytest --color=yes --cov=acpype --cov=tests --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == 3.6
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true

release:
needs: check-test
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y.%-m.%-d')"

- name: Create tag
# will only create a new release if the commit message is 'new_release' to master branch
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'new_tag')
uses: actions/github-script@v3
with:
# github-token: ${{ github.token }} # optional
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.date.outputs.date }}",
sha: context.sha
})
- name: Create Release
# will only create a new release if the commit message is 'new_release' to master branch
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'new_release')
id: create_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.date.outputs.date }}
release_name: Release ${{ steps.date.outputs.date }}
draft: false
prerelease: false
12 changes: 8 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# You may wish to alter this file to override the set of languages analysed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
Expand All @@ -13,10 +13,14 @@ name: "CodeQL"

on:
push:
branches: [master]
branches:
- master
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
branches:
- master
paths:
- "acpype/**"
- "tests/**"
schedule:
- cron: "15 0 * * *"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ coverage.xml

# Sphinx documentation
docs/_build/
docs/_autosummary

pip-selfcheck.json
*.acpype
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
# - id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: debug-statements

- repo: local
hooks:
- id: flake8
Expand All @@ -19,6 +27,12 @@ repos:
language: system
types: [python]
require_serial: true
- id: pyupgrade
name: pyupgrade
entry: poetry run pyupgrade --py36-plus
language: system
types: [python]
require_serial: true
- id: ver_today
name: ver_today
entry: ./scripts/ver_today.sh
Expand Down
71 changes: 71 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Instructions for setting up a development environment

## For Coding

For `Linux` (Ubuntu 20 recommended) and `macOS`. Anyway, `CONDA` is strongly recommended.
Also recommended is GPG key, so do accordingly in [GitHub](https://docs.github.com/articles/generating-a-gpg-key/).

```bash
curl -sSL https://install.python-poetry.org | python3 -

conda create -n acpype python=3.9 ambertools openbabel ocl-icd-system ipython gromacs=2019.1 -y
# ocl-icd-system: case you have GPU

conda activate acpype

git clone https://github.com/alanwilter/acpype.git

cd acpype

poetry install

pre-commit install

pre-commit run -a

sys=$(perl -e '`uname` eq "Darwin\n" ? print "os" : print "linux"')

cp ./acpype/amber21-11_${sys}/bin/charmmgen $(dirname $(which antechamber))

git config user.email _email_ # as seen in 'gpg --list-secret-keys --keyid-format=long'

git config user.signingkey _singing_key_ # as seen in 'gpg --list-secret-keys --keyid-format=long'

git config commit.gpgsign true

pytest --cov=tests --cov=acpype --cov-report=term-missing:skip-covered --cov-report=xml
```

If using `VSCode`:

- Enable `enableCommitSigning` in `settings.json` (***Workspace*** recommended):

```yml
"git.enableCommitSigning": true,
```
- Another `VSCode` nuisance, if using its graphic buttons for commit etc.: its environment won't necessarily recognise the dependencies installed via `poetry` under `conda` environment named `acpype` (unless you have started `VSCode` from folder repository with command `code .`). To avoid troubles do:

```bash
conda deactivate
poetry install # it will create its own virtualenv
```

You could use this `poetry virtualenv` as the `Python Interpreter` for `VSCode`, however `ambertools`, `gromacs` and `openbabel` won't be available (unless you've had installed them system wide by other means rather than `conda`).
To avoid further troubles, go back to `conda activate acpype` and remember to do the instructions above if you add new dependencies to the project via `poetry`.

## For Documenting

Using [Sphinx](https://www.sphinx-doc.org) with theme from `pip install sphinx-rtd-theme`.

Online documentation provided by [Read the Docs](http://acpype.readthedocs.io).

To test it locally:

```bash
cd docs/
make clean
make html
```

Then open `_build/html/index.html` in a browser.
2 changes: 1 addition & 1 deletion FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: [alanwilter]
custom: ["https://www.paypal.me/alanwilter"]
custom: ["https://www.paypal.me/alanwilter"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=plastic)](https://github.com/pre-commit/pre-commit)
[![Commits since release](https://img.shields.io/github/commits-since/alanwilter/acpype/2021.12.24/master?style=plastic)](https://github.com/alanwilter/acpype/commits/master)
[![Codecov](https://img.shields.io/codecov/c/github/alanwilter/acpype?style=plastic)](https://app.codecov.io/gh/alanwilter/acpype)

[![Documentation Status](https://readthedocs.org/projects/acpype/badge/?version=latest&style=plastic)](https://acpype.readthedocs.io/en/latest/?badge=latest)
[![Citations](https://img.shields.io/static/v1?label=Citations&message=1040&color=orange&style=plastic)](https://scholar.google.com/scholar?hl=en&as_sdt=2005&sciodt=0%2C5&cites=15065215520855508960&scipsc=&q=ACPYPE-Antechamber+python+parser+interface&btnG=)
<!-- [![DOI:doi.org/10.1186/1756-0500-5-367](https://img.shields.io/badge/DOI-10.1186%2F1756--0500--5--367-blue?style=plastic)](https://doi.org/10.1186/1756-0500-5-367) -->
<!-- [![Google Scholar Citations](https://openbabel.org/citations.svg?maxAge=86400)](https://scholar.google.com/scholar?cites=15065215520855508960&as_sdt=2005&sciodt=0,5&hl=en) -->
<!-- [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5601736.svg)](https://doi.org/10.1186/1756-0500-5-367)
![DOI](https://doi.org/10.1186/1756-0500-5-367) -->
<!-- ![Scrutinizer code quality (GitHub/Bitbucket)](https://img.shields.io/scrutinizer/quality/g/alanwilter/acpype) -->
Expand All @@ -38,6 +41,8 @@ Several flavours of AMBER FF are ported already for GROMACS (see [ffamber](http:

This code is released under **[GNU General Public License V3](https://www.gnu.org/licenses/gpl-3.0.en.html)**.

See online [documentation](https://acpype.readthedocs.io/) for more.

### **NO WARRANTY AT ALL**

It was inspired by:
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-time-machine
theme: jekyll-theme-time-machine
Loading

0 comments on commit f25680b

Please sign in to comment.