Skip to content

Commit 960c7fd

Browse files
authored
Merge pull request #1 from DeepanshS/latest
Code cleanup and documentation
2 parents ac56daf + 0a1d6d4 commit 960c7fd

File tree

80 files changed

+6357
-4413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+6357
-4413
lines changed

.flake8

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[flake8]
2-
ignore = E741 W503, E203 E265 C901
3-
exclude = .eggs,*.egg,build, mrinversion/kernel/__init__.py examples/**
4-
filename = *.pyx,*.px*, *py
2+
ignore = E203
3+
exclude = .eggs,*.egg,build, mrinversion/kernel/__init__.py, mrinversion/utils.py
4+
filename = *.pyx, *.px*, *py
55
max-line-length = 88
6-
max-complexity = 18
7-
select = B,C,E,F,W,T4,B9
8-
9-
10-
## E203, E266, E501, F403, F811, F841, F401, C901
6+
max-complexity = 10
7+
select = C,E,F,W,N8
8+
count = True
9+
statistics = True
Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,40 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: CI (pip)
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615
strategy:
1716
matrix:
1817
python-version: [3.6, 3.7, 3.8]
1918

2019
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Install mrsimulator dependencies
27-
run: |
28-
sudo apt-get install libopenblas-dev libfftw3-dev -y
29-
pip install "numpy>=1.17" cython
30-
pip install git+https://github.com/DeepanshS/mrsimulator.git
31-
- name: Install mrinversion
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install flake8 pytest
35-
pip install -r requirements.txt
36-
pip install -r requirements-dev.txt
37-
python setup.py develop
38-
- name: Lint with flake8
39-
run: |
40-
# stop the build if there are Python syntax errors or undefined names
41-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude="docs/*"
42-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude="docs/* mrinversion/plot.py"
44-
- name: Test with pytest
45-
run: |
46-
pytest --cov=./ --cov-report=xml
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install mrinversion
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install flake8 pytest
29+
pip install -r requirements.txt
30+
pip install -r requirements-dev.txt
31+
python setup.py develop
32+
- name: Lint with flake8
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude="docs/*"
36+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude="docs/* mrinversion/plot.py"
38+
- name: Test with pytest
39+
run: |
40+
pytest --cov=./ --cov-report=xml

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6-
# files
7-
*.html
8-
96
#folders
107
cython_debug/
118
.vscode/**

.pre-commit-config.yaml

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,56 @@ default_language_version:
22
python: python3.7
33
default_stages: [commit, push, manual]
44
repos:
5-
- repo: https://github.com/ambv/black
5+
- repo: https://github.com/ambv/black
66
rev: stable
77
hooks:
8-
- id: black
9-
name: black
10-
entry: black
11-
language_version: python3.7
12-
require_serial: true
13-
types: [python]
14-
files: \.pyi?$
8+
- id: black
9+
name: black
10+
entry: black
11+
language_version: python3.7
12+
require_serial: true
13+
types: [python]
14+
files: \.pyi?$
1515

16-
- repo: https://github.com/asottile/blacken-docs
16+
- repo: https://github.com/asottile/blacken-docs
1717
rev: v1.0.0
1818
hooks:
19-
- id: blacken-docs
19+
- id: blacken-docs
2020
additional_dependencies: [black==19.3b0]
2121
language: python
2222
language_version: python3.7
2323

24-
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
2525
rev: v1.2.3
2626
hooks:
27-
- id: flake8
28-
- id: trailing-whitespace
29-
language: python
30-
types: [text]
31-
- id: debug-statements
32-
name: Debug Statements (Python)
33-
description: Check for debugger imports and py37+ `breakpoint()` calls in python source.
34-
entry: debug-statement-hook
35-
language: python
36-
types: [python]
37-
38-
- repo: https://github.com/asottile/reorder_python_imports
27+
- id: check-yaml
28+
language: python
29+
- id: check-added-large-files
30+
language: python
31+
- id: fix-encoding-pragma
32+
language: python
33+
- id: check-docstring-first
34+
language: python
35+
- id: flake8
36+
language: python
37+
- id: end-of-file-fixer
38+
language: python
39+
- id: trailing-whitespace
40+
language: python
41+
types: [text]
42+
- id: debug-statements
43+
name: Debug Statements (Python)
44+
description: Check for debugger imports and py37+ `breakpoint()` calls in python source.
45+
entry: debug-statement-hook
46+
language: python
47+
types: [python]
48+
- repo: https://github.com/asottile/reorder_python_imports
3949
rev: v1.4.0
4050
hooks:
41-
- id: reorder-python-imports
42-
name: Reorder python imports
43-
description: This hook reorders imports in python files.
44-
entry: reorder-python-imports
45-
language: python
46-
types: [python]
47-
minimum_pre_commit_version: "0.15.0"
48-
51+
- id: reorder-python-imports
52+
name: Reorder python imports
53+
description: This hook reorders imports in python files.
54+
entry: reorder-python-imports
55+
language: python
56+
types: [python]
57+
minimum_pre_commit_version: "0.15.0"

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
os: linux
2+
dist: xenial
3+
language: python
4+
python:
5+
- "3.6"
6+
- "3.7"
7+
8+
cache: pip
9+
10+
# safelist
11+
branches:
12+
only:
13+
- master
14+
15+
before_install:
16+
- pip install --upgrade pip
17+
- pip install -r requirements-dev.txt
18+
19+
install:
20+
- python setup.py develop
21+
22+
# command to run tests
23+
script:
24+
- pytest --cov=./
25+
26+
after_success:
27+
- codecov

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ help:
2222

2323
clean:
2424
rm -rf $(BUILDDIR)/*
25-
rm -rf auto_examples/
25+
rm -rf auto_examples/

docs/_static/button.css

Lines changed: 0 additions & 36 deletions
This file was deleted.
-35.5 KB
Binary file not shown.
-10.6 KB
Binary file not shown.

docs/_static/null.png

91 Bytes
Loading

0 commit comments

Comments
 (0)