Skip to content

Commit

Permalink
Infrastructure update (#31)
Browse files Browse the repository at this point in the history
* lots of infrastructure updates

* bump version to 1.0.5
  • Loading branch information
JoshKarpel committed Sep 16, 2020
1 parent 3e53cab commit e87b95e
Show file tree
Hide file tree
Showing 34 changed files with 268 additions and 258 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ coverage:
range: 50..90
round: down
precision: 0

comment:
layout: "diff, files"
14 changes: 13 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
[run]
omit = tests/*, */virtualenv/*
branch = True

[report]
exclude_lines =
pragma: no cover
pragma: unreachable
def __repr__
def __str__
raise NotImplementedError
raise AssertionError
if 0:
if False:
if __name__ == .__main__.:
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: pre-commit

on:
push:
branches:
- master
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
24 changes: 24 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: publish-to-pypi

on:
release:
types: [published]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install build dependencies
run: pip install wheel
- name: Build packages
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.3.1
with:
user: __token__
password: ${{ secrets.pypi_token }}
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
name: Tests
name: tests

on: [push]
on:
push:
branches:
- master
pull_request:

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: [3.6, 3.7]
platform: [ubuntu-latest, windows-latest, macos-latest, ubuntu-20.04, ubuntu-18.04]
python-version: [3.6, 3.7, 3.8]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-dev.txt
pip install codecov
pip install .[tests]
- name: Test with pytest
run: pytest --cov -- tests/
- name: Upload coverage
Expand Down
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: debug-statements
- id: check-merge-conflict
- id: mixed-line-ending
- id: check-case-conflict
- id: forbid-new-submodules
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.8.0
hooks:
- id: blacken-docs
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.11.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 5.5.2
hooks:
- id: isort
18 changes: 14 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
version: 2

build:
image: latest
image: latest

python:
version: 3.6
sphinx:
configuration: docs/source/conf.py

requirements_file: docs/requirements.txt
formats: all

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

20 changes: 20 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
strict_yaml_branch: master
coverage:
range: 50..100
round: down
precision: 0
status:
project:
default:
target: auto
threshold: 5
only_pulls: true
patch:
default:
target: auto
threshold: 20
only_pulls: true
comment:
layout: "diff, files"
require_changes: false
22 changes: 0 additions & 22 deletions covtest.py

This file was deleted.

18 changes: 5 additions & 13 deletions dev/Gelmi2014.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from idesolver import IDESolver

Expand All @@ -22,16 +22,12 @@ def make_comparison_plot(name, solver, exact):
ax.legend(loc="best")
ax.grid(True)

ax.set_title(
f"Solution for Global Error Tolerance = {solver.global_error_tolerance}"
)
ax.set_title(f"Solution for Global Error Tolerance = {solver.global_error_tolerance}")
ax.set_xlabel(r"$x$")
ax.set_ylabel(r"$y(x)$")

plt.savefig(
os.path.join(
OUT_DIR, f"example_{name}_comparison_at_tol={solver.global_error_tolerance}"
)
os.path.join(OUT_DIR, f"example_{name}_comparison_at_tol={solver.global_error_tolerance}")
)


Expand All @@ -45,16 +41,12 @@ def make_error_plot(name, solver, exact):
ax.set_yscale("log")
ax.grid(True)

ax.set_title(
f"Local Error for Global Error Tolerance = {solver.global_error_tolerance}"
)
ax.set_title(f"Local Error for Global Error Tolerance = {solver.global_error_tolerance}")
ax.set_xlabel(r"$x$")
ax.set_ylabel(r"$\left| y_{\mathrm{solver}}(x) - y_{\mathrm{exact}}(x) \right|$")

plt.savefig(
os.path.join(
OUT_DIR, f"example_{name}_error_at_tol={solver.global_error_tolerance}"
)
os.path.join(OUT_DIR, f"example_{name}_error_at_tol={solver.global_error_tolerance}")
)


Expand Down
2 changes: 1 addition & 1 deletion dev/complex_valued.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from idesolver import IDESolver

Expand Down
2 changes: 1 addition & 1 deletion dev/convergence.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from idesolver import IDESolver

Expand Down
10 changes: 3 additions & 7 deletions docs/make_figs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from idesolver import IDESolver

Expand All @@ -25,9 +25,7 @@ def make_comparison_plot(name, solver, exact):
ax.legend(loc="best")
ax.grid(True)

ax.set_title(
f"Solution for Global Error Tolerance = {solver.global_error_tolerance}"
)
ax.set_title(f"Solution for Global Error Tolerance = {solver.global_error_tolerance}")
ax.set_xlabel(r"$x$", fontsize=12)
ax.set_ylabel(r"$y(x)$", fontsize=12)

Expand All @@ -45,9 +43,7 @@ def make_error_plot(name, solver, exact):
ax.set_yscale("log")
ax.grid(True)

ax.set_title(
f"Local Error for Global Error Tolerance = {solver.global_error_tolerance}"
)
ax.set_title(f"Local Error for Global Error Tolerance = {solver.global_error_tolerance}")
ax.set_xlabel(r"$x$", fontsize=12)
ax.set_ylabel(
r"$\left| y_{\mathrm{idesolver}}(x) - y_{\mathrm{analytic}}(x) \right|$",
Expand Down
4 changes: 0 additions & 4 deletions docs/requirements.txt

This file was deleted.

5 changes: 5 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Change Log

.. currentmodule:: idesolver

v1.0.5
------
* Relaxes dependency version restrictions in advance of changes to ``pip``.
There shouldn't be any impact on users.

v1.0.4
------
* Revision of packaging and CI flow. There shouldn't be any impact on users.
Expand Down
8 changes: 4 additions & 4 deletions idesolver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
A general purpose integro-differential equation (IDE) solver.
Copyright (C) 2017-2019 Joshua T Karpel
Full license available at github.com/JoshKarpel/LICENSE
Copyright (C) 2017-2020 Joshua T Karpel
Full license available at https://github.com/JoshKarpel/idesolver/blob/master/LICENSE
"""

from .idesolver import *
from .exceptions import *
from .version import __version__, version_info
from .idesolver import *
from .version import __version__
5 changes: 5 additions & 0 deletions idesolver/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
class IDEConvergenceWarning(Warning):
"""The solver is not converging."""

pass


class IDESolverException(Exception):
"""Base exception for all IDESolver exceptions."""

pass


class InvalidParameter(IDESolverException):
"""Invalid parameters were passed to the solver's constructor."""

pass


class ODESolutionFailed(IDESolverException):
"""IDESolver was not able to find a solution."""

pass


Expand All @@ -23,4 +27,5 @@ class UnexpectedlyComplexValuedIDE(IDESolverException):
IDESolver was expecting a real-valued IDE based on the inputs, but it
appears to be complex-valued.
"""

pass

0 comments on commit e87b95e

Please sign in to comment.