-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
58aed59
commit f25680b
Showing
196 changed files
with
2,744 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ coverage.xml | |
|
||
# Sphinx documentation | ||
docs/_build/ | ||
docs/_autosummary | ||
|
||
pip-selfcheck.json | ||
*.acpype | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
theme: jekyll-theme-time-machine | ||
theme: jekyll-theme-time-machine |
Oops, something went wrong.