Skip to content

Commit

Permalink
Merge pull request #16 from craabreu/linter
Browse files Browse the repository at this point in the history
Added linting workflow
  • Loading branch information
craabreu committed Apr 17, 2023
2 parents 2583fd3 + 2271a21 commit e507b4f
Show file tree
Hide file tree
Showing 16 changed files with 891 additions and 575 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/Linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Linter

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
linter:
name: Linter
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3

- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba
- uses: mamba-org/provision-with-micromamba@main
with:
environment-file: devtools/conda-envs/lint_env.yaml
environment-name: linter
channels: conda-forge,defaults
extra-specs: |
python=${{ matrix.python-version }}
- name: Install package
# conda setup requires this special shell
shell: bash -l {0}
run: |
python -m pip install . --no-deps
micromamba list
- name: Run flake8
shell: bash -l {0}
run: flake8 --ignore=E203,W503 ufedmm/

- name: Run black
shell: bash -l {0}
run: black --line-length 100 --diff --color ufedmm/

- name: Run isort
shell: bash -l {0}
run: isort --check-only ufedmm/

# - name: Run pylint
# shell: bash -l {0}
# run: pylint --rcfile=devtools/linters/pylintrc ufedmm/
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ Unified Free Energy Dynamics with OpenMM
========================================

[//]: # (Badges)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)]()

[//]: # (Badges)
[![GitHub Actions Build Status](https://github.com/RedesignScience/ufedmm/workflows/Linux/badge.svg)](https://github.com/RedesignScience/ufedmm/actions?query=workflow%3ALinux)
[![GitHub Actions Build Status](https://github.com/RedesignScience/ufedmm/workflows/MacOS/badge.svg)](https://github.com/RedesignScience/ufedmm/actions?query=workflow%3AMacOS)
[![GitHub Actions Build Status](https://github.com/RedesignScience/ufedmm/workflows/Windows/badge.svg)](https://github.com/RedesignScience/ufedmm/actions?query=workflow%3AWindows)
[![codecov](https://codecov.io/gh/craabreu/ufedmm/branch/master/graph/badge.svg)](https://codecov.io/gh/craabreu/ufedmm/branch/master)
[![GitHub Actions Build Status](https://github.com/craabreu/ufedmm/workflows/Linux/badge.svg)](https://github.com/craabreu/ufedmm/actions?query=workflow%3ALinux)
[![GitHub Actions Build Status](https://github.com/craabreu/ufedmm/workflows/MacOS/badge.svg)](https://github.com/craabreu/ufedmm/actions?query=workflow%3AMacOS)
[![GitHub Actions Build Status](https://github.com/craabreu/ufedmm/workflows/Windows/badge.svg)](https://github.com/craabreu/ufedmm/actions?query=workflow%3AWindows)
[![codecov](https://codecov.io/gh/craabreu/ufedmm/branch/main/graph/badge.svg)](https://codecov.io/gh/craabreu/ufedmm/branch/main)
[![Documentation Status](https://readthedocs.org/projects/ufedmm/badge/?style=flat)](https://readthedocs.org/projects/ufedmm)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)]()

UFEDMM extends [OpenMM's Python API] so that the user can easily run
efficient simulations in extended phase spaces, perform enhanced sampling
Expand Down
18 changes: 18 additions & 0 deletions devtools/conda-envs/lint_env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: linter
channels:
- conda-forge
dependencies:
# Base depends
- python
- pip
- numpy
- openmm
- pandas
- pyyaml
- scipy

# Linting
- flake8
- black
- isort
# - pylint
17 changes: 17 additions & 0 deletions devtools/linters/pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[MAIN]

ignored-modules=openmm.unit
ignore=_version.py

[DESIGN]

max-locals=25 # Maximum number of local variables for function/method body

[MESSAGES CONTROL]

disable = unexpected-keyword-arg, # Avoids false-positives with Context.getState method
too-many-arguments

[FORMAT]

good-names=i,j,k,m,n,_,v,x,y,z
6 changes: 6 additions & 0 deletions devtools/scripts/format_and_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e -v
isort ./ufedmm
black --line-length 100 ./ufedmm
flake8 --ignore=E203,W503 ./ufedmm
# pylint --rcfile=devtools/linters/pylintrc ./ufedmm
12 changes: 6 additions & 6 deletions ufedmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@


from ._version import get_versions
from .analysis import * # noqa: F401, F403
from .integrators import * # noqa: F401, F403
from .io import * # noqa: F401, F403
from .testmodels import * # noqa: F401, F403
from .ufedmm import CollectiveVariable # noqa: F401, F403
from .ufedmm import DynamicalVariable # noqa: F401, F403
from .ufedmm import ExtendedSpaceContext # noqa: F401, F403
from .ufedmm import ExtendedSpaceSimulation # noqa: F401, F403
from .ufedmm import UnifiedFreeEnergyDynamics # noqa: F401, F403
from .integrators import * # noqa: F401, F403
from .io import * # noqa: F401, F403
from .analysis import * # noqa: F401, F403
from .testmodels import * # noqa: F401, F403

# Handle versioneer:
versions = get_versions()
__version__ = versions['version']
__git_revision__ = versions['full-revisionid']
__version__ = versions["version"]
__git_revision__ = versions["full-revisionid"]
del get_versions, versions
Loading

0 comments on commit e507b4f

Please sign in to comment.